DAY AND NIGHT

This commit is contained in:
Bob 2024-10-09 23:19:54 +02:00
parent 66711f963e
commit c7ced50e67
43 changed files with 761 additions and 320 deletions

View File

@ -35,7 +35,7 @@ public class WeaponRecipes {
//SEDNA Guns
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_pepperbox, 1), new Object[] { "IIW", " C", 'I', IRON.ingot(), 'W', KEY_PLANKS, 'C', CU.ingot() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_atlas, 1), new Object[] { "BRM", " G", 'B', STEEL.lightBarrel(), 'R', STEEL.lightReceiver(), 'M', GUNMETAL.mechanism(), 'G', WOOD.grip() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_light_revolver, 1), new Object[] { "BRM", " G", 'B', STEEL.lightBarrel(), 'R', STEEL.lightReceiver(), 'M', GUNMETAL.mechanism(), 'G', WOOD.grip() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_henry, 1), new Object[] { "BRP", "BMS", 'B', STEEL.lightBarrel(), 'R', GUNMETAL.lightReceiver(), 'M', GUNMETAL.mechanism(), 'S', WOOD.stock(), 'P', GUNMETAL.plate() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_greasegun, 1), new Object[] { "BRS", "SMG", 'B', STEEL.lightBarrel(), 'R', STEEL.lightReceiver(), 'S', STEEL.bolt(), 'M', GUNMETAL.mechanism(), 'G', STEEL.grip() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_maresleg, 1), new Object[] { "BRM", "BGS", 'B', STEEL.lightBarrel(), 'R', STEEL.lightReceiver(), 'M', GUNMETAL.mechanism(), 'G', STEEL.bolt(), 'S', WOOD.stock() });

View File

@ -1529,7 +1529,6 @@ public class ModItems {
public static Item gun_panzerschreck;
public static Item gun_quadro;
public static Item gun_hk69;
public static Item gun_congolake;
public static Item gun_stinger;
public static Item gun_skystinger;
public static Item gun_revolver;
@ -1624,7 +1623,8 @@ public class ModItems {
public static Item ammo_debug;
public static Item gun_pepperbox;
public static Item gun_atlas;
public static Item gun_light_revolver;
public static Item gun_light_revolver_dani;
public static Item gun_henry;
public static Item gun_greasegun;
public static Item gun_maresleg;
@ -1633,6 +1633,7 @@ public class ModItems {
public static Item gun_carbine;
public static Item gun_am180;
public static Item gun_liberator;
public static Item gun_congolake;
public static Item ammo_standard;
@ -4094,7 +4095,7 @@ public class ModItems {
gun_panzerschreck = new ItemGunBase(GunRocketFactory.getPanzConfig()).setUnlocalizedName("gun_panzerschreck").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_panzerschreck");
gun_quadro = new ItemGunBase(GunRocketFactory.getQuadroConfig()).setUnlocalizedName("gun_quadro").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_quadro");
gun_hk69 = new ItemGunBase(GunGrenadeFactory.getHK69Config()).setUnlocalizedName("gun_hk69").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_hk69");
gun_congolake = new ItemGunBase(GunGrenadeFactory.getCongoConfig()).setUnlocalizedName("gun_congolake").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_congolake");
//gun_congolake = new ItemGunBase(GunGrenadeFactory.getCongoConfig()).setUnlocalizedName("gun_congolake").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_congolake");
gun_stinger = new ItemGunBase(GunRocketHomingFactory.getStingerConfig()).setUnlocalizedName("gun_stinger").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_stinger");
gun_skystinger = new ItemGunBase(GunRocketHomingFactory.getSkyStingerConfig()).setUnlocalizedName("gun_skystinger").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_skystinger");
gun_revolver = new ItemGunBase(Gun357MagnumFactory.getRevolverConfig()).setUnlocalizedName("gun_revolver").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_revolver");
@ -6980,7 +6981,6 @@ public class ModItems {
GameRegistry.registerItem(gun_panzerschreck, gun_panzerschreck.getUnlocalizedName());
GameRegistry.registerItem(gun_quadro, gun_quadro.getUnlocalizedName());
GameRegistry.registerItem(gun_hk69, gun_hk69.getUnlocalizedName());
GameRegistry.registerItem(gun_congolake, gun_congolake.getUnlocalizedName());
GameRegistry.registerItem(gun_stinger, gun_stinger.getUnlocalizedName());
GameRegistry.registerItem(gun_fatman, gun_fatman.getUnlocalizedName());
GameRegistry.registerItem(gun_proto, gun_proto.getUnlocalizedName());
@ -7041,7 +7041,8 @@ public class ModItems {
GameRegistry.registerItem(ammo_debug, ammo_debug.getUnlocalizedName());
GameRegistry.registerItem(gun_pepperbox, gun_pepperbox.getUnlocalizedName());
GameRegistry.registerItem(gun_atlas, gun_atlas.getUnlocalizedName());
GameRegistry.registerItem(gun_light_revolver, gun_light_revolver.getUnlocalizedName());
GameRegistry.registerItem(gun_light_revolver_dani, gun_light_revolver_dani.getUnlocalizedName());
GameRegistry.registerItem(gun_henry, gun_henry.getUnlocalizedName());
GameRegistry.registerItem(gun_greasegun, gun_greasegun.getUnlocalizedName());
GameRegistry.registerItem(gun_maresleg, gun_maresleg.getUnlocalizedName());
@ -7050,6 +7051,7 @@ public class ModItems {
GameRegistry.registerItem(gun_carbine, gun_carbine.getUnlocalizedName());
GameRegistry.registerItem(gun_am180, gun_am180.getUnlocalizedName());
GameRegistry.registerItem(gun_liberator, gun_liberator.getUnlocalizedName());
GameRegistry.registerItem(gun_congolake, gun_congolake.getUnlocalizedName());
GameRegistry.registerItem(ammo_standard, ammo_standard.getUnlocalizedName());

View File

@ -1,9 +1,12 @@
package com.hbm.items.weapon.sedna;
import java.util.ArrayList;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.SmokeNode;
import com.hbm.items.weapon.sedna.factory.GunStateDecider;
import com.hbm.items.weapon.sedna.factory.Lego;
import com.hbm.items.weapon.sedna.hud.IHUDComponent;
@ -20,11 +23,12 @@ import net.minecraft.item.ItemStack;
* */
public class GunConfig {
public List<SmokeNode> smokeNodes = new ArrayList();
public static final String O_RECEIVERS = "O_RECEIVERS";
public static final String F_DURABILITY = "F_DURABILITY";
public static final String I_DRAWDURATION = "I_DRAWDURATION";
public static final String I_INSPECTDURATION = "I_INSPECTDURATION";
public static final String I_JAMDURATION = "I_JAMDURATION";
public static final String O_CROSSHAIR = "O_CROSSHAIR";
public static final String B_RELOADANIMATIONSEQUENTIAL = "B_RELOADANIMATIONSEQUENTIAL";
public static final String CON_SMOKE = "CON_SMOKE";
@ -48,7 +52,6 @@ public class GunConfig {
protected float durability_DNA;
protected int drawDuration_DNA = 0;
protected int inspectDuration_DNA = 0;
protected int jamDuration_DNA = 0;
protected Crosshair crosshair_DNA;
protected boolean reloadAnimationsSequential_DNA;
/** Handles smoke clientside */
@ -77,7 +80,6 @@ public class GunConfig {
public float getDurability(ItemStack stack) { return WeaponUpgradeManager.eval(durability_DNA, stack, F_DURABILITY, this); }
public int getDrawDuration(ItemStack stack) { return WeaponUpgradeManager.eval(drawDuration_DNA, stack, I_DRAWDURATION, this); }
public int getInspectDuration(ItemStack stack) { return WeaponUpgradeManager.eval(inspectDuration_DNA, stack, I_INSPECTDURATION, this); }
public int getJamDuration(ItemStack stack) { return WeaponUpgradeManager.eval(jamDuration_DNA, stack, I_JAMDURATION, this); }
public Crosshair getCrosshair(ItemStack stack) { return WeaponUpgradeManager.eval(crosshair_DNA, stack, O_CROSSHAIR, this); }
public boolean getReloadAnimSequential(ItemStack stack) { return WeaponUpgradeManager.eval(reloadAnimationsSequential_DNA, stack, B_RELOADANIMATIONSEQUENTIAL, this); }
public BiConsumer<ItemStack, LambdaContext> getSmokeHandler(ItemStack stack) { return WeaponUpgradeManager.eval(smokeHandler_DNA, stack, CON_SMOKE, this); }
@ -104,7 +106,6 @@ public class GunConfig {
public GunConfig dura(float dura) { this.durability_DNA = dura; return this; }
public GunConfig draw(int draw) { this.drawDuration_DNA = draw; return this; }
public GunConfig inspect(int inspect) { this.inspectDuration_DNA = inspect; return this; }
public GunConfig jam(int jam) { this.jamDuration_DNA = jam; return this; }
public GunConfig crosshair(Crosshair crosshair) { this.crosshair_DNA = crosshair; return this; }
public GunConfig reloadSequential(boolean flag) { this.reloadAnimationsSequential_DNA = flag; return this; }

View File

@ -1,7 +1,5 @@
package com.hbm.items.weapon.sedna;
import java.util.ArrayList;
import java.util.List;
import java.util.function.BiConsumer;
import com.hbm.handler.CasingEjector;
@ -36,43 +34,44 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipReceiver, IItemHUD {
/** Timestamp for rendering smoke nodes and muzzle flashes */
public long lastShot;
public long[] lastShot;
/** [0;1] randomized every shot for various rendering applications */
public double shotRand = 0D;
public List<SmokeNode> smokeNodes = new ArrayList();
public static float recoilVertical = 0;
public static float recoilHorizontal = 0;
public static float offsetVertical = 0;
public static float offsetHorizontal = 0;
public static final String O_GUNCONFIG = "O_GUNCONFIG";
public static final String O_GUNCONFIG = "O_GUNCONFIG_";
public static final String KEY_DRAWN = "drawn";
public static final String KEY_AIMING = "aiming";
public static final String KEY_WEAR = "wear";
public static final String KEY_TIMER = "timer";
public static final String KEY_STATE = "state";
public static final String KEY_PRIMARY = "mouse1";
public static final String KEY_SECONDARY = "mouse2";
public static final String KEY_TERTIARY = "mouse3";
public static final String KEY_RELOAD = "reload";
public static final String KEY_LASTANIM = "lastanim";
public static final String KEY_ANIMTIMER = "animtimer";
public static final String KEY_WEAR = "wear_";
public static final String KEY_TIMER = "timer_";
public static final String KEY_STATE = "state_";
public static final String KEY_PRIMARY = "mouse1_";
public static final String KEY_SECONDARY = "mouse2_";
public static final String KEY_TERTIARY = "mouse3_";
public static final String KEY_RELOAD = "reload_";
public static final String KEY_LASTANIM = "lastanim_";
public static final String KEY_ANIMTIMER = "animtimer_";
public static float prevAimingProgress;
public static float aimingProgress;
/** NEVER ACCESS DIRECTLY - USE GETTER */
public GunConfig config_DNA;
private GunConfig[] configs_DNA;
public GunConfig getConfig(ItemStack stack) {
return WeaponUpgradeManager.eval(config_DNA, stack, O_GUNCONFIG, this);
public GunConfig getConfig(ItemStack stack, int index) {
GunConfig cfg = configs_DNA[index];
return WeaponUpgradeManager.eval(cfg, stack, O_GUNCONFIG + index, this);
}
public ItemGunBaseNT(GunConfig cfg) {
public ItemGunBaseNT(GunConfig... cfg) {
this.setMaxStackSize(1);
this.config_DNA = cfg;
this.configs_DNA = cfg;
this.lastShot = new long[cfg.length];
this.setCreativeTab(MainRegistry.weaponTab);
}
@ -93,29 +92,33 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
@Override
public void handleKeybind(EntityPlayer player, ItemStack stack, EnumKeybind keybind, boolean newState) {
GunConfig config = getConfig(stack);
LambdaContext ctx = new LambdaContext(config, player);
if(keybind == EnumKeybind.GUN_PRIMARY && newState && !getPrimary(stack)) { if(config.getPressPrimary(stack) != null) config.getPressPrimary(stack).accept(stack, ctx); this.setPrimary(stack, newState); return; }
if(keybind == EnumKeybind.GUN_PRIMARY && !newState && getPrimary(stack)) { if(config.getReleasePrimary(stack) != null) config.getReleasePrimary(stack).accept(stack, ctx); this.setPrimary(stack, newState); return; }
if(keybind == EnumKeybind.GUN_SECONDARY && newState && !getSecondary(stack)) { if(config.getPressSecondary(stack) != null) config.getPressSecondary(stack).accept(stack, ctx); this.setSecondary(stack, newState); return; }
if(keybind == EnumKeybind.GUN_SECONDARY && !newState && getSecondary(stack)) { if(config.getReleaseSecondary(stack) != null) config.getReleaseSecondary(stack).accept(stack, ctx); this.setSecondary(stack, newState); return; }
if(keybind == EnumKeybind.GUN_TERTIARY && newState && !getTertiary(stack)) { if(config.getPressTertiary(stack) != null) config.getPressTertiary(stack).accept(stack, ctx); this.setTertiary(stack, newState); return; }
if(keybind == EnumKeybind.GUN_TERTIARY && !newState && getTertiary(stack)) { if(config.getReleaseTertiary(stack) != null) config.getReleaseTertiary(stack).accept(stack, ctx); this.setTertiary(stack, newState); return; }
if(keybind == EnumKeybind.RELOAD && newState && !getReloadKey(stack)) { if(config.getPressReload(stack) != null) config.getPressReload(stack).accept(stack, ctx); this.setReloadKey(stack, newState); return; }
if(keybind == EnumKeybind.RELOAD && !newState && getReloadKey(stack)) { if(config.getReleaseReload(stack) != null) config.getReleaseReload(stack).accept(stack, ctx); this.setReloadKey(stack, newState); return; }
int configs = this.configs_DNA.length;
for(int i = 0; i < configs; i++) {
GunConfig config = getConfig(stack, i);
LambdaContext ctx = new LambdaContext(config, player, i);
if(keybind == EnumKeybind.GUN_PRIMARY && newState && !getPrimary(stack, i)) { if(config.getPressPrimary(stack) != null) config.getPressPrimary(stack).accept(stack, ctx); this.setPrimary(stack, i, newState); continue; }
if(keybind == EnumKeybind.GUN_PRIMARY && !newState && getPrimary(stack, i)) { if(config.getReleasePrimary(stack) != null) config.getReleasePrimary(stack).accept(stack, ctx); this.setPrimary(stack, i, newState); continue; }
if(keybind == EnumKeybind.GUN_SECONDARY && newState && !getSecondary(stack, i)) { if(config.getPressSecondary(stack) != null) config.getPressSecondary(stack).accept(stack, ctx); this.setSecondary(stack, i, newState); continue; }
if(keybind == EnumKeybind.GUN_SECONDARY && !newState && getSecondary(stack, i)) { if(config.getReleaseSecondary(stack) != null) config.getReleaseSecondary(stack).accept(stack, ctx); this.setSecondary(stack, i, newState); continue; }
if(keybind == EnumKeybind.GUN_TERTIARY && newState && !getTertiary(stack, i)) { if(config.getPressTertiary(stack) != null) config.getPressTertiary(stack).accept(stack, ctx); this.setTertiary(stack, i, newState); continue; }
if(keybind == EnumKeybind.GUN_TERTIARY && !newState && getTertiary(stack, i)) { if(config.getReleaseTertiary(stack) != null) config.getReleaseTertiary(stack).accept(stack, ctx); this.setTertiary(stack, i, newState); continue; }
if(keybind == EnumKeybind.RELOAD && newState && !getReloadKey(stack, i)) { if(config.getPressReload(stack) != null) config.getPressReload(stack).accept(stack, ctx); this.setReloadKey(stack, i, newState); continue; }
if(keybind == EnumKeybind.RELOAD && !newState && getReloadKey(stack, i)) { if(config.getReleaseReload(stack) != null) config.getReleaseReload(stack).accept(stack, ctx); this.setReloadKey(stack, i, newState); continue; }
}
}
@Override
public void onEquip(EntityPlayer player, ItemStack stack) {
playAnimation(player, stack, AnimType.EQUIP);
for(int i = 0; i < this.configs_DNA.length; i++) playAnimation(player, stack, AnimType.EQUIP, i);
}
public static void playAnimation(EntityPlayer player, ItemStack stack, AnimType type) {
public static void playAnimation(EntityPlayer player, ItemStack stack, AnimType type, int index) {
if(player instanceof EntityPlayerMP) {
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(type.ordinal()), (EntityPlayerMP) player);
setLastAnim(stack, type);
setAnimTimer(stack, 0);
PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(type.ordinal(), 0, index), (EntityPlayerMP) player);
setLastAnim(stack, index, type);
setAnimTimer(stack, index, 0);
}
}
@ -124,8 +127,13 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
if(!(entity instanceof EntityPlayer)) return;
EntityPlayer player = entity instanceof EntityPlayer ? (EntityPlayer) entity : null;
GunConfig config = this.getConfig(stack);
LambdaContext ctx = new LambdaContext(config, player);
int confNo = this.configs_DNA.length;
GunConfig[] configs = new GunConfig[confNo];
LambdaContext[] ctx = new LambdaContext[confNo];
for(int i = 0; i < confNo; i++) {
configs[i] = this.getConfig(stack, i);
ctx[i] = new LambdaContext(configs[i], player, i);
}
if(world.isRemote) {
@ -146,8 +154,8 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
aimingProgress = MathHelper.clamp_float(aimingProgress, 0F, 1F);
/// SMOKE NODES ///
if(config.getSmokeHandler(stack) != null) {
config.getSmokeHandler(stack).accept(stack, ctx);
for(int i = 0; i < confNo; i++) if(configs[i].getSmokeHandler(stack) != null) {
configs[i].getSmokeHandler(stack).accept(stack, ctx[i]);
}
}
return;
@ -155,24 +163,28 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
/// RESET WHEN NOT EQUIPPED ///
if(!isHeld) {
GunState current = this.getState(stack);
if(current != GunState.JAMMED) {
this.setState(stack, GunState.DRAWING);
this.setTimer(stack, config.getDrawDuration(stack));
for(int i = 0; i < confNo; i++) {
GunState current = this.getState(stack, i);
if(current != GunState.JAMMED) {
this.setState(stack, i, GunState.DRAWING);
this.setTimer(stack, i, configs[i].getDrawDuration(stack));
}
}
this.setIsAiming(stack, false);
return;
}
BiConsumer<ItemStack, LambdaContext> orchestra = config.getOrchestra(stack);
if(orchestra != null) orchestra.accept(stack, ctx);
setAnimTimer(stack, getAnimTimer(stack) + 1);
/// STTATE MACHINE ///
int timer = this.getTimer(stack);
if(timer > 0) this.setTimer(stack, timer - 1);
if(timer <= 1) config.getDecider(stack).accept(stack, ctx);
for(int i = 0; i < confNo; i++) {
BiConsumer<ItemStack, LambdaContext> orchestra = configs[i].getOrchestra(stack);
if(orchestra != null) orchestra.accept(stack, ctx[i]);
setAnimTimer(stack, i, getAnimTimer(stack, i) + 1);
/// STTATE MACHINE ///
int timer = this.getTimer(stack, i);
if(timer > 0) this.setTimer(stack, i, timer - 1);
if(timer <= 1) configs[i].getDecider(stack).accept(stack, ctx[i]);
}
}
public static void trySpawnCasing(Entity entity, CasingEjector ejector, BulletConfig bullet, ItemStack stack) {
@ -195,32 +207,32 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
public static boolean getIsDrawn(ItemStack stack) { return getValueBool(stack, KEY_DRAWN); }
public static void setIsDrawn(ItemStack stack, boolean value) { setValueBool(stack, KEY_DRAWN, value); }
// GUN STATE TIMER //
public static int getTimer(ItemStack stack) { return getValueInt(stack, KEY_TIMER); }
public static void setTimer(ItemStack stack, int value) { setValueInt(stack, KEY_TIMER, value); }
public static int getTimer(ItemStack stack, int index) { return getValueInt(stack, KEY_TIMER + index); }
public static void setTimer(ItemStack stack, int index, int value) { setValueInt(stack, KEY_TIMER + index, value); }
// GUN STATE //
public static GunState getState(ItemStack stack) { return EnumUtil.grabEnumSafely(GunState.class, getValueByte(stack, KEY_STATE)); }
public static void setState(ItemStack stack, GunState value) { setValueByte(stack, KEY_STATE, (byte) value.ordinal()); }
public static GunState getState(ItemStack stack, int index) { return EnumUtil.grabEnumSafely(GunState.class, getValueByte(stack, KEY_STATE + index)); }
public static void setState(ItemStack stack, int index, GunState value) { setValueByte(stack, KEY_STATE + index, (byte) value.ordinal()); }
// GUN AIMING //
public static boolean getIsAiming(ItemStack stack) { return getValueBool(stack, KEY_AIMING); }
public static void setIsAiming(ItemStack stack, boolean value) { setValueBool(stack, KEY_AIMING, value); }
// GUN AIMING //
public static float getWear(ItemStack stack) { return getValueFloat(stack, KEY_WEAR); }
public static void setWear(ItemStack stack, float value) { setValueFloat(stack, KEY_WEAR, value); }
public static float getWear(ItemStack stack, int index) { return getValueFloat(stack, KEY_WEAR + index); }
public static void setWear(ItemStack stack, int index, float value) { setValueFloat(stack, KEY_WEAR + index, value); }
// ANIM TRACKING //
public static AnimType getLastAnim(ItemStack stack) { return EnumUtil.grabEnumSafely(AnimType.class, getValueInt(stack, KEY_LASTANIM)); }
public static void setLastAnim(ItemStack stack, AnimType value) { setValueInt(stack, KEY_LASTANIM, value.ordinal()); }
public static int getAnimTimer(ItemStack stack) { return getValueInt(stack, KEY_ANIMTIMER); }
public static void setAnimTimer(ItemStack stack, int value) { setValueInt(stack, KEY_ANIMTIMER, value); }
public static AnimType getLastAnim(ItemStack stack, int index) { return EnumUtil.grabEnumSafely(AnimType.class, getValueInt(stack, KEY_LASTANIM + index)); }
public static void setLastAnim(ItemStack stack, int index, AnimType value) { setValueInt(stack, KEY_LASTANIM + index, value.ordinal()); }
public static int getAnimTimer(ItemStack stack, int index) { return getValueInt(stack, KEY_ANIMTIMER + index); }
public static void setAnimTimer(ItemStack stack, int index, int value) { setValueInt(stack, KEY_ANIMTIMER + index, value); }
// BUTTON STATES //
public static boolean getPrimary(ItemStack stack) { return getValueBool(stack, KEY_PRIMARY); }
public static void setPrimary(ItemStack stack, boolean value) { setValueBool(stack, KEY_PRIMARY, value); }
public static boolean getSecondary(ItemStack stack) { return getValueBool(stack, KEY_SECONDARY); }
public static void setSecondary(ItemStack stack, boolean value) { setValueBool(stack, KEY_SECONDARY, value); }
public static boolean getTertiary(ItemStack stack) { return getValueBool(stack, KEY_TERTIARY); }
public static void setTertiary(ItemStack stack, boolean value) { setValueBool(stack, KEY_TERTIARY, value); }
public static boolean getReloadKey(ItemStack stack) { return getValueBool(stack, KEY_RELOAD); }
public static void setReloadKey(ItemStack stack, boolean value) { setValueBool(stack, KEY_RELOAD, value); }
public static boolean getPrimary(ItemStack stack, int index) { return getValueBool(stack, KEY_PRIMARY + index); }
public static void setPrimary(ItemStack stack, int index, boolean value) { setValueBool(stack, KEY_PRIMARY + index, value); }
public static boolean getSecondary(ItemStack stack, int index) { return getValueBool(stack, KEY_SECONDARY + index); }
public static void setSecondary(ItemStack stack, int index, boolean value) { setValueBool(stack, KEY_SECONDARY + index, value); }
public static boolean getTertiary(ItemStack stack, int index) { return getValueBool(stack, KEY_TERTIARY + index); }
public static void setTertiary(ItemStack stack, int index, boolean value) { setValueBool(stack, KEY_TERTIARY + index, value); }
public static boolean getReloadKey(ItemStack stack, int index) { return getValueBool(stack, KEY_RELOAD + index); }
public static void setReloadKey(ItemStack stack, int index, boolean value) { setValueBool(stack, KEY_RELOAD + index, value); }
/// UTIL ///
@ -240,10 +252,12 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
public static class LambdaContext {
public final GunConfig config;
public final EntityPlayer player;
public final int configIndex;
public LambdaContext(GunConfig config, EntityPlayer player) {
public LambdaContext(GunConfig config, EntityPlayer player, int configIndex) {
this.config = config;
this.player = player;
this.configIndex = configIndex;
}
}
@ -256,15 +270,19 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
if(type == ElementType.CROSSHAIRS) {
event.setCanceled(true);
if(aimingProgress >= 1F) return;
RenderScreenOverlay.renderCustomCrosshairs(event.resolution, Minecraft.getMinecraft().ingameGUI, gun.getConfig(stack).getCrosshair(stack));
RenderScreenOverlay.renderCustomCrosshairs(event.resolution, Minecraft.getMinecraft().ingameGUI, gun.getConfig(stack, 0).getCrosshair(stack));
}
IHUDComponent[] components = gun.getConfig(stack).getHUDComponents(stack);
int confNo = this.configs_DNA.length;
if(components != null) for(IHUDComponent component : components) {
int bottomOffset = 0;
component.renderHUDComponent(event, type, player, stack, bottomOffset);
bottomOffset += component.getComponentHeight(player, stack);
for(int i = 0; i < confNo; i++) {
IHUDComponent[] components = gun.getConfig(stack, i).getHUDComponents(stack);
if(components != null) for(IHUDComponent component : components) {
int bottomOffset = 0;
component.renderHUDComponent(event, type, player, stack, bottomOffset, i);
bottomOffset += component.getComponentHeight(player, stack);
}
}
}

View File

@ -3,7 +3,6 @@ package com.hbm.items.weapon.sedna;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import com.hbm.handler.CasingEjector;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.mags.IMagazine;
@ -25,12 +24,12 @@ public class Receiver {
public static final String F_SPREADMOD = "F_SPREADMOD";
public static final String B_REFIREONHOLD = "B_REFIREONHOLD";
public static final String B_DOESDRYFIRE = "B_DOESDRYFIRE";
public static final String O_EJECTOR = "O_EJECTOR";
public static final String B_EJECTONFIRE = "B_EJECTONFIRE";
public static final String I_RELOADBEGINDURATION = "I_RELOADBEGINDURATION";
public static final String I_RELOADCYCLEDURATION = "I_RELOADCYCLEDURATION";
public static final String I_RELOADENDDURATION = "I_RELOADENDDURATION";
public static final String I_RELOADCOCKONEMPTY = "I_RELOADCOCKONEMPTY";
public static final String I_JAMDURATION = "I_JAMDURATION";
public static final String S_FIRESOUND = "S_FIRESOUND";
public static final String F_FIREVOLUME = "F_FIREVOLUME";
public static final String F_FIREPITCH = "F_FIREPITCH";
@ -52,12 +51,12 @@ public class Receiver {
protected float spreadModExtra_DNA = 0F;
protected boolean refireOnHold_DNA = false;
protected boolean doesDryFire_DNA = true;
protected CasingEjector ejector_DNA = null;
protected boolean ejectOnFire_DNA = true;
protected int reloadBeginDuration_DNA;
protected int reloadCycleDuration_DNA;
protected int reloadEndDuration_DNA;
protected int reloadCockOnEmpty_DNA;
protected int jamDuration_DNA = 0;
protected String fireSound_DNA;
protected float fireVolume_DNA = 1.0F;
protected float firePitch_DNA = 1.0F;
@ -75,12 +74,12 @@ public class Receiver {
public float getGunSpread(ItemStack stack) { return WeaponUpgradeManager.eval(this.spreadModExtra_DNA, stack, F_SPREADMOD, this); }
public boolean getRefireOnHold(ItemStack stack) { return WeaponUpgradeManager.eval(this.refireOnHold_DNA, stack, B_REFIREONHOLD, this); }
public boolean getDoesDryFire(ItemStack stack) { return WeaponUpgradeManager.eval(this.doesDryFire_DNA, stack, B_DOESDRYFIRE, this); }
public CasingEjector getEjector(ItemStack stack) { return WeaponUpgradeManager.eval(this.ejector_DNA, stack, O_EJECTOR, this); }
public boolean getEjectOnFire(ItemStack stack) { return WeaponUpgradeManager.eval(this.ejectOnFire_DNA, stack, B_EJECTONFIRE, this); }
public int getReloadBeginDuration(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadBeginDuration_DNA, stack, I_RELOADBEGINDURATION, this); }
public int getReloadCycleDuration(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadCycleDuration_DNA, stack, I_RELOADCYCLEDURATION, this); }
public int getReloadEndDuration(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadEndDuration_DNA, stack, I_RELOADENDDURATION, this); }
public int getReloadCockOnEmpty(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadCockOnEmpty_DNA, stack, I_RELOADCOCKONEMPTY, this); }
public int getJamDuration(ItemStack stack) { return WeaponUpgradeManager.eval(this.jamDuration_DNA, stack, I_JAMDURATION, this); }
public String getFireSound(ItemStack stack) { return WeaponUpgradeManager.eval(this.fireSound_DNA, stack, S_FIRESOUND, this); }
public float getFireVolume(ItemStack stack) { return WeaponUpgradeManager.eval(this.fireVolume_DNA, stack, F_FIREVOLUME, this); }
public float getFirePitch(ItemStack stack) { return WeaponUpgradeManager.eval(this.firePitch_DNA, stack, F_FIREPITCH, this); }
@ -99,10 +98,10 @@ public class Receiver {
public Receiver spread(float spread) { this.spreadModExtra_DNA = spread; return this; }
public Receiver auto(boolean auto) { this.refireOnHold_DNA = auto; return this; }
public Receiver dryfire(boolean dryfire) { this.doesDryFire_DNA = dryfire; return this; }
public Receiver ejector(CasingEjector ejector) { this.ejector_DNA = ejector; return this; }
public Receiver ejectOnFire(boolean eject) { this.ejectOnFire_DNA = eject; return this; }
public Receiver mag(IMagazine magazine) { this.magazine_DNA = magazine; return this; }
public Receiver offset(double f, double u, double s) { this.projectileOffset_DNA = Vec3.createVectorHelper(f, u, s); return this; }
public Receiver jam(int jam) { this.jamDuration_DNA = jam; return this; }
public Receiver reload(int delay) {
return reload(delay, delay, 0, 0);

View File

@ -1,6 +1,5 @@
package com.hbm.items.weapon.sedna.factory;
import com.hbm.handler.CasingEjector;
import com.hbm.items.ItemEnumMulti;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.BulletConfig;
@ -35,11 +34,10 @@ public class GunFactory {
/// GUNS ///
ModItems.gun_debug = new ItemGunBaseNT(new GunConfig()
.dura(600F).draw(15).jam(23).inspect(23).crosshair(Crosshair.L_CLASSIC).smoke(Lego.LAMBDA_STANDARD_SMOKE).orchestra(Orchestras.DEBUG_ORCHESTRA)
.dura(600F).draw(15).inspect(23).crosshair(Crosshair.L_CLASSIC).smoke(Lego.LAMBDA_STANDARD_SMOKE).orchestra(Orchestras.DEBUG_ORCHESTRA)
.rec(new Receiver(0)
.dmg(10F).delay(14).reload(46).sound("hbm:weapon.44Shoot", 1.0F, 1.0F)
.dmg(10F).delay(14).reload(46).jam(23).sound("hbm:weapon.44Shoot", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 12).addConfigs(ammo_debug, ammo_debug_buckshot))
.ejector(new CasingEjector().setMotion(0, -0.1, 0).setAngleRange(0.01F, 0.025F))
.offset(0.75, -0.0625, -0.3125D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE))
.pp(Lego.LAMBDA_STANDARD_CLICK_PRIMARY) .pr(Lego.LAMBDA_STANDARD_RELOAD) .pt(Lego.LAMBDA_TOGGLE_AIM)

View File

@ -32,7 +32,8 @@ public class GunFactoryClient {
//GUNS
MinecraftForgeClient.registerItemRenderer(ModItems.gun_debug, new ItemRenderDebug());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_pepperbox, new ItemRenderPepperbox());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_atlas, new ItemRenderAtlas());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_light_revolver, new ItemRenderAtlas());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_light_revolver_dani, new ItemRenderDANI());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_henry, new ItemRenderHenry());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_greasegun, new ItemRenderGreasegun());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_maresleg, new ItemRenderMaresleg());
@ -41,6 +42,7 @@ public class GunFactoryClient {
MinecraftForgeClient.registerItemRenderer(ModItems.gun_carbine, new ItemRenderCarbine());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_am180, new ItemRenderAm180());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_liberator, new ItemRenderLiberator());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_congolake, new ItemRenderCongoLake());
//PROJECTILES
ammo_debug.setRenderer(RENDER_STANDARD_BULLET);
ammo_debug_buckshot.setRenderer(RENDER_STANDARD_BULLET);
@ -73,17 +75,20 @@ public class GunFactoryClient {
p22_jhp.setRenderer(RENDER_STANDARD_BULLET);
p22_ap.setRenderer(RENDER_AP_BULLET);
//HUDS
((ItemGunBaseNT) ModItems.gun_debug).config_DNA.hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_pepperbox).config_DNA.hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_atlas).config_DNA.hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_henry).config_DNA.hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_greasegun).config_DNA.hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_maresleg).config_DNA.hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_flaregun).config_DNA.hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_heavy_revolver).config_DNA.hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_carbine).config_DNA.hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_am180).config_DNA.hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_liberator).config_DNA.hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_debug) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_pepperbox) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_light_revolver) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_henry) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_greasegun) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_maresleg) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_flaregun) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_heavy_revolver) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_carbine) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_am180) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_liberator) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_congolake) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_light_revolver_dani).getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY_MIRROR, LegoClient.HUD_COMPONENT_AMMO_MIRROR);
((ItemGunBaseNT) ModItems.gun_light_revolver_dani).getConfig(null, 1).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
}
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_STANDARD_BULLET = (bullet, interp) -> {

View File

@ -22,35 +22,36 @@ public class GunStateDecider {
* It supports draw delays as well as semi and auto fire
*/
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_DECIDER = (stack, ctx) -> {
GunState lastState = ItemGunBaseNT.getState(stack);
deciderStandardFinishDraw(stack, lastState);
deciderStandardClearJam(stack, lastState);
deciderStandardReload(stack, ctx, lastState, 0);
deciderAutoRefire(stack, ctx, lastState, 0, () -> { return ItemGunBaseNT.getPrimary(stack); });
int index = ctx.configIndex;
GunState lastState = ItemGunBaseNT.getState(stack, index);
deciderStandardFinishDraw(stack, lastState, index);
deciderStandardClearJam(stack, lastState, index);
deciderStandardReload(stack, ctx, lastState, 0, index);
deciderAutoRefire(stack, ctx, lastState, 0, index, () -> { return ItemGunBaseNT.getPrimary(stack, index); });
};
/** Transitions the gun from DRAWING to IDLE */
public static void deciderStandardFinishDraw(ItemStack stack, GunState lastState) {
public static void deciderStandardFinishDraw(ItemStack stack, GunState lastState, int index) {
//transition to idle
if(lastState == GunState.DRAWING) {
ItemGunBaseNT.setState(stack, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, 0);
ItemGunBaseNT.setState(stack, index, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, index, 0);
}
}
/** Transitions the gun from DRAWING to IDLE */
public static void deciderStandardClearJam(ItemStack stack, GunState lastState) {
public static void deciderStandardClearJam(ItemStack stack, GunState lastState, int index) {
//transition to idle
if(lastState == GunState.JAMMED) {
ItemGunBaseNT.setState(stack, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, 0);
ItemGunBaseNT.setState(stack, index, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, index, 0);
}
}
/** Triggers a reload action on the first receiver. If the mag is not full and reloading is still possible, set to RELOADING, otherwise IDLE */
public static void deciderStandardReload(ItemStack stack, LambdaContext ctx, GunState lastState, int recIndex) {
public static void deciderStandardReload(ItemStack stack, LambdaContext ctx, GunState lastState, int recIndex, int gunIndex) {
if(lastState == GunState.RELOADING) {
@ -63,21 +64,21 @@ public class GunStateDecider {
//if after reloading the gun can still reload, assume a tube mag and resume reloading
if(mag.canReload(stack, player)) {
ItemGunBaseNT.setState(stack, GunState.RELOADING);
ItemGunBaseNT.setTimer(stack, rec.getReloadCycleDuration(stack));
ItemGunBaseNT.playAnimation(player, stack, AnimType.RELOAD_CYCLE);
ItemGunBaseNT.setState(stack, gunIndex, GunState.RELOADING);
ItemGunBaseNT.setTimer(stack, gunIndex, rec.getReloadCycleDuration(stack));
ItemGunBaseNT.playAnimation(player, stack, AnimType.RELOAD_CYCLE, gunIndex);
//if no more reloading can be done, go idle
} else {
if(getStandardJamChance(stack, cfg) > player.getRNG().nextFloat()) {
ItemGunBaseNT.setState(stack, GunState.JAMMED);
ItemGunBaseNT.setTimer(stack, cfg.getJamDuration(stack));
ItemGunBaseNT.playAnimation(player, stack, AnimType.JAMMED);
if(getStandardJamChance(stack, cfg, gunIndex) > player.getRNG().nextFloat()) {
ItemGunBaseNT.setState(stack, gunIndex, GunState.JAMMED);
ItemGunBaseNT.setTimer(stack, gunIndex, rec.getJamDuration(stack));
ItemGunBaseNT.playAnimation(player, stack, AnimType.JAMMED, gunIndex);
} else {
ItemGunBaseNT.setState(stack, GunState.DRAWING);
ItemGunBaseNT.setState(stack, gunIndex, GunState.DRAWING);
int duration = rec.getReloadEndDuration(stack) + (mag.getAmountBeforeReload(stack) <= 0 ? rec.getReloadCockOnEmpty(stack) : 0);
ItemGunBaseNT.setTimer(stack, duration);
ItemGunBaseNT.playAnimation(player, stack, AnimType.RELOAD_END);
ItemGunBaseNT.setTimer(stack, gunIndex, duration);
ItemGunBaseNT.playAnimation(player, stack, AnimType.RELOAD_END, gunIndex);
}
}
@ -85,14 +86,14 @@ public class GunStateDecider {
}
}
public static float getStandardJamChance(ItemStack stack, GunConfig config) {
float percent = (float) ItemGunBaseNT.getWear(stack) / config.getDurability(stack);
public static float getStandardJamChance(ItemStack stack, GunConfig config, int index) {
float percent = (float) ItemGunBaseNT.getWear(stack, index) / config.getDurability(stack);
if(percent < 0.66F) return 0F;
return Math.min((percent - 0.66F) * 4F, 1F);
}
/** Triggers a re-fire of the primary if the fire delay has expired, the left mouse button is down and re-firing is enabled, otherwise switches to IDLE */
public static void deciderAutoRefire(ItemStack stack, LambdaContext ctx, GunState lastState, int recIndex, BooleanSupplier refireCondition) {
public static void deciderAutoRefire(ItemStack stack, LambdaContext ctx, GunState lastState, int recIndex, int gunIndex, BooleanSupplier refireCondition) {
if(lastState == GunState.COOLDOWN) {
@ -105,8 +106,8 @@ public class GunStateDecider {
//if there's a bullet loaded, fire again
if(rec.getCanFire(stack).apply(stack, ctx)) {
rec.getOnFire(stack).accept(stack, ctx);
ItemGunBaseNT.setState(stack, GunState.COOLDOWN);
ItemGunBaseNT.setTimer(stack, rec.getDelayAfterFire(stack));
ItemGunBaseNT.setState(stack, gunIndex, GunState.COOLDOWN);
ItemGunBaseNT.setTimer(stack, gunIndex, rec.getDelayAfterFire(stack));
player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, rec.getFireSound(stack), rec.getFireVolume(stack), rec.getFirePitch(stack));
@ -114,17 +115,17 @@ public class GunStateDecider {
for(int i = 0; i < remaining; i++) if(rec.getCanFire(stack).apply(stack, ctx)) rec.getOnFire(stack).accept(stack, ctx);
//if not, revert to idle
} else if(rec.getDoesDryFire(stack)) {
ItemGunBaseNT.setState(stack, GunState.DRAWING);
ItemGunBaseNT.setTimer(stack, rec.getDelayAfterDryFire(stack));
ItemGunBaseNT.playAnimation(player, stack, AnimType.CYCLE_DRY);
ItemGunBaseNT.setState(stack, gunIndex, GunState.DRAWING);
ItemGunBaseNT.setTimer(stack, gunIndex, rec.getDelayAfterDryFire(stack));
ItemGunBaseNT.playAnimation(player, stack, AnimType.CYCLE_DRY, gunIndex);
} else {
ItemGunBaseNT.setState(stack, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, 0);
ItemGunBaseNT.setState(stack, gunIndex, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, gunIndex, 0);
}
//if not, go idle
} else {
ItemGunBaseNT.setState(stack, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, 0);
ItemGunBaseNT.setState(stack, gunIndex, GunState.IDLE);
ItemGunBaseNT.setTimer(stack, gunIndex, 0);
}
}
}

View File

@ -37,7 +37,7 @@ public class Lego {
EntityPlayer player = ctx.player;
Receiver rec = ctx.config.getReceivers(stack)[0];
GunState state = ItemGunBaseNT.getState(stack);
GunState state = ItemGunBaseNT.getState(stack, ctx.configIndex);
if(state == GunState.IDLE) {
@ -46,11 +46,11 @@ public class Lego {
if(mag.canReload(stack, ctx.player)) {
mag.setAmountBeforeReload(stack, mag.getAmount(stack));
ItemGunBaseNT.setState(stack, GunState.RELOADING);
ItemGunBaseNT.setTimer(stack, rec.getReloadBeginDuration(stack));
ItemGunBaseNT.playAnimation(player, stack, AnimType.RELOAD);
ItemGunBaseNT.setState(stack, ctx.configIndex, GunState.RELOADING);
ItemGunBaseNT.setTimer(stack, ctx.configIndex, rec.getReloadBeginDuration(stack));
ItemGunBaseNT.playAnimation(player, stack, AnimType.RELOAD, ctx.configIndex);
} else {
ItemGunBaseNT.playAnimation(player, stack, AnimType.INSPECT);
ItemGunBaseNT.playAnimation(player, stack, AnimType.INSPECT, ctx.configIndex);
}
}
};
@ -61,7 +61,8 @@ public class Lego {
EntityPlayer player = ctx.player;
Receiver rec = ctx.config.getReceivers(stack)[0];
GunState state = ItemGunBaseNT.getState(stack);
int index = ctx.configIndex;
GunState state = ItemGunBaseNT.getState(stack, index);
if(state == GunState.IDLE) {
@ -73,14 +74,14 @@ public class Lego {
int remaining = rec.getRoundsPerCycle(stack) - 1;
for(int i = 0; i < remaining; i++) if(rec.getCanFire(stack).apply(stack, ctx)) rec.getOnFire(stack).accept(stack, ctx);
ItemGunBaseNT.setState(stack, GunState.COOLDOWN);
ItemGunBaseNT.setTimer(stack, rec.getDelayAfterFire(stack));
ItemGunBaseNT.setState(stack, index, GunState.COOLDOWN);
ItemGunBaseNT.setTimer(stack, index, rec.getDelayAfterFire(stack));
} else {
if(rec.getDoesDryFire(stack)) {
ItemGunBaseNT.playAnimation(player, stack, AnimType.CYCLE_DRY);
ItemGunBaseNT.setState(stack, GunState.DRAWING);
ItemGunBaseNT.setTimer(stack, rec.getDelayAfterDryFire(stack));
ItemGunBaseNT.playAnimation(player, stack, AnimType.CYCLE_DRY, index);
ItemGunBaseNT.setState(stack, index, GunState.DRAWING);
ItemGunBaseNT.setTimer(stack, index, rec.getDelayAfterDryFire(stack));
}
}
}
@ -94,13 +95,13 @@ public class Lego {
/** Default smoke. */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_SMOKE = (stack, ctx) -> {
handleStandardSmoke(ctx.player, stack, 2000, 0.025D, 1.15D);
handleStandardSmoke(ctx.player, stack, 2000, 0.025D, 1.15D, ctx.configIndex);
};
public static void handleStandardSmoke(EntityPlayer player, ItemStack stack, int smokeDuration, double alphaDecay, double widthGrowth) {
public static void handleStandardSmoke(EntityPlayer player, ItemStack stack, int smokeDuration, double alphaDecay, double widthGrowth, int index) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
long lastShot = gun.lastShot;
List<SmokeNode> smokeNodes = gun.smokeNodes;
long lastShot = gun.lastShot[index];
List<SmokeNode> smokeNodes = gun.getConfig(stack, index).smokeNodes;
boolean smoking = lastShot + smokeDuration > System.currentTimeMillis();
if(!smoking && !smokeNodes.isEmpty()) smokeNodes.clear();
@ -123,7 +124,7 @@ public class Lego {
double alpha = (System.currentTimeMillis() - lastShot) / (double) smokeDuration;
alpha = (1 - alpha) * 0.5D;
if(gun.getState(stack) == GunState.RELOADING || smokeNodes.size() == 0) alpha = 0;
if(gun.getState(stack, index) == GunState.RELOADING || smokeNodes.size() == 0) alpha = 0;
smokeNodes.add(new SmokeNode(alpha));
}
}
@ -143,7 +144,8 @@ public class Lego {
/** Spawns an EntityBulletBaseMK4 with the loaded bulletcfg */
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STANDARD_FIRE = (stack, ctx) -> {
EntityPlayer player = ctx.player;
ItemGunBaseNT.playAnimation(player, stack, AnimType.CYCLE);
int index = ctx.configIndex;
ItemGunBaseNT.playAnimation(player, stack, AnimType.CYCLE, ctx.configIndex);
float aim = ItemGunBaseNT.getIsAiming(stack) ? 0.25F : 1F;
Receiver primary = ctx.config.getReceivers(stack)[0];
@ -163,24 +165,24 @@ public class Lego {
if(config.projectilesMax > config.projectilesMin) projectiles += player.getRNG().nextInt(config.projectilesMax - config.projectilesMin + 1);
for(int i = 0; i < projectiles; i++) {
float damage = primary.getBaseDamage(stack) * getStandardWearDamage(stack, ctx.config);
float spread = primary.getGunSpread(stack) * aim + getStandardWearSpread(stack, ctx.config) * 0.125F;
float damage = primary.getBaseDamage(stack) * getStandardWearDamage(stack, ctx.config, index);
float spread = primary.getGunSpread(stack) * aim + getStandardWearSpread(stack, ctx.config, index) * 0.125F;
EntityBulletBaseMK4 mk4 = new EntityBulletBaseMK4(player, config, damage, spread, sideOffset, heightOffset, forwardOffset);
player.worldObj.spawnEntityInWorld(mk4);
}
mag.setAmount(stack, mag.getAmount(stack) - 1);
ItemGunBaseNT.setWear(stack, Math.min(ItemGunBaseNT.getWear(stack) + config.wear, ctx.config.getDurability(stack)));
ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + config.wear, ctx.config.getDurability(stack)));
};
public static float getStandardWearSpread(ItemStack stack, GunConfig config) {
float percent = (float) ItemGunBaseNT.getWear(stack) / config.getDurability(stack);
public static float getStandardWearSpread(ItemStack stack, GunConfig config, int index) {
float percent = (float) ItemGunBaseNT.getWear(stack, index) / config.getDurability(stack);
if(percent < 0.5F) return 0F;
return (percent - 0.5F) * 2F;
}
public static float getStandardWearDamage(ItemStack stack, GunConfig config) {
float percent = (float) ItemGunBaseNT.getWear(stack) / config.getDurability(stack);
public static float getStandardWearDamage(ItemStack stack, GunConfig config, int index) {
float percent = (float) ItemGunBaseNT.getWear(stack, index) / config.getDurability(stack);
if(percent < 0.75F) return 1F;
return 1F - (percent - 0.75F) * 2F;
}

View File

@ -6,5 +6,7 @@ import com.hbm.items.weapon.sedna.hud.HUDComponentDurabilityBar;
public class LegoClient {
public static HUDComponentDurabilityBar HUD_COMPONENT_DURABILITY = new HUDComponentDurabilityBar();
public static HUDComponentDurabilityBar HUD_COMPONENT_DURABILITY_MIRROR = new HUDComponentDurabilityBar(true);
public static HUDComponentAmmoCounter HUD_COMPONENT_AMMO = new HUDComponentAmmoCounter(0);
public static HUDComponentAmmoCounter HUD_COMPONENT_AMMO_MIRROR = new HUDComponentAmmoCounter(0, true);
}

View File

@ -2,8 +2,6 @@ package com.hbm.items.weapon.sedna.factory;
import java.util.function.BiConsumer;
import com.hbm.handler.CasingEjector;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
@ -22,21 +20,20 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> DEBUG_ORCHESTRA = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack);
int timer = ItemGunBaseNT.getAnimTimer(stack);
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
if(type == AnimType.RELOAD) {
if(timer == 3) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
if(timer == 10) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
if(timer == 34) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
if(timer == 40) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F);
if(timer == 20) {
if(timer == 16) {
Receiver rec = ctx.config.getReceivers(stack)[0];
IMagazine mag = rec.getMagazine(stack);
CasingEjector ejector = rec.getEjector(stack);
BulletConfig bullet = (BulletConfig) mag.getType(stack);
for(int i = 0; i < mag.getCapacity(stack); i++) ItemGunBaseNT.trySpawnCasing(player, ejector, bullet, stack);
SpentCasing casing = mag.getCasing(stack);
for(int i = 0; i < mag.getCapacity(stack); i++) CasingCreator.composeEffect(player.worldObj, player, 0.25, -0.125, -0.125, -0.05, 0, 0, 0.01, casing.getName());
}
}
if(type == AnimType.CYCLE) {
@ -54,8 +51,8 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_PEPPERBOX = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack);
int timer = ItemGunBaseNT.getAnimTimer(stack);
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
if(type == AnimType.RELOAD) {
if(timer == 24) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
@ -79,8 +76,8 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_ATLAS = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack);
int timer = ItemGunBaseNT.getAnimTimer(stack);
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
if(type == AnimType.RELOAD) {
if(timer == 2) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
@ -106,8 +103,8 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_HENRY = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack);
int timer = ItemGunBaseNT.getAnimTimer(stack);
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
if(type == AnimType.RELOAD) {
@ -142,8 +139,8 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_GREASEGUN = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack);
int timer = ItemGunBaseNT.getAnimTimer(stack);
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
if(type == AnimType.EQUIP) {
@ -177,8 +174,8 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_MARESLEG = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack);
int timer = ItemGunBaseNT.getAnimTimer(stack);
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
if(type == AnimType.RELOAD) {
@ -211,8 +208,8 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_FLAREGUN = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack);
int timer = ItemGunBaseNT.getAnimTimer(stack);
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
if(type == AnimType.RELOAD) {
@ -239,8 +236,8 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_NOPIP = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack);
int timer = ItemGunBaseNT.getAnimTimer(stack);
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
if(type == AnimType.RELOAD) {
if(timer == 3) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F);
@ -270,8 +267,8 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_CARBIBE = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack);
int timer = ItemGunBaseNT.getAnimTimer(stack);
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
if(type == AnimType.CYCLE) {
@ -303,8 +300,8 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_AM180 = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack);
int timer = ItemGunBaseNT.getAnimTimer(stack);
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
if(type == AnimType.CYCLE) {
@ -334,8 +331,8 @@ public class Orchestras {
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_LIBERATOR = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack);
int timer = ItemGunBaseNT.getAnimTimer(stack);
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
if(type == AnimType.RELOAD) {
if(timer == 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 0.75F);
@ -373,4 +370,22 @@ public class Orchestras {
if(timer == 20) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 0.9F);
}
};
public static BiConsumer<ItemStack, LambdaContext> ORCHESTRA_CONGOLAKE = (stack, ctx) -> {
EntityPlayer player = ctx.player;
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
boolean aiming = ItemGunBaseNT.getIsAiming(stack);
if(type == AnimType.CYCLE) {
if(timer == 15) {
IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack);
SpentCasing casing = mag.getCasing(stack);
CasingCreator.composeEffect(player.worldObj, player, 0.625, aiming ? -0.0625 : -0.25, aiming ? 0 : -0.375D, 0, 0.18, 0.12, 0.01, casing.getName(), true, 60, 0.5D, 20);
}
}
if(type == AnimType.RELOAD || type == AnimType.RELOAD_CYCLE) {
if(timer == 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.glReload", 1F, 1F);
}
};
}

View File

@ -35,23 +35,25 @@ public class XFactory12ga {
g12 = new BulletConfig().setItem(EnumAmmo.G12).setProjectiles(8, 8).setSpread(0.05F).setRicochetAngle(15).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0xB52B2B, SpentCasing.COLOR_CASE_BRASS).setScale(0.75F).register("12GA"));
ModItems.gun_maresleg = new ItemGunBaseNT(new GunConfig()
.dura(600).draw(20).inspect(39).jam(24).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE).orchestra(Orchestras.ORCHESTRA_MARESLEG)
.dura(600).draw(20).inspect(39).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0)
.dmg(12F).delay(20).reload(22, 10, 13, 39).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.dmg(12F).delay(20).reload(22, 10, 13, 0).jam(24).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineSingleReload(0, 6).addConfigs(g12_bp, g12_bp_magnum, g12_bp_slug, g12))
.offset(0.75, -0.0625, -0.1875D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL))
.setupStandardConfiguration().anim(LAMBDA_MARESLEG_ANIMS)
.setupStandardConfiguration()
.anim(LAMBDA_MARESLEG_ANIMS).orchestra(Orchestras.ORCHESTRA_MARESLEG)
).setUnlocalizedName("gun_maresleg").setTextureName(RefStrings.MODID + ":gun_darter");
ModItems.gun_liberator = new ItemGunBaseNT(new GunConfig()
.dura(200).draw(20).inspect(21).jam(45).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE).orchestra(Orchestras.ORCHESTRA_LIBERATOR)
.dura(200).draw(20).inspect(21).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0)
.dmg(12F).delay(20).rounds(4).reload(25, 15, 7, 0).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.dmg(12F).delay(20).rounds(4).reload(25, 15, 7, 0).jam(45).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineSingleReload(0, 4).addConfigs(g12_bp, g12_bp_magnum, g12_bp_slug, g12))
.offset(0.75, -0.0625, -0.1875D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL))
.setupStandardConfiguration().anim(LAMBDA_LIBERATOR_ANIMS)
.setupStandardConfiguration()
.anim(LAMBDA_LIBERATOR_ANIMS).orchestra(Orchestras.ORCHESTRA_LIBERATOR)
).setUnlocalizedName("gun_liberator").setTextureName(RefStrings.MODID + ":gun_darter");
}
@ -70,7 +72,7 @@ public class XFactory12ga {
.addBus("TURN", new BusAnimationSequence().addPos(0, 0, 0, 600).addPos(0, 0, 45, 200, IType.SIN_DOWN).addPos(0, 0, 0, 200, IType.SIN_UP))
.addBus("HAMMER", new BusAnimationSequence().addPos(30, 0, 0, 50).addPos(30, 0, 0, 550).addPos(0, 0, 0, 200));
case RELOAD:
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack).getReceivers(stack)[0].getMagazine(stack).getAmount(stack) <= 0;
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack) <= 0;
return new BusAnimation()
.addBus("LIFT", new BusAnimationSequence().addPos(30, 0, 0, 400, IType.SIN_FULL))
.addBus("LEVER", new BusAnimationSequence().addPos(0, 0, 0, 400).addPos(-85, 0, 0, 200))
@ -100,7 +102,7 @@ public class XFactory12ga {
/** This fucking sucks */
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_LIBERATOR_ANIMS = (stack, type) -> {
int ammo = ((ItemGunBaseNT) stack.getItem()).getConfig(stack).getReceivers(stack)[0].getMagazine(stack).getAmount(stack);
int ammo = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack);
switch(type) {
case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN));

View File

@ -41,18 +41,19 @@ public class XFactory22lr {
.setCasing(casing22.clone().setColor(SpentCasing.COLOR_CASE_44).register("p22ap"));
ModItems.gun_am180 = new ItemGunBaseNT(new GunConfig()
.dura(177 * 25).draw(15).inspect(38).jam(55).crosshair(Crosshair.L_CIRCLE).smoke(LAMBDA_SMOKE).orchestra(Orchestras.ORCHESTRA_AM180)
.dura(177 * 25).draw(15).inspect(38).crosshair(Crosshair.L_CIRCLE).smoke(LAMBDA_SMOKE)
.rec(new Receiver(0)
.dmg(5F).delay(1).dry(10).auto(true).spread(0.02F).reload(53).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.dmg(5F).delay(1).dry(10).auto(true).spread(0.02F).reload(53).jam(55).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 177).addConfigs(p22_sp, p22_fmj, p22_jhp, p22_ap))
.offset(1, -0.0625 * 1.5, -0.1875D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL))
.setupStandardConfiguration().anim(LAMBDA_AM180_ANIMS)
.setupStandardConfiguration()
.anim(LAMBDA_AM180_ANIMS).orchestra(Orchestras.ORCHESTRA_AM180)
).setUnlocalizedName("gun_am180").setTextureName(RefStrings.MODID + ":gun_darter");
}
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> {
Lego.handleStandardSmoke(ctx.player, stack, 3000, 0.05D, 1.1D);
Lego.handleStandardSmoke(ctx.player, stack, 3000, 0.05D, 1.1D, 0);
};
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_AM180_ANIMS = (stack, type) -> {

View File

@ -33,15 +33,37 @@ public class XFactory357 {
m357_ap = new BulletConfig().setItem(EnumAmmo.M357_AP).setDoesPenetrate(true).setDamageFalloutByPen(false).setDamage(1.5F).setArmorPiercing(0.15F);
m357_express = new BulletConfig().setItem(EnumAmmo.M357_EXPRESS).setDoesPenetrate(true).setDamage(1.5F).setArmorPiercing(0.1F).setWear(1.5F);
ModItems.gun_atlas = new ItemGunBaseNT(new GunConfig()
.dura(300).draw(4).inspect(23).jam(45).crosshair(Crosshair.CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE).orchestra(Orchestras.ORCHESTRA_ATLAS)
ModItems.gun_light_revolver = new ItemGunBaseNT(new GunConfig()
.dura(300).draw(4).inspect(23).crosshair(Crosshair.CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0)
.dmg(10F).delay(16).reload(55).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.dmg(10F).delay(16).reload(55).jam(45).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 6).addConfigs(m357_sp, m357_fmj, m357_jhp, m357_ap, m357_express))
.offset(0.75, -0.0625, -0.3125D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL))
.setupStandardConfiguration().anim(LAMBDA_ATLAS_ANIMS)
).setUnlocalizedName("gun_atlas").setTextureName(RefStrings.MODID + ":gun_darter");
.setupStandardConfiguration()
.anim(LAMBDA_ATLAS_ANIMS).orchestra(Orchestras.ORCHESTRA_ATLAS)
).setUnlocalizedName("gun_light_revolver").setTextureName(RefStrings.MODID + ":gun_darter");
ModItems.gun_light_revolver_dani = new ItemGunBaseNT(
new GunConfig().dura(30_000).draw(4).inspect(23).crosshair(Crosshair.CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0)
.dmg(10F).delay(16).reload(55).jam(45).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 6).addConfigs(m357_sp, m357_fmj, m357_jhp, m357_ap, m357_express))
.offset(0.75, -0.0625, 0.3125D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL))
.pp(Lego.LAMBDA_STANDARD_CLICK_PRIMARY).pr(Lego.LAMBDA_STANDARD_RELOAD)
.decider(GunStateDecider.LAMBDA_STANDARD_DECIDER)
.anim(LAMBDA_ATLAS_ANIMS).orchestra(Orchestras.ORCHESTRA_ATLAS),
new GunConfig().dura(30_000).draw(4).inspect(23).crosshair(Crosshair.CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0)
.dmg(10F).delay(16).reload(55).jam(45).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineFullReload(1, 6).addConfigs(m357_sp, m357_fmj, m357_jhp, m357_ap, m357_express))
.offset(0.75, -0.0625, -0.3125D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL))
.ps(Lego.LAMBDA_STANDARD_CLICK_PRIMARY).pr(Lego.LAMBDA_STANDARD_RELOAD)
.decider(GunStateDecider.LAMBDA_STANDARD_DECIDER)
.anim(LAMBDA_ATLAS_ANIMS).orchestra(Orchestras.ORCHESTRA_ATLAS)
).setUnlocalizedName("gun_light_revolver_dani").setTextureName(RefStrings.MODID + ":gun_darter");
}
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_ATLAS_ANIMS = (stack, type) -> {

View File

@ -13,6 +13,7 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineSingleReload;
import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.BusAnimation;
@ -30,21 +31,33 @@ public class XFactory40mm {
public static void init() {
g40_flare = new BulletConfig().setItem(EnumAmmo.G40_FLARE).setVel(2F).setGrav(0.035D).setRenderRotations(false).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(0x9E1616).setScale(2F).register("G40Flare"));
g40 = new BulletConfig().setItem(EnumAmmo.G40).setVel(2F).setGrav(0.035D).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(SpentCasing.COLOR_CASE_40MM).setScale(2F).register("G40"));
g40 = new BulletConfig().setItem(EnumAmmo.G40).setVel(2F).setGrav(0.035D).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(SpentCasing.COLOR_CASE_40MM).setScale(2, 2F, 1.5F).register("G40"));
ModItems.gun_flaregun = new ItemGunBaseNT(new GunConfig()
.dura(100).draw(7).inspect(39).jam(33).crosshair(Crosshair.CIRCLE).smoke(LAMBDA_SMOKE).orchestra(Orchestras.ORCHESTRA_FLAREGUN)
.dura(100).draw(7).inspect(39).crosshair(Crosshair.L_CIRCUMFLEX).smoke(LAMBDA_SMOKE)
.rec(new Receiver(0)
.dmg(12F).delay(20).reload(28).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.dmg(12F).delay(20).reload(28).jam(33).sound("hbm:weapon.hkShoot", 1.0F, 1.0F)
.mag(new MagazineSingleReload(0, 1).addConfigs(g40_flare))
.offset(0.75, -0.0625, -0.1875D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL))
.setupStandardConfiguration().anim(LAMBDA_FLAREGUN_ANIMS)
.setupStandardConfiguration()
.anim(LAMBDA_FLAREGUN_ANIMS).orchestra(Orchestras.ORCHESTRA_FLAREGUN)
).setUnlocalizedName("gun_flaregun").setTextureName(RefStrings.MODID + ":gun_darter");
ModItems.gun_congolake = new ItemGunBaseNT(new GunConfig()
.dura(400).draw(7).inspect(39).reloadSequential(true).crosshair(Crosshair.L_CIRCUMFLEX).smoke(LAMBDA_SMOKE)
.rec(new Receiver(0)
.dmg(12F).delay(24).reload(16, 16, 16, 0).jam(0).sound("hbm:weapon.glShoot", 1.0F, 1.0F)
.mag(new MagazineSingleReload(0, 4).addConfigs(g40_flare))
.offset(0.75, -0.0625, -0.1875D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL))
.setupStandardConfiguration()
.anim(LAMBDA_CONGOLAKE_ANIMS).orchestra(Orchestras.ORCHESTRA_CONGOLAKE)
).setUnlocalizedName("gun_congolake").setTextureName(RefStrings.MODID + ":gun_darter");
}
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> {
Lego.handleStandardSmoke(ctx.player, stack, 1500, 0.025D, 1.05D);
Lego.handleStandardSmoke(ctx.player, stack, 1500, 0.025D, 1.05D, 0);
};
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_FLAREGUN_ANIMS = (stack, type) -> {
@ -69,4 +82,20 @@ public class XFactory40mm {
return null;
};
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_CONGOLAKE_ANIMS = (stack, type) -> {
int ammo = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack);
switch(type) {
case EQUIP: return new BusAnimation();
case CYCLE: return ResourceManager.congolake_anim.get(ammo <= 1 ? "FireEmpty" : "Fire");
case RELOAD:
return ResourceManager.congolake_anim.get(ammo == 0 ? "ReloadEmpty": "ReloadStart");
case RELOAD_CYCLE: return ResourceManager.congolake_anim.get("Reload");
case RELOAD_END: return ResourceManager.congolake_anim.get("ReloadEnd");
case JAMMED: return new BusAnimation();
case INSPECT: return new BusAnimation();
}
return null;
};
}

View File

@ -2,7 +2,6 @@ package com.hbm.items.weapon.sedna.factory;
import java.util.function.BiFunction;
import com.hbm.handler.CasingEjector;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.Crosshair;
@ -44,26 +43,26 @@ public class XFactory44 {
.setCasing(casing44.clone().register("m44express"));
ModItems.gun_henry = new ItemGunBaseNT(new GunConfig()
.dura(300).draw(15).inspect(23).jam(45).reloadSequential(true).crosshair(Crosshair.CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE).orchestra(Orchestras.ORCHESTRA_HENRY)
.dura(300).draw(15).inspect(23).reloadSequential(true).crosshair(Crosshair.CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0)
.dmg(12F).delay(20).reload(25, 11, 14, 8).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.dmg(12F).delay(20).reload(25, 11, 14, 8).jam(45).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineSingleReload(0, 14).addConfigs(m44_sp, m44_fmj, m44_jhp, m44_ap, m44_express))
.offset(0.75, -0.0625, -0.1875D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL))
.setupStandardConfiguration().anim(LAMBDA_HENRY_ANIMS)
.setupStandardConfiguration()
.anim(LAMBDA_HENRY_ANIMS).orchestra(Orchestras.ORCHESTRA_HENRY)
).setUnlocalizedName("gun_henry").setTextureName(RefStrings.MODID + ":gun_darter");
ModItems.gun_heavy_revolver = new ItemGunBaseNT(new GunConfig()
.dura(600F).draw(10).jam(23).inspect(23).crosshair(Crosshair.L_CLASSIC).smoke(Lego.LAMBDA_STANDARD_SMOKE).orchestra(Orchestras.ORCHESTRA_NOPIP)
.dura(600F).draw(10).inspect(23).crosshair(Crosshair.L_CLASSIC).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0)
.dmg(10F).delay(14).reload(46).sound("hbm:weapon.44Shoot", 1.0F, 1.0F)
.dmg(10F).delay(14).reload(46).jam(23).sound("hbm:weapon.44Shoot", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 6).addConfigs(m44_sp, m44_fmj, m44_jhp, m44_ap, m44_express))
.ejector(new CasingEjector().setMotion(0, -0.1, 0).setAngleRange(0.01F, 0.025F))
.offset(0.75, -0.0625, -0.3125D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE))
.pp(Lego.LAMBDA_STANDARD_CLICK_PRIMARY) .pr(Lego.LAMBDA_STANDARD_RELOAD) .pt(Lego.LAMBDA_TOGGLE_AIM)
.decider(GunStateDecider.LAMBDA_STANDARD_DECIDER)
.anim(LAMBDA_NOPIP_ANIMS)
.anim(LAMBDA_NOPIP_ANIMS).orchestra(Orchestras.ORCHESTRA_NOPIP)
).setUnlocalizedName("gun_heavy_revolver").setTextureName(RefStrings.MODID + ":gun_darter");
}
@ -91,7 +90,7 @@ public class XFactory44 {
.addBus("TWIST", new BusAnimationSequence().addPos(0, 0, -90, 0))
.addBus("BULLET", new BusAnimationSequence().addPos(3, 0, -6, 0).addPos(0, 0, 1, 300, IType.SIN_FULL).addPos(0, 0, 0, 250, IType.SIN_FULL));
case RELOAD_END:
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack).getReceivers(stack)[0].getMagazine(stack).getAmountBeforeReload(stack) <= 0;
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmountBeforeReload(stack) <= 0;
return new BusAnimation()
.addBus("LIFT", new BusAnimationSequence().addPos(-60, 0, 0, 0).addPos(-60, 0, 0, 300).addPos(0, 0, 0, 400, IType.SIN_FULL))
.addBus("TWIST", new BusAnimationSequence().addPos(0, 0, -90, 0).addPos(0, 0, 0, 200, IType.SIN_FULL))

View File

@ -44,22 +44,23 @@ public class XFactory762mm {
.setCasing(casing9.clone().setColor(SpentCasing.COLOR_CASE_44).register("r762du"));
ModItems.gun_carbine = new ItemGunBaseNT(new GunConfig()
.dura(3_000).draw(10).inspect(31).jam(60).reloadSequential(true).crosshair(Crosshair.CIRCLE).smoke(LAMBDA_SMOKE).orchestra(Orchestras.ORCHESTRA_CARBIBE)
.dura(3_000).draw(10).inspect(31).reloadSequential(true).crosshair(Crosshair.CIRCLE).smoke(LAMBDA_SMOKE)
.rec(new Receiver(0)
.dmg(5F).delay(5).dry(15).spread(0.0F).reload(30, 0, 15, 0).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.dmg(5F).delay(5).dry(15).spread(0.0F).reload(30, 0, 15, 0).jam(60).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 14).addConfigs(r762_sp, r762_fmj, r762_jhp, r762_ap, r762_du))
.offset(1, -0.0625 * 2.5, -0.25D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL))
.setupStandardConfiguration().anim(LAMBDA_CARBINE_ANIMS)
.setupStandardConfiguration()
.anim(LAMBDA_CARBINE_ANIMS).orchestra(Orchestras.ORCHESTRA_CARBIBE)
).setUnlocalizedName("gun_carbine").setTextureName(RefStrings.MODID + ":gun_darter");
}
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> {
Lego.handleStandardSmoke(ctx.player, stack, 1500, 0.075D, 1.1D);
Lego.handleStandardSmoke(ctx.player, stack, 1500, 0.075D, 1.1D, 0);
};
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_CARBINE_ANIMS = (stack, type) -> {
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack).getReceivers(stack)[0].getMagazine(stack).getAmount(stack) <= 0;
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack) <= 0;
switch(type) {
case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL));

View File

@ -41,18 +41,19 @@ public class XFactory9mm {
.setCasing(casing9.clone().setColor(SpentCasing.COLOR_CASE_44).register("p9ap"));
ModItems.gun_greasegun = new ItemGunBaseNT(new GunConfig()
.dura(3_000).draw(15).inspect(31).jam(55).crosshair(Crosshair.L_CIRCLE).smoke(LAMBDA_SMOKE).orchestra(Orchestras.ORCHESTRA_GREASEGUN)
.dura(3_000).draw(15).inspect(31).crosshair(Crosshair.L_CIRCLE).smoke(LAMBDA_SMOKE)
.rec(new Receiver(0)
.dmg(5F).delay(4).dry(40).auto(true).spread(0.015F).reload(60).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.dmg(5F).delay(4).dry(40).auto(true).spread(0.015F).reload(60).jam(55).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 30).addConfigs(p9_sp, p9_fmj, p9_jhp, p9_ap))
.offset(1, -0.0625 * 2.5, -0.25D)
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL))
.setupStandardConfiguration().anim(LAMBDA_GREASEGUN_ANIMS)
.setupStandardConfiguration()
.anim(LAMBDA_GREASEGUN_ANIMS).orchestra(Orchestras.ORCHESTRA_GREASEGUN)
).setUnlocalizedName("gun_greasegun").setTextureName(RefStrings.MODID + ":gun_darter");
}
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_SMOKE = (stack, ctx) -> {
Lego.handleStandardSmoke(ctx.player, stack, 2000, 0.05D, 1.1D);
Lego.handleStandardSmoke(ctx.player, stack, 2000, 0.05D, 1.1D, 0);
};
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_GREASEGUN_ANIMS = (stack, type) -> {
@ -68,7 +69,7 @@ public class XFactory9mm {
.addBus("TURN", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, 0, -45, 250, IType.SIN_FULL).addPos(0, 0, -45, 750).addPos(0, 0, 0, 500, IType.SIN_FULL))
.addBus("HANDLE", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, 0, 0, 250).addPos(-90, 0, 0, 250, IType.SIN_FULL).addPos(0, 0, 0, 250, IType.SIN_FULL));
case RELOAD:
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack).getReceivers(stack)[0].getMagazine(stack).getAmountBeforeReload(stack) <= 0;
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmountBeforeReload(stack) <= 0;
return new BusAnimation()
.addBus("MAG", new BusAnimationSequence().addPos(0, -8, 0, 250, IType.SIN_UP).addPos(0, -8, 0, 750).addPos(0, 0, 0, 500, IType.SIN_DOWN))
.addBus("LIFT", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(-25, 0, 0, 250, IType.SIN_FULL).addPos(-25, 0, 0, 1750).addPos(0, 0, 0, 500, IType.SIN_FULL))

View File

@ -28,12 +28,13 @@ public class XFactoryBlackPowder {
BulletConfig shot = new BulletConfig().setItem(EnumAmmo.STONE_SHOT).setSpread(0.1F).setRicochetAngle(45).setProjectiles(6, 6).setDamage(0.5F);
ModItems.gun_pepperbox = new ItemGunBaseNT(new GunConfig()
.dura(300).draw(4).inspect(23).jam(58).crosshair(Crosshair.CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE).orchestra(Orchestras.ORCHESTRA_PEPPERBOX)
.dura(300).draw(4).inspect(23).crosshair(Crosshair.CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0)
.dmg(5F).delay(27).reload(67).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.dmg(5F).delay(27).reload(67).jam(58).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 6).addConfigs(stone, flint, iron, shot))
.canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE).recoil(Lego.LAMBDA_STANDARD_RECOIL))
.setupStandardConfiguration().anim(LAMBDA_PEPPERBOX_ANIMS)
.setupStandardConfiguration()
.anim(LAMBDA_PEPPERBOX_ANIMS).orchestra(Orchestras.ORCHESTRA_PEPPERBOX)
).setUnlocalizedName("gun_pepperbox").setTextureName(RefStrings.MODID + ":gun_darter");
}

View File

@ -19,9 +19,15 @@ public class HUDComponentAmmoCounter implements IHUDComponent {
protected static final RenderItem itemRenderer = RenderItem.getInstance();
protected int receiver;
protected boolean mirrored;
public HUDComponentAmmoCounter(int receiver) {
this(receiver, false);
}
public HUDComponentAmmoCounter(int receiver, boolean mirror) {
this.receiver = receiver;
this.mirrored = mirror;
}
@Override
@ -30,15 +36,15 @@ public class HUDComponentAmmoCounter implements IHUDComponent {
}
@Override
public void renderHUDComponent(Pre event, ElementType type, EntityPlayer player, ItemStack stack, int bottomOffset) {
public void renderHUDComponent(Pre event, ElementType type, EntityPlayer player, ItemStack stack, int bottomOffset, int gunIndex) {
ScaledResolution resolution = event.resolution;
Minecraft mc = Minecraft.getMinecraft();
int pX = resolution.getScaledWidth() / 2 + 62 + 36;
int pX = resolution.getScaledWidth() / 2 + (mirrored ? -(62 + 36 + 52) : (62 + 36));
int pZ = resolution.getScaledHeight() - bottomOffset - 21;
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
IMagazine mag = gun.getConfig(stack).getReceivers(stack)[this.receiver].getMagazine(stack);
IMagazine mag = gun.getConfig(stack, gunIndex).getReceivers(stack)[this.receiver].getMagazine(stack);
mc.fontRenderer.drawString(mag.reportAmmoStateForHUD(stack), pX + 17, pZ + 6, 0xFFFFFF);
@ -47,6 +53,7 @@ public class HUDComponentAmmoCounter implements IHUDComponent {
RenderHelper.enableGUIStandardItemLighting();
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), mag.getIconForHUD(stack), pX, pZ);
RenderHelper.disableStandardItemLighting();
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
}

View File

@ -16,6 +16,15 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
public class HUDComponentDurabilityBar implements IHUDComponent {
private static final ResourceLocation misc = new ResourceLocation(RefStrings.MODID + ":textures/misc/overlay_misc.png");
protected boolean mirrored = false;
public HUDComponentDurabilityBar() {
this(false);
}
public HUDComponentDurabilityBar(boolean mirror) {
this.mirrored = mirror;
}
@Override
public int getComponentHeight(EntityPlayer player, ItemStack stack) {
@ -23,16 +32,16 @@ public class HUDComponentDurabilityBar implements IHUDComponent {
}
@Override
public void renderHUDComponent(Pre event, ElementType type, EntityPlayer player, ItemStack stack, int bottomOffset) {
public void renderHUDComponent(Pre event, ElementType type, EntityPlayer player, ItemStack stack, int bottomOffset, int gunIndex) {
ScaledResolution resolution = event.resolution;
Minecraft mc = Minecraft.getMinecraft();
int pX = resolution.getScaledWidth() / 2 + 62 + 36;
int pX = resolution.getScaledWidth() / 2 + (mirrored ? -(62 + 36 + 52) : (62 + 36));
int pZ = resolution.getScaledHeight() - 21;
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
int dura = (int) (50 * gun.getWear(stack) / gun.getConfig(stack).getDurability(stack));
int dura = (int) (50 * gun.getWear(stack, gunIndex) / gun.getConfig(stack, gunIndex).getDurability(stack));
GL11.glColor4f(1F, 1F, 1F, 1F);

View File

@ -8,5 +8,5 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
public interface IHUDComponent {
public int getComponentHeight(EntityPlayer player, ItemStack stack);
public void renderHUDComponent(Pre event, ElementType type, EntityPlayer player, ItemStack stack, int bottomOffset);
public void renderHUDComponent(Pre event, ElementType type, EntityPlayer player, ItemStack stack, int bottomOffset, int gunIndex);
}

View File

@ -5,7 +5,7 @@ import com.hbm.items.weapon.sedna.BulletConfig;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/** Uses individual bullets which are loaded all at once */
/** Uses individual bullets which are loaded one by one */
public class MagazineSingleReload extends MagazineSingleTypeBase {
public MagazineSingleReload(int index, int capacity) {

View File

@ -606,7 +606,6 @@ public class ClientProxy extends ServerProxy {
MinecraftForgeClient.registerItemRenderer(ModItems.gun_uac_pistol, new ItemRenderUACPistol());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_coilgun, new ItemRenderWeaponCoilgun());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_cryocannon, new ItemRenderWeaponCryoCannon());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_congolake, new ItemRenderWeaponCongo());
//multitool
MinecraftForgeClient.registerItemRenderer(ModItems.multitool_dig, new ItemRenderMultitool());
MinecraftForgeClient.registerItemRenderer(ModItems.multitool_silk, new ItemRenderMultitool());
@ -1823,7 +1822,7 @@ public class ClientProxy extends ServerProxy {
.addPos(90, 0, 1, 800)
.addPos(0, 0, 1, 50));
HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
}
/* crucible swing */
@ -1845,7 +1844,7 @@ public class ClientProxy extends ServerProxy {
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:weapon.cSwing"), 0.8F + player.getRNG().nextFloat() * 0.2F));
HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
}
}
@ -1869,7 +1868,7 @@ public class ClientProxy extends ServerProxy {
.addPos(0, 0, 0, retire));
HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
} else {
@ -1890,7 +1889,7 @@ public class ClientProxy extends ServerProxy {
.addPos(2, 0, 2, sideways)
.addPos(0, 0, 0, retire));
HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
}
}
@ -1902,7 +1901,7 @@ public class ClientProxy extends ServerProxy {
BusAnimation anim = item.getAnimation(data, stack);
if(anim != null) {
HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), anim);
HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), anim);
}
}
}

View File

@ -321,19 +321,21 @@ public class ModEventHandlerClient {
/// HANLDE ANIMATION BUSES ///
for(int i = 0; i < HbmAnimations.hotbar.length; i++) {
Animation animation = HbmAnimations.hotbar[i];
if(animation == null)
continue;
if(animation.holdLastFrame)
continue;
long time = System.currentTimeMillis() - animation.startMillis;
if(time > animation.animation.getDuration())
HbmAnimations.hotbar[i] = null;
for(int j = 0; j < HbmAnimations.hotbar[i].length; j++) {
Animation animation = HbmAnimations.hotbar[i][j];
if(animation == null)
continue;
if(animation.holdLastFrame)
continue;
long time = System.currentTimeMillis() - animation.startMillis;
if(time > animation.animation.getDuration())
HbmAnimations.hotbar[i][j] = null;
}
}
if(!ducked && Keyboard.isKeyDown(Keyboard.KEY_O) && Minecraft.getMinecraft().currentScreen == null) {

View File

@ -971,6 +971,8 @@ public class ResourceManager {
public static final ResourceLocation debug_gun_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/debug_gun.png");
public static final ResourceLocation pepperbox_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/pepperbox.png");
public static final ResourceLocation bio_revolver_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/bio_revolver.png");
public static final ResourceLocation dani_celestial_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/dani_celestial.png");
public static final ResourceLocation dani_lunar_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/dani_lunar.png");
public static final ResourceLocation henry_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/henry.png");
public static final ResourceLocation greasegun_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/greasegun.png");
public static final ResourceLocation maresleg_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/maresleg.png");

View File

@ -26,30 +26,41 @@ import net.minecraft.item.ItemStack;
public class GunAnimationPacket implements IMessage {
public short type;
public int meta;
public int receiverIndex;
public int gunIndex;
public GunAnimationPacket() { }
public GunAnimationPacket(int type) {
this.type = (short) type;
this.meta = 0;
this.receiverIndex = 0;
this.gunIndex = 0;
}
public GunAnimationPacket(int type, int meta) {
public GunAnimationPacket(int type, int rec) {
this.type = (short) type;
this.meta = meta;
this.receiverIndex = rec;
this.gunIndex = 0;
}
public GunAnimationPacket(int type, int rec, int gun) {
this.type = (short) type;
this.receiverIndex = rec;
this.gunIndex = gun;
}
@Override
public void fromBytes(ByteBuf buf) {
type = buf.readShort();
meta = buf.readInt();
receiverIndex = buf.readInt();
gunIndex = buf.readInt();
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeShort(type);
buf.writeInt(meta);
buf.writeInt(receiverIndex);
buf.writeInt(gunIndex);
}
public static class Handler implements IMessageHandler<GunAnimationPacket, IMessage> {
@ -68,7 +79,7 @@ public class GunAnimationPacket implements IMessage {
return null;
if(stack.getItem() instanceof ItemGunBaseNT) {
handleSedna(player, stack, slot, AnimType.values()[m.type], m.meta);
handleSedna(player, stack, slot, AnimType.values()[m.type], m.receiverIndex, m.gunIndex);
}
if(!(stack.getItem() instanceof ItemGunBase))
@ -94,7 +105,7 @@ public class GunAnimationPacket implements IMessage {
if(animation != null) {
boolean isReloadAnimation = type == AnimType.RELOAD || type == AnimType.RELOAD_CYCLE || type == AnimType.RELOAD_EMPTY;
HbmAnimations.hotbar[slot] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, isReloadAnimation && base.mainConfig.reloadAnimationsSequential);
HbmAnimations.hotbar[slot][0] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, isReloadAnimation && base.mainConfig.reloadAnimationsSequential);
}
} catch(Exception x) { }
@ -102,19 +113,19 @@ public class GunAnimationPacket implements IMessage {
return null;
}
public static void handleSedna(EntityPlayer player, ItemStack stack, int slot, AnimType type, int meta) {
public static void handleSedna(EntityPlayer player, ItemStack stack, int slot, AnimType type, int receiverIndex, int gunIndex) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
GunConfig config = gun.getConfig(stack);
GunConfig config = gun.getConfig(stack, gunIndex);
if(type == AnimType.CYCLE) {
gun.lastShot = System.currentTimeMillis();
if(gunIndex < gun.lastShot.length) gun.lastShot[gunIndex] = System.currentTimeMillis();
gun.shotRand = player.worldObj.rand.nextDouble();
Receiver[] receivers = config.getReceivers(stack);
if(meta >= 0 && meta < receivers.length) {
Receiver rec = receivers[meta];
if(receiverIndex >= 0 && receiverIndex < receivers.length) {
Receiver rec = receivers[receiverIndex];
BiConsumer<ItemStack, LambdaContext> onRecoil= rec.getRecoil(stack);
if(onRecoil != null) onRecoil.accept(stack, new LambdaContext(config, player));
if(onRecoil != null) onRecoil.accept(stack, new LambdaContext(config, player, receiverIndex));
}
}
@ -132,7 +143,7 @@ public class GunAnimationPacket implements IMessage {
Minecraft.getMinecraft().entityRenderer.itemRenderer.resetEquippedProgress();
Minecraft.getMinecraft().entityRenderer.itemRenderer.itemToRender = stack;
boolean isReloadAnimation = type == AnimType.RELOAD || type == AnimType.RELOAD_CYCLE || type == AnimType.RELOAD_EMPTY;
HbmAnimations.hotbar[slot] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, isReloadAnimation && config.getReloadAnimSequential(stack));
HbmAnimations.hotbar[slot][gunIndex] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, isReloadAnimation && config.getReloadAnimSequential(stack));
}
}
}

View File

@ -15,7 +15,7 @@ public class HbmAnimations {
//my approach adds 9 timers, one for every inventory slot. you can still
//"trick" the system by putting a weapon into a different slot while an
//animation is playing, though this will cancel the animation entirely.
public static final Animation[] hotbar = new Animation[9];
public static final Animation[][] hotbar = new Animation[9][8]; //now with 8 parallel rails per slot! time to get railed!
public static enum AnimType {
RELOAD, //either a full reload or start of a reload
@ -61,8 +61,9 @@ public class HbmAnimations {
this.holdLastFrame = holdLastFrame;
}
}
public static Animation getRelevantAnim() {
public static Animation getRelevantAnim() { return getRelevantAnim(0); }
public static Animation getRelevantAnim(int index) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
int slot = player.inventory.currentItem;
@ -75,19 +76,20 @@ public class HbmAnimations {
slot = Math.abs(slot) % 9;
}
if(hotbar[slot] == null)
if(hotbar[slot][index] == null)
return null;
if(hotbar[slot].key.equals(stack.getItem().getUnlocalizedName())) {
return hotbar[slot];
if(hotbar[slot][index].key.equals(stack.getItem().getUnlocalizedName())) {
return hotbar[slot][index];
}
return null;
}
public static double[] getRelevantTransformation(String bus) {
public static double[] getRelevantTransformation(String bus) { return getRelevantTransformation(bus, 0); }
public static double[] getRelevantTransformation(String bus, int index) {
Animation anim = HbmAnimations.getRelevantAnim();
Animation anim = HbmAnimations.getRelevantAnim(index);
if(anim != null) {
@ -112,8 +114,9 @@ public class HbmAnimations {
};
}
public static void applyRelevantTransformation(String bus) {
double[] transform = getRelevantTransformation(bus);
public static void applyRelevantTransformation(String bus) { applyRelevantTransformation(bus, 0); }
public static void applyRelevantTransformation(String bus, int index) {
double[] transform = getRelevantTransformation(bus, index);
GL11.glTranslated(transform[0], transform[1], transform[2]);
GL11.glRotated(transform[3], 1, 0, 0);

View File

@ -72,7 +72,7 @@ public class ItemRenderAm180 extends ItemRenderWeaponBase {
GL11.glTranslated(0, -2.3125, -1.5);
GL11.glPushMatrix();
int mag = gun.getConfig(stack).getReceivers(stack)[0].getMagazine(stack).getAmount(stack);
int mag = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack);
GL11.glTranslated(0, 0, 1.5);
GL11.glRotated(mag / 59D * 360D, 0, -1, 0);
GL11.glTranslated(0, 0, -1.5);
@ -86,7 +86,7 @@ public class ItemRenderAm180 extends ItemRenderWeaponBase {
GL11.glTranslated(0, 1.875, 17);
GL11.glRotated(turn[2], 0, 0, -1);
GL11.glRotated(90, 0, 1, 0);
this.renderSmokeNodes(gun.smokeNodes, 0.25D);
this.renderSmokeNodes(gun.getConfig(stack, 0).smokeNodes, 0.25D);
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
@ -96,7 +96,7 @@ public class ItemRenderAm180 extends ItemRenderWeaponBase {
GL11.glRotated(90, 0, 1, 0);
GL11.glRotated(90 * gun.shotRand, 1, 0, 0);
GL11.glScaled(0.5, 0.5, 0.5);
this.renderMuzzleFlash(gun.lastShot, 75, 5);
this.renderMuzzleFlash(gun.lastShot[0], 75, 5);
GL11.glPopMatrix();
}

View File

@ -47,8 +47,9 @@ public class ItemRenderAtlas extends ItemRenderWeaponBase {
GL11.glPushMatrix();
GL11.glTranslated(0, 1.5, 9.25);
GL11.glRotated(-recoil[2] * 10, 1, 0, 0);
GL11.glRotated(90, 0, 1, 0);
this.renderSmokeNodes(gun.smokeNodes, 0.5D);
this.renderSmokeNodes(gun.getConfig(stack, 0).smokeNodes, 0.5D);
GL11.glPopMatrix();
GL11.glTranslated(reloadMove[0], reloadMove[1], reloadMove[2]);
@ -90,7 +91,7 @@ public class ItemRenderAtlas extends ItemRenderWeaponBase {
GL11.glPushMatrix();
GL11.glTranslated(0, 1.5, 9.25);
GL11.glRotated(90, 0, 1, 0);
this.renderMuzzleFlash(gun.lastShot, 75, 7.5);
this.renderMuzzleFlash(gun.lastShot[0], 75, 7.5);
GL11.glPopMatrix();
}

View File

@ -69,7 +69,7 @@ public class ItemRenderCarbine extends ItemRenderWeaponBase {
GL11.glPushMatrix();
GL11.glTranslated(0, 1, 8);
GL11.glRotated(90, 0, 1, 0);
this.renderSmokeNodes(gun.smokeNodes, 0.25D);
this.renderSmokeNodes(gun.getConfig(stack, 0).smokeNodes, 0.25D);
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
@ -79,7 +79,7 @@ public class ItemRenderCarbine extends ItemRenderWeaponBase {
GL11.glRotated(90, 0, 1, 0);
GL11.glRotated(90 * gun.shotRand, 1, 0, 0);
GL11.glScaled(0.5, 0.5, 0.5);
this.renderMuzzleFlash(gun.lastShot, 75, 7.5);
this.renderMuzzleFlash(gun.lastShot[0], 75, 7.5);
GL11.glPopMatrix();
}

View File

@ -0,0 +1,152 @@
package com.hbm.render.item.weapon.sedna;
import java.awt.Color;
import org.lwjgl.opengl.GL11;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing;
import com.hbm.render.anim.HbmAnimations;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
public class ItemRenderCongoLake extends ItemRenderWeaponBase {
@Override
protected float getTurnMagnitude(ItemStack stack) { return ItemGunBaseNT.getIsAiming(stack) ? 2.5F : -0.25F; }
@Override
protected void setupFirstPerson(ItemStack stack) {
GL11.glTranslated(0, 0, 0.875);
float offset = 0.8F;
standardAimingTransform(stack,
-1.5F * offset, -2F * offset, 1.25F * offset,
0, -9 / 8D, 0.25);
}
@Override
public void renderFirstPerson(ItemStack stack) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.congolake_tex);
double scale = 0.5D;
GL11.glScaled(scale, scale, scale);
HbmAnimations.applyRelevantTransformation("Gun");
ResourceManager.congolake.renderPart("Gun");
GL11.glPushMatrix();
{
HbmAnimations.applyRelevantTransformation("Pump");
ResourceManager.congolake.renderPart("Pump");
}
GL11.glPopMatrix();
GL11.glPushMatrix();
{
HbmAnimations.applyRelevantTransformation("Sight");
ResourceManager.congolake.renderPart("Sight");
}
GL11.glPopMatrix();
GL11.glPushMatrix();
{
HbmAnimations.applyRelevantTransformation("Loop");
ResourceManager.congolake.renderPart("Loop");
}
GL11.glPopMatrix();
GL11.glPushMatrix();
{
HbmAnimations.applyRelevantTransformation("GuardOuter");
ResourceManager.congolake.renderPart("GuardOuter");
GL11.glPushMatrix();
{
HbmAnimations.applyRelevantTransformation("GuardInner");
ResourceManager.congolake.renderPart("GuardInner");
}
GL11.glPopMatrix();
}
GL11.glPopMatrix();
GL11.glPushMatrix();
{
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.casings_tex);
HbmAnimations.applyRelevantTransformation("Shell");
SpentCasing casing = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getCasing(stack);
int[] colors = casing != null ? casing.getColors() : new int[] { SpentCasing.COLOR_CASE_40MM };
Color shellColor = new Color(colors[0]);
GL11.glColor3f(shellColor.getRed() / 255F, shellColor.getGreen() / 255F, shellColor.getBlue() / 255F);
ResourceManager.congolake.renderPart("Shell");
Color shellForeColor = new Color(colors.length > 1 ? colors[1] : colors[0]);
GL11.glColor3f(shellForeColor.getRed() / 255F, shellForeColor.getGreen() / 255F, shellForeColor.getBlue() / 255F);
ResourceManager.congolake.renderPart("ShellFore");
GL11.glColor3f(1F, 1F, 1F);
}
GL11.glPopMatrix();
double smokeScale = 0.25;
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glPushMatrix();
GL11.glTranslated(0, 1.75, 4.25);
double[] transform = HbmAnimations.getRelevantTransformation("Gun");
GL11.glRotated(-transform[5], 0, 0, 1);
GL11.glRotated(-transform[4], 0, 1, 0);
GL11.glRotated(-transform[3], 1, 0, 0);
GL11.glRotated(90, 0, 1, 0);
GL11.glScaled(smokeScale, smokeScale, smokeScale);
this.renderSmokeNodes(gun.getConfig(stack, 0).smokeNodes, 1D);
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPushMatrix();
GL11.glTranslated(0, 1.75, 4.25);
GL11.glRotated(90, 0, 1, 0);
GL11.glRotated(90 * gun.shotRand, 1, 0, 0);
GL11.glScaled(0.5, 0.5, 0.5);
this.renderMuzzleFlash(gun.lastShot[0], 150, 7.5);
GL11.glPopMatrix();
}
@Override
protected void setupThirdPerson(ItemStack stack) {
super.setupThirdPerson(stack);
GL11.glTranslated(0, 1, 3);
}
@Override
protected void setupInv(ItemStack stack) {
super.setupInv(stack);
double scale = 2.5D;
GL11.glScaled(scale, scale, scale);
GL11.glRotated(25, 1, 0, 0);
GL11.glRotated(45, 0, 1, 0);
GL11.glTranslated(0, -1.25, 0);
}
@Override
public void renderOther(ItemStack stack, ItemRenderType type) {
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glShadeModel(GL11.GL_SMOOTH);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.congolake_tex);
ResourceManager.congolake.renderAll();
GL11.glShadeModel(GL11.GL_FLAT);
}
}

View File

@ -0,0 +1,153 @@
package com.hbm.render.item.weapon.sedna;
import org.lwjgl.opengl.GL11;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
public class ItemRenderDANI extends ItemRenderWeaponBase {
@Override
protected float getTurnMagnitude(ItemStack stack) { return ItemGunBaseNT.getIsAiming(stack) ? 2.5F : -0.25F; }
@Override
protected void setupFirstPerson(ItemStack stack) {
GL11.glTranslated(0, 0, 0.875);
}
@Override
public void renderFirstPerson(ItemStack stack) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
float offset = 0.8F;
for(int i = -1; i <= 1; i += 2) {
int index = i == -1 ? 0 : 1;
Minecraft.getMinecraft().renderEngine.bindTexture(index == 0 ? ResourceManager.dani_celestial_tex : ResourceManager.dani_lunar_tex);
GL11.glPushMatrix();
standardAimingTransform(stack,
-1.5F * offset * i, -0.75F * offset, 1F * offset,
0, -3.125 / 8D, 0.25);
double scale = 0.125D;
GL11.glScaled(scale, scale, scale);
GL11.glShadeModel(GL11.GL_SMOOTH);
double[] recoil = HbmAnimations.getRelevantTransformation("RECOIL", index);
double[] reloadMove = HbmAnimations.getRelevantTransformation("RELOAD_MOVE", index);
double[] reloadRot = HbmAnimations.getRelevantTransformation("RELOAD_ROT", index);
double[] equip = HbmAnimations.getRelevantTransformation("EQUIP", index);
GL11.glTranslated(recoil[0], recoil[1], recoil[2]);
GL11.glRotated(recoil[2] * 10, 1, 0, 0);
GL11.glTranslated(0, 0, -7);
GL11.glRotated(equip[0], -1, 0, 0);
GL11.glTranslated(0, 0, 7);
GL11.glPushMatrix();
GL11.glTranslated(0, 1.5, 9.25);
GL11.glRotated(-recoil[2] * 10, 1, 0, 0);
GL11.glRotated(90, 0, 1, 0);
this.renderSmokeNodes(gun.getConfig(stack, index).smokeNodes, 0.5D);
GL11.glPopMatrix();
GL11.glTranslated(reloadMove[0], reloadMove[1], reloadMove[2]);
GL11.glRotated(reloadRot[0], 1, 0, 0);
GL11.glRotated(reloadRot[2] * i, 0, 0, 1);
GL11.glRotated(reloadRot[1] * i, 0, 1, 0);
ResourceManager.bio_revolver.renderPart("Grip");
GL11.glPushMatrix(); /// FRONT PUSH ///
GL11.glRotated(HbmAnimations.getRelevantTransformation("FRONT", index)[2], 1, 0, 0);
ResourceManager.bio_revolver.renderPart("Barrel");
GL11.glPushMatrix(); /// LATCH PUSH ///
GL11.glTranslated(0, 2.3125, -0.875);
GL11.glRotated(HbmAnimations.getRelevantTransformation("LATCH", index)[2], 1, 0, 0);
GL11.glTranslated(0, -2.3125, 0.875);
ResourceManager.bio_revolver.renderPart("Latch");
GL11.glPopMatrix(); /// LATCH POP ///
GL11.glPushMatrix(); /// DRUM PUSH ///
GL11.glTranslated(0, 1, 0);
GL11.glRotated(HbmAnimations.getRelevantTransformation("DRUM", index)[2] * 60, 0, 0, 1);
GL11.glTranslated(0, -1, 0);
GL11.glTranslated(0, 0, HbmAnimations.getRelevantTransformation("DRUM_PUSH", index)[2]);
ResourceManager.bio_revolver.renderPart("Drum");
GL11.glPopMatrix(); /// DRUM POP ///
GL11.glPopMatrix(); /// FRONT POP ///
GL11.glPushMatrix(); /// HAMMER ///
GL11.glTranslated(0, 0, -4.5);
GL11.glRotated(-45 + 45 * HbmAnimations.getRelevantTransformation("HAMMER", index)[2], 1, 0, 0);
GL11.glTranslated(0, 0, 4.5);
ResourceManager.bio_revolver.renderPart("Hammer");
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPushMatrix();
GL11.glTranslated(0, 1.5, 9.25);
GL11.glRotated(90, 0, 1, 0);
this.renderMuzzleFlash(gun.lastShot[index], 75, 7.5);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
}
@Override
protected void setupThirdPerson(ItemStack stack) {
super.setupThirdPerson(stack);
GL11.glTranslated(0, 1, 3);
}
@Override
protected void setupInv(ItemStack stack) {
GL11.glScaled(1, 1, -1);
GL11.glTranslated(8, 6, 0);
double scale = 1.125D;
GL11.glScaled(scale, scale, scale);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glPushMatrix();
GL11.glRotated(225, 0, 0, 1);
GL11.glRotated(90, 0, 1, 0);
GL11.glRotated(25, 1, 0, 0);
GL11.glRotated(45, 0, 1, 0);
GL11.glTranslated(2, 0, 0);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.dani_celestial_tex);
ResourceManager.bio_revolver.renderAll();
GL11.glPopMatrix();
GL11.glTranslated(0, 0, 5);
GL11.glPushMatrix();
GL11.glRotated(225, 0, 0, 1);
GL11.glRotated(-90, 0, 1, 0);
GL11.glRotated(-90, 1, 0, 0);
GL11.glRotated(25, 1, 0, 0);
GL11.glRotated(-45, 0, 1, 0);
GL11.glTranslated(-2, 0, 0);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.dani_lunar_tex);
ResourceManager.bio_revolver.renderAll();
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
}
@Override
public void renderOther(ItemStack stack, ItemRenderType type) { }
}

View File

@ -51,7 +51,7 @@ public class ItemRenderDebug extends ItemRenderWeaponBase {
GL11.glPushMatrix();
GL11.glTranslated(-9, 2.5, 0);
GL11.glRotated(recoil[2] * -10, 0, 0, 1);
this.renderSmokeNodes(gun.smokeNodes, 0.5D);
this.renderSmokeNodes(gun.getConfig(stack, 0).smokeNodes, 0.5D);
GL11.glPopMatrix();
GL11.glRotated(reloadLift[0], 0, 0, 1);
@ -85,7 +85,7 @@ public class ItemRenderDebug extends ItemRenderWeaponBase {
GL11.glPushMatrix();
GL11.glTranslated(0.125, 2.5, 0);
this.renderGapFlash(gun.lastShot);
this.renderGapFlash(gun.lastShot[0]);
GL11.glPopMatrix();
GL11.glPushMatrix();

View File

@ -72,9 +72,9 @@ public class ItemRenderFlaregun extends ItemRenderWeaponBase {
GL11.glTranslated(0, 4, 9);
GL11.glRotated(90, 0, 1, 0);
GL11.glScaled(smokeScale, smokeScale, smokeScale);
this.renderSmokeNodes(gun.smokeNodes, 2.5D);
this.renderSmokeNodes(gun.getConfig(stack, 0).smokeNodes, 2.5D);
GL11.glTranslated(0, 0, 0.1);
this.renderSmokeNodes(gun.smokeNodes, 2D);
this.renderSmokeNodes(gun.getConfig(stack, 0).smokeNodes, 2D);
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);

View File

@ -89,7 +89,7 @@ public class ItemRenderGreasegun extends ItemRenderWeaponBase {
GL11.glRotated(turn[2], 0, 0, -1);
GL11.glRotated(90, 0, 1, 0);
GL11.glScaled(smokeScale, smokeScale, smokeScale);
this.renderSmokeNodes(gun.smokeNodes, 1D);
this.renderSmokeNodes(gun.getConfig(stack, 0).smokeNodes, 1D);
GL11.glPopMatrix();
GL11.glPushMatrix();
@ -97,7 +97,7 @@ public class ItemRenderGreasegun extends ItemRenderWeaponBase {
GL11.glRotated(turn[2], 0, 0, -1);
GL11.glRotated(90, 0, 1, 0);
GL11.glScaled(smokeScale, smokeScale, smokeScale);
this.renderSmokeNodes(gun.smokeNodes, 1D);
this.renderSmokeNodes(gun.getConfig(stack, 0).smokeNodes, 1D);
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
@ -107,7 +107,7 @@ public class ItemRenderGreasegun extends ItemRenderWeaponBase {
GL11.glRotated(90, 0, 1, 0);
GL11.glRotated(90 * gun.shotRand, 1, 0, 0);
GL11.glScaled(0.5, 0.5, 0.5);
this.renderMuzzleFlash(gun.lastShot, 75, 7.5);
this.renderMuzzleFlash(gun.lastShot[0], 75, 7.5);
GL11.glPopMatrix();
}

View File

@ -53,7 +53,7 @@ public class ItemRenderHeavyRevolver extends ItemRenderWeaponBase {
GL11.glPushMatrix();
GL11.glTranslated(-9, 2.5, 0);
GL11.glRotated(recoil[2] * -10, 0, 0, 1);
this.renderSmokeNodes(gun.smokeNodes, 0.5D);
this.renderSmokeNodes(gun.getConfig(stack, 0).smokeNodes, 0.5D);
GL11.glPopMatrix();
GL11.glRotated(reloadLift[0], 0, 0, 1);
@ -87,7 +87,7 @@ public class ItemRenderHeavyRevolver extends ItemRenderWeaponBase {
GL11.glPushMatrix();
GL11.glTranslated(0.125, 2.5, 0);
this.renderGapFlash(gun.lastShot);
this.renderGapFlash(gun.lastShot[0]);
GL11.glPopMatrix();
GL11.glPushMatrix();

View File

@ -72,7 +72,7 @@ public class ItemRenderHenry extends ItemRenderWeaponBase {
GL11.glTranslated(0, 1, 8);
GL11.glRotated(turn[2], 0, 0, -1);
GL11.glRotated(90, 0, 1, 0);
this.renderSmokeNodes(gun.smokeNodes, 0.25D);
this.renderSmokeNodes(gun.getConfig(stack, 0).smokeNodes, 0.25D);
GL11.glPopMatrix();
ResourceManager.henry.renderPart("Gun");
@ -116,7 +116,7 @@ public class ItemRenderHenry extends ItemRenderWeaponBase {
GL11.glTranslated(0, 1, 8);
GL11.glRotated(90, 0, 1, 0);
GL11.glRotated(90 * gun.shotRand, 1, 0, 0);
this.renderMuzzleFlash(gun.lastShot, 75, 5);
this.renderMuzzleFlash(gun.lastShot[0], 75, 5);
GL11.glPopMatrix();
}

View File

@ -2,6 +2,7 @@ package com.hbm.render.item.weapon.sedna;
import org.lwjgl.opengl.GL11;
import com.hbm.items.weapon.sedna.GunConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations;
@ -91,18 +92,20 @@ public class ItemRenderLiberator extends ItemRenderWeaponBase {
double smokeScale = 0.375;
GunConfig cfg = gun.getConfig(stack, 0);
GL11.glPushMatrix();
GL11.glTranslated(0, 0.25, 7.25);
GL11.glRotated(90, 0, 1, 0);
GL11.glScaled(smokeScale, smokeScale, smokeScale);
GL11.glTranslated(0, 0, 0.25 / smokeScale);
this.renderSmokeNodes(gun.smokeNodes, 1D);
this.renderSmokeNodes(cfg.smokeNodes, 1D);
GL11.glTranslated(0, 0, -0.5 / smokeScale);
this.renderSmokeNodes(gun.smokeNodes, 1D);
this.renderSmokeNodes(cfg.smokeNodes, 1D);
GL11.glTranslated(0, 0.5 / smokeScale, 0);
this.renderSmokeNodes(gun.smokeNodes, 1D);
this.renderSmokeNodes(cfg.smokeNodes, 1D);
GL11.glTranslated(0, 0, 0.5 / smokeScale);
this.renderSmokeNodes(gun.smokeNodes, 1D);
this.renderSmokeNodes(cfg.smokeNodes, 1D);
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
@ -112,7 +115,7 @@ public class ItemRenderLiberator extends ItemRenderWeaponBase {
GL11.glRotated(90, 0, 1, 0);
GL11.glRotated(90 * gun.shotRand, 1, 0, 0);
GL11.glScaled(1.5, 1.5, 1.5);
this.renderMuzzleFlash(gun.lastShot, 75, 5);
this.renderMuzzleFlash(gun.lastShot[0], 75, 5);
GL11.glPopMatrix();
}

View File

@ -58,7 +58,7 @@ public class ItemRenderMaresleg extends ItemRenderWeaponBase {
GL11.glTranslated(0, 1, 8);
GL11.glRotated(turn[2], 0, 0, -1);
GL11.glRotated(90, 0, 1, 0);
this.renderSmokeNodes(gun.smokeNodes, 0.25D);
this.renderSmokeNodes(gun.getConfig(stack, 0).smokeNodes, 0.25D);
GL11.glPopMatrix();
ResourceManager.maresleg.renderPart("Gun");
@ -90,7 +90,7 @@ public class ItemRenderMaresleg extends ItemRenderWeaponBase {
GL11.glTranslated(0, 1, 8);
GL11.glRotated(90, 0, 1, 0);
GL11.glRotated(90 * gun.shotRand, 1, 0, 0);
this.renderMuzzleFlash(gun.lastShot, 75, 5);
this.renderMuzzleFlash(gun.lastShot[0], 75, 5);
GL11.glPopMatrix();
}

View File

@ -51,7 +51,7 @@ public class ItemRenderPepperbox extends ItemRenderWeaponBase {
GL11.glPushMatrix();
GL11.glTranslated(0, 0.5, 7);
GL11.glRotated(90, 0, 1, 0);
this.renderSmokeNodes(gun.smokeNodes, 0.5D);
this.renderSmokeNodes(gun.getConfig(stack, 0).smokeNodes, 0.5D);
GL11.glPopMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.pepperbox_tex);
@ -90,9 +90,9 @@ public class ItemRenderPepperbox extends ItemRenderWeaponBase {
GL11.glScaled(0.5, 0.5, 0.5);
GL11.glRotated(90, 0, 1, 0);
GL11.glRotated(90 * gun.shotRand, 1, 0, 0);
this.renderMuzzleFlash(gun.lastShot);
this.renderMuzzleFlash(gun.lastShot[0]);
GL11.glRotated(45, 1, 0, 0);
this.renderMuzzleFlash(gun.lastShot);
this.renderMuzzleFlash(gun.lastShot[0]);
GL11.glPopMatrix();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB