This commit is contained in:
Bob 2024-10-26 01:13:09 +02:00
parent f8de5314f6
commit 17b667bf3d
31 changed files with 242 additions and 104 deletions

View File

@ -186,7 +186,7 @@ public class ConsumableRecipes {
//Batteries //Batteries
CraftingManager.addRecipeAuto(new ItemStack(ModItems.armor_battery, 1), new Object[] { "PCP", "PCP", "PCP", 'P', STEEL.plate(), 'C', ModBlocks.capacitor_gold }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.armor_battery, 1), new Object[] { "PCP", "PCP", "PCP", 'P', STEEL.plate(), 'C', ModBlocks.capacitor_gold });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.armor_battery_mk2, 1), new Object[] { "PCP", "PCP", "PCP", 'P', ANY_PLASTIC.ingot(), 'C', ModBlocks.capacitor_niobium }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.armor_battery_mk2, 1), new Object[] { "PCP", "PCP", "PCP", 'P', ANY_PLASTIC.ingot(), 'C', ModBlocks.capacitor_niobium });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.armor_battery_mk3, 1), new Object[] { "PCP", "PCP", "PCP", 'P', GOLD.plate(), 'C', ModBlocks.block_tantalium }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.armor_battery_mk3, 1), new Object[] { "PCP", "PCP", "PCP", 'P', GOLD.plate(), 'C', ModBlocks.capacitor_tantalium });
//Special Mods //Special Mods
CraftingManager.addRecipeAuto(new ItemStack(ModItems.horseshoe_magnet, 1), new Object[] { "L L", "I I", "ILI", 'L', ModItems.lodestone, 'I', IRON.ingot() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.horseshoe_magnet, 1), new Object[] { "L L", "I I", "ILI", 'L', ModItems.lodestone, 'I', IRON.ingot() });

View File

@ -86,7 +86,7 @@ public class EntityAIFireGun extends EntityAIBase {
if(state == FireState.IDLE) { if(state == FireState.IDLE) {
GunConfig config = gun.getConfig(stack, 0); GunConfig config = gun.getConfig(stack, 0);
Receiver rec = config.getReceivers(stack)[0]; Receiver rec = config.getReceivers(stack)[0];
if(rec.getMagazine(stack).getAmount(stack) <= 0) { if(rec.getMagazine(stack).getAmount(stack, null) <= 0) {
updateState(FireState.RELOADING, 20, gun, stack); updateState(FireState.RELOADING, 20, gun, stack);
} else if(ItemGunBaseNT.getState(stack, 0) == GunState.IDLE) { } else if(ItemGunBaseNT.getState(stack, 0) == GunState.IDLE) {
updateState(FireState.FIRING, host.worldObj.rand.nextInt(burstTime), gun, stack); updateState(FireState.FIRING, host.worldObj.rand.nextInt(burstTime), gun, stack);

View File

@ -23,6 +23,7 @@ import com.hbm.inventory.material.Mats.MaterialStack;
import com.hbm.inventory.recipes.loader.SerializableRecipe; import com.hbm.inventory.recipes.loader.SerializableRecipe;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.ItemEnums.EnumAshType; import com.hbm.items.ItemEnums.EnumAshType;
import com.hbm.items.ItemEnums.EnumCasingType;
import com.hbm.util.Compat; import com.hbm.util.Compat;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -57,6 +58,11 @@ public class MatDistribution extends SerializableRecipe {
registerEntry(ModItems.stamp_obsidian_flat, MAT_OBSIDIAN, INGOT.q(3)); registerEntry(ModItems.stamp_obsidian_flat, MAT_OBSIDIAN, INGOT.q(3));
registerEntry(ModItems.pipes_steel, MAT_STEEL, BLOCK.q(3)); registerEntry(ModItems.pipes_steel, MAT_STEEL, BLOCK.q(3));
registerEntry(DictFrame.fromOne(ModItems.casing, EnumCasingType.SMALL), MAT_GUNMETAL, PLATE.q(1, 4));
registerEntry(DictFrame.fromOne(ModItems.casing, EnumCasingType.SMALL_STEEL), MAT_WEAPONSTEEL, PLATE.q(1, 4));
registerEntry(DictFrame.fromOne(ModItems.casing, EnumCasingType.LARGE), MAT_GUNMETAL, PLATE.q(1, 2));
registerEntry(DictFrame.fromOne(ModItems.casing, EnumCasingType.LARGE_STEEL), MAT_WEAPONSTEEL, PLATE.q(1, 2));
//actual ores //actual ores
if(!Compat.isModLoaded(Compat.MOD_GT6)) { if(!Compat.isModLoaded(Compat.MOD_GT6)) {
registerOre(OreDictManager.IRON.ore(), MAT_IRON, INGOT.q(2), MAT_TITANIUM, NUGGET.q(3), MAT_STONE, QUART.q(1)); registerOre(OreDictManager.IRON.ore(), MAT_IRON, INGOT.q(2), MAT_TITANIUM, NUGGET.q(3), MAT_STONE, QUART.q(1));
@ -93,6 +99,7 @@ public class MatDistribution extends SerializableRecipe {
if(key instanceof Item) comp = new ComparableStack((Item) key); if(key instanceof Item) comp = new ComparableStack((Item) key);
if(key instanceof Block) comp = new ComparableStack((Block) key); if(key instanceof Block) comp = new ComparableStack((Block) key);
if(key instanceof ItemStack) comp = new ComparableStack((ItemStack) key); if(key instanceof ItemStack) comp = new ComparableStack((ItemStack) key);
if(key instanceof ComparableStack) comp = (ComparableStack) key;
if(comp == null) return; if(comp == null) return;
if(matDef.length % 2 == 1) return; if(matDef.length % 2 == 1) return;

View File

@ -6,8 +6,10 @@ import java.util.List;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.material.Mats; import com.hbm.inventory.material.Mats;
import com.hbm.inventory.OreDictManager.DictFrame;
import com.hbm.inventory.material.MaterialShapes; import com.hbm.inventory.material.MaterialShapes;
import com.hbm.inventory.material.NTMMaterial; import com.hbm.inventory.material.NTMMaterial;
import com.hbm.items.ItemEnums.EnumCasingType;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.lib.RefStrings; import com.hbm.lib.RefStrings;
import com.hbm.util.I18nUtil; import com.hbm.util.I18nUtil;
@ -75,11 +77,12 @@ public class ItemMold extends Item {
registerMold(new MoldBlock( 12, L, "block", MaterialShapes.BLOCK)); registerMold(new MoldBlock( 12, L, "block", MaterialShapes.BLOCK));
registerMold(new MoldSingle( 13, L, "pipes", new ItemStack(ModItems.pipes_steel), Mats.MAT_STEEL, MaterialShapes.BLOCK.q(3))); registerMold(new MoldSingle( 13, L, "pipes", new ItemStack(ModItems.pipes_steel), Mats.MAT_STEEL, MaterialShapes.BLOCK.q(3)));
registerMold(new MoldSingle( 14, S, "c357", new ItemStack(ModItems.casing_357), Mats.MAT_COPPER, MaterialShapes.PLATE.q(1))); registerMold(new MoldMulti( 16, S, "c9", MaterialShapes.PLATE.q(1, 4),
registerMold(new MoldSingle( 15, S, "c44", new ItemStack(ModItems.casing_44), Mats.MAT_COPPER, MaterialShapes.PLATE.q(1))); Mats.MAT_GUNMETAL, DictFrame.fromOne(ModItems.casing, EnumCasingType.SMALL),
registerMold(new MoldSingle( 16, S, "c9", new ItemStack(ModItems.casing_9), Mats.MAT_COPPER, MaterialShapes.PLATE.q(1))); Mats.MAT_WEAPONSTEEL, DictFrame.fromOne(ModItems.casing, EnumCasingType.SMALL_STEEL)));
registerMold(new MoldSingle( 17, S, "c50", new ItemStack(ModItems.casing_50), Mats.MAT_COPPER, MaterialShapes.PLATE.q(1))); registerMold(new MoldMulti( 17, S, "c50", MaterialShapes.PLATE.q(1, 2),
registerMold(new MoldSingle( 18, S, "cbuckshot", new ItemStack(ModItems.casing_buckshot), Mats.MAT_COPPER, MaterialShapes.PLATE.q(1))); Mats.MAT_GUNMETAL, DictFrame.fromOne(ModItems.casing, EnumCasingType.LARGE),
Mats.MAT_WEAPONSTEEL, DictFrame.fromOne(ModItems.casing, EnumCasingType.LARGE_STEEL)));
registerMold(new MoldShape( 22, S, "barrel_light", MaterialShapes.LIGHTBARREL)); registerMold(new MoldShape( 22, S, "barrel_light", MaterialShapes.LIGHTBARREL));
registerMold(new MoldShape( 23, S, "barrel_heavy", MaterialShapes.HEAVYBARREL)); registerMold(new MoldShape( 23, S, "barrel_heavy", MaterialShapes.HEAVYBARREL));

View File

@ -119,7 +119,7 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
GunConfig config = getConfig(stack, i); GunConfig config = getConfig(stack, i);
for(Receiver rec : config.getReceivers(stack)) { for(Receiver rec : config.getReceivers(stack)) {
IMagazine mag = rec.getMagazine(stack); IMagazine mag = rec.getMagazine(stack);
list.add("Ammo: " + mag.getIconForHUD(stack).getDisplayName() + " " + mag.reportAmmoStateForHUD(stack)); list.add("Ammo: " + mag.getIconForHUD(stack, player).getDisplayName() + " " + mag.reportAmmoStateForHUD(stack, player));
list.add("Base Damage: " + rec.getBaseDamage(stack)); list.add("Base Damage: " + rec.getBaseDamage(stack));
} }
} }

View File

@ -73,8 +73,8 @@ public class GunFactoryClient {
g12_slug.setRenderer(LegoClient.RENDER_STANDARD_BULLET); g12_slug.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
g12_flechette.setRenderer(LegoClient.RENDER_FLECHETTE_BULLET); g12_flechette.setRenderer(LegoClient.RENDER_FLECHETTE_BULLET);
g12_magnum.setRenderer(LegoClient.RENDER_STANDARD_BULLET); g12_magnum.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
g12_explosive.setRenderer(LegoClient.RENDER_STANDARD_BULLET); g12_explosive.setRenderer(LegoClient.RENDER_EXPRESS_BULLET);
g12_phosphorus.setRenderer(LegoClient.RENDER_STANDARD_BULLET); g12_phosphorus.setRenderer(LegoClient.RENDER_AP_BULLET);
g12_anthrax.setRenderer(LegoClient.RENDER_STANDARD_BULLET); g12_anthrax.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
r762_sp.setRenderer(LegoClient.RENDER_STANDARD_BULLET); r762_sp.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
r762_fmj.setRenderer(LegoClient.RENDER_STANDARD_BULLET); r762_fmj.setRenderer(LegoClient.RENDER_STANDARD_BULLET);

View File

@ -84,7 +84,7 @@ public class GunStateDecider {
} }
} }
mag.setAmountAfterReload(stack, mag.getAmount(stack)); mag.setAmountAfterReload(stack, mag.getAmount(stack, ctx.inventory));
} }
} }

View File

@ -51,7 +51,7 @@ public class Lego {
IMagazine mag = rec.getMagazine(stack); IMagazine mag = rec.getMagazine(stack);
if(mag.canReload(stack, ctx.inventory)) { if(mag.canReload(stack, ctx.inventory)) {
int loaded = mag.getAmount(stack); int loaded = mag.getAmount(stack, ctx.inventory);
mag.setAmountBeforeReload(stack, loaded); mag.setAmountBeforeReload(stack, loaded);
ItemGunBaseNT.setState(stack, ctx.configIndex, GunState.RELOADING); ItemGunBaseNT.setState(stack, ctx.configIndex, GunState.RELOADING);
ItemGunBaseNT.setTimer(stack, ctx.configIndex, rec.getReloadBeginDuration(stack) + (loaded <= 0 ? rec.getReloadCockOnEmptyPre(stack) : 0)); ItemGunBaseNT.setTimer(stack, ctx.configIndex, rec.getReloadBeginDuration(stack) + (loaded <= 0 ? rec.getReloadCockOnEmptyPre(stack) : 0));
@ -158,10 +158,10 @@ public class Lego {
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_TOGGLE_AIM = (stack, ctx) -> { ItemGunBaseNT.setIsAiming(stack, !ItemGunBaseNT.getIsAiming(stack)); }; public static BiConsumer<ItemStack, LambdaContext> LAMBDA_TOGGLE_AIM = (stack, ctx) -> { ItemGunBaseNT.setIsAiming(stack, !ItemGunBaseNT.getIsAiming(stack)); };
/** Returns true if the mag has ammo in it. Used by keybind functions on whether to fire, and deciders on whether to trigger a refire. */ /** Returns true if the mag has ammo in it. Used by keybind functions on whether to fire, and deciders on whether to trigger a refire. */
public static BiFunction<ItemStack, LambdaContext, Boolean> LAMBDA_STANDARD_CAN_FIRE = (stack, ctx) -> { return ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack) > 0; }; public static BiFunction<ItemStack, LambdaContext, Boolean> LAMBDA_STANDARD_CAN_FIRE = (stack, ctx) -> { return ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack, ctx.inventory) > 0; };
/** Returns true if the mag has ammo in it, and the gun is in the locked on state */ /** Returns true if the mag has ammo in it, and the gun is in the locked on state */
public static BiFunction<ItemStack, LambdaContext, Boolean> LAMBDA_LOCKON_CAN_FIRE = (stack, ctx) -> { return ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack) > 0 && ItemGunBaseNT.getIsLockedOn(stack); }; public static BiFunction<ItemStack, LambdaContext, Boolean> LAMBDA_LOCKON_CAN_FIRE = (stack, ctx) -> { return ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack, ctx.inventory) > 0 && ItemGunBaseNT.getIsLockedOn(stack); };
@ -192,7 +192,7 @@ public class Lego {
float aim = ItemGunBaseNT.getIsAiming(stack) ? 0.25F : 1F; float aim = ItemGunBaseNT.getIsAiming(stack) ? 0.25F : 1F;
Receiver primary = ctx.config.getReceivers(stack)[0]; Receiver primary = ctx.config.getReceivers(stack)[0];
IMagazine mag = primary.getMagazine(stack); IMagazine mag = primary.getMagazine(stack);
BulletConfig config = (BulletConfig) mag.getType(stack); BulletConfig config = (BulletConfig) mag.getType(stack, ctx.inventory);
Vec3 offset = primary.getProjectileOffset(stack); Vec3 offset = primary.getProjectileOffset(stack);
double forwardOffset = offset.xCoord; double forwardOffset = offset.xCoord;
@ -214,7 +214,7 @@ public class Lego {
entity.worldObj.spawnEntityInWorld(mk4); entity.worldObj.spawnEntityInWorld(mk4);
} }
mag.setAmount(stack, mag.getAmount(stack) - 1); mag.useUpAmmo(stack, ctx.inventory, 1);
if(calcWear) ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + config.wear, ctx.config.getDurability(stack))); if(calcWear) ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + config.wear, ctx.config.getDurability(stack)));
} }

View File

@ -37,7 +37,7 @@ public class Orchestras {
if(timer == 16) { if(timer == 16) {
Receiver rec = ctx.config.getReceivers(stack)[0]; Receiver rec = ctx.config.getReceivers(stack)[0];
IMagazine mag = rec.getMagazine(stack); IMagazine mag = rec.getMagazine(stack);
SpentCasing casing = mag.getCasing(stack); SpentCasing casing = mag.getCasing(stack, ctx.inventory);
if(casing != null) for(int i = 0; i < mag.getCapacity(stack); i++) CasingCreator.composeEffect(entity.worldObj, entity, 0.25, -0.125, -0.125, -0.05, 0, 0, 0.01, casing.getName()); if(casing != null) for(int i = 0; i < mag.getCapacity(stack); i++) CasingCreator.composeEffect(entity.worldObj, entity, 0.25, -0.125, -0.125, -0.05, 0, 0, 0.01, casing.getName());
} }
} }
@ -162,7 +162,7 @@ public class Orchestras {
} }
if(type == AnimType.CYCLE) { if(type == AnimType.CYCLE) {
if(timer == 14) { if(timer == 14) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack); SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.5, -0.125, aiming ? -0.125 : -0.375D, 0, 0.12, -0.12, 0.01, casing.getName(), true, 60, 0.5D, 20); if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.5, -0.125, aiming ? -0.125 : -0.375D, 0, 0.12, -0.12, 0.01, casing.getName(), true, 60, 0.5D, 20);
} }
if(timer == 12) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.leverCock", 1F, 1F); if(timer == 12) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.leverCock", 1F, 1F);
@ -185,7 +185,7 @@ public class Orchestras {
} }
if(type == AnimType.CYCLE) { if(type == AnimType.CYCLE) {
if(timer == 2) { if(timer == 2) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack); SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.55, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.12, 0.01, casing.getName()); if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.55, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.12, 0.01, casing.getName());
} }
} }
@ -233,7 +233,7 @@ public class Orchestras {
} }
if(type == AnimType.CYCLE) { if(type == AnimType.CYCLE) {
if(timer == 14) { if(timer == 14) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack); SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.3125, -0.125, aiming ? -0.125 : -0.375D, 0, 0.18, -0.12, 0.01, casing.getName(), true, 60, 0.5D, 20); if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.3125, -0.125, aiming ? -0.125 : -0.375D, 0, 0.18, -0.12, 0.01, casing.getName(), true, 60, 0.5D, 20);
} }
if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.leverCock", 1F, 0.8F); if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.leverCock", 1F, 0.8F);
@ -268,7 +268,7 @@ public class Orchestras {
} }
if(type == AnimType.CYCLE) { if(type == AnimType.CYCLE) {
if(timer == 14) { if(timer == 14) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack); SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.3125, -0.125, aiming ? -0.125 : -0.375D, 0, -0.08, 0, 0.01, casing.getName(), true, 60, 0.5D, 20); if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.3125, -0.125, aiming ? -0.125 : -0.375D, 0, -0.08, 0, 0.01, casing.getName(), true, 60, 0.5D, 20);
} }
if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.leverCock", 1F, 0.8F); if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.leverCock", 1F, 0.8F);
@ -289,7 +289,7 @@ public class Orchestras {
if(type == AnimType.CYCLE) { if(type == AnimType.CYCLE) {
if(timer == 14) { if(timer == 14) {
int offset = ctx.configIndex == 0 ? -1 : 1; int offset = ctx.configIndex == 0 ? -1 : 1;
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack); SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.3125, -0.125, aiming ? -0.125 * offset : -0.375D * offset, 0, -0.08, 0, 0.01, casing.getName(), true, 60, 0.5D, 20); if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.3125, -0.125, aiming ? -0.125 * offset : -0.375D * offset, 0, -0.08, 0, 0.01, casing.getName(), true, 60, 0.5D, 20);
} }
if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.leverCock", 1F, 0.8F); if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.leverCock", 1F, 0.8F);
@ -311,7 +311,7 @@ public class Orchestras {
if(timer == 4) { if(timer == 4) {
IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack); IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack);
if(mag.getAmountAfterReload(stack) > 0) { if(mag.getAmountAfterReload(stack) > 0) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack); SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.625, -0.125, aiming ? -0.125 : -0.375D, -0.12, 0.18, 0, 0.01, casing.getName(), true, 60, 0.5D, 20); if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.625, -0.125, aiming ? -0.125 : -0.375D, -0.12, 0.18, 0, 0.01, casing.getName(), true, 60, 0.5D, 20);
mag.setAmountBeforeReload(stack, 0); mag.setAmountBeforeReload(stack, 0);
} }
@ -347,7 +347,7 @@ public class Orchestras {
if(timer == 16) { if(timer == 16) {
Receiver rec = ctx.config.getReceivers(stack)[0]; Receiver rec = ctx.config.getReceivers(stack)[0];
IMagazine mag = rec.getMagazine(stack); IMagazine mag = rec.getMagazine(stack);
SpentCasing casing = mag.getCasing(stack); SpentCasing casing = mag.getCasing(stack, ctx.inventory);
if(casing != null) for(int i = 0; i < mag.getCapacity(stack); i++) CasingCreator.composeEffect(entity.worldObj, entity, 0.25, -0.125, -0.125, -0.05, 0, 0, 0.01, casing.getName()); if(casing != null) for(int i = 0; i < mag.getCapacity(stack); i++) CasingCreator.composeEffect(entity.worldObj, entity, 0.25, -0.125, -0.125, -0.05, 0, 0, 0.01, casing.getName());
} }
} }
@ -373,7 +373,7 @@ public class Orchestras {
if(type == AnimType.CYCLE) { if(type == AnimType.CYCLE) {
if(timer == 2) { if(timer == 2) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack); SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.3125, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.06, 0.01, casing.getName(), true, 60, 0.5D, 20); if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.3125, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.06, 0.01, casing.getName(), true, 60, 0.5D, 20);
} }
} }
@ -408,7 +408,7 @@ public class Orchestras {
if(ClientConfig.GUN_ANIMS_LEGACY.get()) { if(ClientConfig.GUN_ANIMS_LEGACY.get()) {
if(type == AnimType.CYCLE) { if(type == AnimType.CYCLE) {
if(timer == 0) { if(timer == 0) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack); SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.4375, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, -0.06, 0, 0.01, casing.getName()); if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.4375, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, -0.06, 0, 0.01, casing.getName());
} }
} }
@ -432,7 +432,7 @@ public class Orchestras {
} else { } else {
if(type == AnimType.CYCLE) { if(type == AnimType.CYCLE) {
if(timer == 0) { if(timer == 0) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack); SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.4375, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, -0.06, 0, 0.01, casing.getName()); if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.4375, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, -0.06, 0, 0.01, casing.getName());
} }
} }
@ -467,8 +467,8 @@ public class Orchestras {
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverCock", 1F, 0.75F); if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverCock", 1F, 0.75F);
if(timer == 4) { if(timer == 4) {
IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack); IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack);
int toEject = mag.getAmountAfterReload(stack) - mag.getAmount(stack); int toEject = mag.getAmountAfterReload(stack) - mag.getAmount(stack, ctx.inventory);
SpentCasing casing = mag.getCasing(stack); SpentCasing casing = mag.getCasing(stack, ctx.inventory);
if(casing != null) for(int i = 0; i < toEject; i++) CasingCreator.composeEffect(entity.worldObj, entity, 0.625, -0.1875, -0.375D, -0.12, 0.18, 0, 0.01, casing.getName(), true, 60, 0.5D, 20); if(casing != null) for(int i = 0; i < toEject; i++) CasingCreator.composeEffect(entity.worldObj, entity, 0.625, -0.1875, -0.375D, -0.12, 0.18, 0, 0.01, casing.getName(), true, 60, 0.5D, 20);
} }
if(timer == 15) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallInsert", 1F, 1F); if(timer == 15) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
@ -490,9 +490,9 @@ public class Orchestras {
if(type == AnimType.INSPECT) { if(type == AnimType.INSPECT) {
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverCock", 1F, 0.75F); if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverCock", 1F, 0.75F);
IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack); IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack);
int toEject = mag.getAmountAfterReload(stack) - mag.getAmount(stack); int toEject = mag.getAmountAfterReload(stack) - mag.getAmount(stack, ctx.inventory);
if(timer == 4 && toEject > 0) { if(timer == 4 && toEject > 0) {
SpentCasing casing = mag.getCasing(stack); SpentCasing casing = mag.getCasing(stack, ctx.inventory);
if(casing != null) for(int i = 0; i < toEject; i++) CasingCreator.composeEffect(entity.worldObj, entity, 0.625, -0.1875, -0.375D, -0.12, 0.18, 0, 0.01, casing.getName(), true, 60, 0.5D, 20); if(casing != null) for(int i = 0; i < toEject; i++) CasingCreator.composeEffect(entity.worldObj, entity, 0.625, -0.1875, -0.375D, -0.12, 0.18, 0, 0.01, casing.getName(), true, 60, 0.5D, 20);
mag.setAmountAfterReload(stack, 0); mag.setAmountAfterReload(stack, 0);
} }
@ -510,7 +510,7 @@ public class Orchestras {
if(type == AnimType.CYCLE) { if(type == AnimType.CYCLE) {
if(timer == 15) { if(timer == 15) {
IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack); IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack);
SpentCasing casing = mag.getCasing(stack); SpentCasing casing = mag.getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 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(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 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);
} }
} }
@ -584,7 +584,7 @@ public class Orchestras {
} }
if(type == AnimType.CYCLE) { if(type == AnimType.CYCLE) {
if(timer == 1) { if(timer == 1) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack); SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.375, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.12, 0.01, casing.getName()); if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.375, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.12, 0.01, casing.getName());
} }
} }
@ -614,13 +614,13 @@ public class Orchestras {
if(type == AnimType.CYCLE || type == AnimType.ALT_CYCLE) { if(type == AnimType.CYCLE || type == AnimType.ALT_CYCLE) {
if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.shotgunCock", 1F, 1F); if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.shotgunCock", 1F, 1F);
if(timer == 10) { if(timer == 10) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack); SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.375, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.12, 0.01, casing.getName()); if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.375, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.12, 0.01, casing.getName());
} }
} }
if(type == AnimType.RELOAD) { if(type == AnimType.RELOAD) {
IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack); IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack);
if(mag.getAmount(stack) == 0) { if(mag.getAmount(stack, ctx.inventory) == 0) {
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverCock", 1F, 1F); if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverCock", 1F, 1F);
if(timer == 7) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 1F); if(timer == 7) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 1F);
} }
@ -651,7 +651,7 @@ public class Orchestras {
if(type == AnimType.CYCLE) { if(type == AnimType.CYCLE) {
if(timer == 0) { if(timer == 0) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack); SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.5, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.12, 0.01, casing.getName()); if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.5, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.12, 0.01, casing.getName());
} }
} }
@ -749,7 +749,7 @@ public class Orchestras {
if(type == AnimType.CYCLE) { if(type == AnimType.CYCLE) {
if(timer == 0) { if(timer == 0) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack); SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.375, aiming ? 0 : -0.125, aiming ? 0 : -0.3125D, 0, 0.06, -0.18, 0.01, casing.getName()); if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.375, aiming ? 0 : -0.125, aiming ? 0 : -0.3125D, 0, 0.06, -0.18, 0.01, casing.getName());
} }
} }

View File

@ -3,6 +3,7 @@ package com.hbm.items.weapon.sedna.factory;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import java.util.function.BiFunction; import java.util.function.BiFunction;
import com.hbm.entity.projectile.EntityBulletBaseMK4;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.BulletConfig; import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.Crosshair; import com.hbm.items.weapon.sedna.Crosshair;
@ -15,6 +16,7 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.items.weapon.sedna.mags.MagazineSingleReload; import com.hbm.items.weapon.sedna.mags.MagazineSingleReload;
import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
@ -26,6 +28,7 @@ import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
public class XFactory12ga { public class XFactory12ga {
@ -40,6 +43,10 @@ public class XFactory12ga {
public static BulletConfig g12_phosphorus; public static BulletConfig g12_phosphorus;
public static BulletConfig g12_anthrax; public static BulletConfig g12_anthrax;
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_STANDARD_EXPLODE = (bullet, mop) -> {
Lego.standardExplode(bullet, mop, 2F); bullet.setDead();
};
public static void init() { public static void init() {
g12_bp = new BulletConfig().setItem(EnumAmmo.G12_BP).setProjectiles(8).setSpread(0.05F).setRicochetAngle(15).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(SpentCasing.COLOR_CASE_BRASS, SpentCasing.COLOR_CASE_BRASS).setScale(0.75F).register("12GA_BP")); g12_bp = new BulletConfig().setItem(EnumAmmo.G12_BP).setProjectiles(8).setSpread(0.05F).setRicochetAngle(15).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(SpentCasing.COLOR_CASE_BRASS, SpentCasing.COLOR_CASE_BRASS).setScale(0.75F).register("12GA_BP"));
@ -49,14 +56,14 @@ public class XFactory12ga {
g12_slug = new BulletConfig().setItem(EnumAmmo.G12_SLUG).setSpread(0.0F).setRicochetAngle(25).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0x393939, SpentCasing.COLOR_CASE_BRASS).setScale(0.75F).register("12GA_SLUG")); g12_slug = new BulletConfig().setItem(EnumAmmo.G12_SLUG).setSpread(0.0F).setRicochetAngle(25).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0x393939, SpentCasing.COLOR_CASE_BRASS).setScale(0.75F).register("12GA_SLUG"));
g12_flechette = new BulletConfig().setItem(EnumAmmo.G12_FLECHETTE).setProjectiles(8).setSpread(0.025F).setRicochetAngle(5).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0x3C80F0, SpentCasing.COLOR_CASE_BRASS).setScale(0.75F).register("12GA_FLECHETTE")); g12_flechette = new BulletConfig().setItem(EnumAmmo.G12_FLECHETTE).setProjectiles(8).setSpread(0.025F).setRicochetAngle(5).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0x3C80F0, SpentCasing.COLOR_CASE_BRASS).setScale(0.75F).register("12GA_FLECHETTE"));
g12_magnum = new BulletConfig().setItem(EnumAmmo.G12_MAGNUM).setProjectiles(4).setSpread(0.015F).setRicochetAngle(15).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0x278400, SpentCasing.COLOR_CASE_12GA).setScale(0.75F).register("12GA_MAGNUM")); g12_magnum = new BulletConfig().setItem(EnumAmmo.G12_MAGNUM).setProjectiles(4).setSpread(0.015F).setRicochetAngle(15).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0x278400, SpentCasing.COLOR_CASE_12GA).setScale(0.75F).register("12GA_MAGNUM"));
g12_explosive = new BulletConfig().setItem(EnumAmmo.G12_EXPLOSIVE).setSpread(0F).setRicochetAngle(15).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0xDA4127, SpentCasing.COLOR_CASE_12GA).setScale(0.75F).register("12GA_EXPLOSIVE")); g12_explosive = new BulletConfig().setItem(EnumAmmo.G12_EXPLOSIVE).setOnImpact(LAMBDA_STANDARD_EXPLODE).setSpread(0F).setRicochetAngle(15).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0xDA4127, SpentCasing.COLOR_CASE_12GA).setScale(0.75F).register("12GA_EXPLOSIVE"));
g12_phosphorus = new BulletConfig().setItem(EnumAmmo.G12_PHOSPHORUS).setProjectiles(8).setSpread(0.015F).setRicochetAngle(15).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0x910001, SpentCasing.COLOR_CASE_12GA).setScale(0.75F).register("12GA_PHOSPHORUS")); g12_phosphorus = new BulletConfig().setItem(EnumAmmo.G12_PHOSPHORUS).setProjectiles(8).setSpread(0.015F).setRicochetAngle(15).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0x910001, SpentCasing.COLOR_CASE_12GA).setScale(0.75F).register("12GA_PHOSPHORUS"));
g12_anthrax = new BulletConfig().setItem(EnumAmmo.G12_ANTHRAX).setProjectiles(8).setSpread(0.015F).setRicochetAngle(15).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0x749300, SpentCasing.COLOR_CASE_12GA).setScale(0.75F).register("12GA_ANTHRAX")); g12_anthrax = new BulletConfig().setItem(EnumAmmo.G12_ANTHRAX).setProjectiles(8).setSpread(0.015F).setRicochetAngle(15).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0x749300, SpentCasing.COLOR_CASE_12GA).setScale(0.75F).register("12GA_ANTHRAX"));
BulletConfig[] all = new BulletConfig[] {g12_bp, g12_bp_magnum, g12_bp_slug, g12, g12_slug, g12_flechette, g12_magnum, g12_explosive, g12_phosphorus, g12_anthrax}; BulletConfig[] all = new BulletConfig[] {g12_bp, g12_bp_magnum, g12_bp_slug, g12, g12_slug, g12_flechette, g12_magnum, g12_explosive, g12_phosphorus, g12_anthrax};
ModItems.gun_maresleg = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig() ModItems.gun_maresleg = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
.dura(600).draw(20).inspect(39).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE) .dura(600).draw(10).inspect(39).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
.dmg(12F).delay(20).reload(22, 10, 13, 0).jam(24).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(all)) .mag(new MagazineSingleReload(0, 6).addConfigs(all))
@ -66,7 +73,7 @@ public class XFactory12ga {
.anim(LAMBDA_MARESLEG_ANIMS).orchestra(Orchestras.ORCHESTRA_MARESLEG) .anim(LAMBDA_MARESLEG_ANIMS).orchestra(Orchestras.ORCHESTRA_MARESLEG)
).setUnlocalizedName("gun_maresleg"); ).setUnlocalizedName("gun_maresleg");
ModItems.gun_maresleg_akimbo = new ItemGunBaseNT(WeaponQuality.B_SIDE, ModItems.gun_maresleg_akimbo = new ItemGunBaseNT(WeaponQuality.B_SIDE,
new GunConfig().dura(600).draw(20).inspect(39).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE) new GunConfig().dura(600).draw(5).inspect(39).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
.dmg(12F).delay(20).reload(22, 10, 13, 0).jam(24).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(all)) .mag(new MagazineSingleReload(0, 6).addConfigs(all))
@ -75,7 +82,7 @@ public class XFactory12ga {
.pp(Lego.LAMBDA_STANDARD_CLICK_PRIMARY).pr(Lego.LAMBDA_STANDARD_RELOAD) .pp(Lego.LAMBDA_STANDARD_CLICK_PRIMARY).pr(Lego.LAMBDA_STANDARD_RELOAD)
.decider(GunStateDecider.LAMBDA_STANDARD_DECIDER) .decider(GunStateDecider.LAMBDA_STANDARD_DECIDER)
.anim(LAMBDA_MARESLEG_SHORT_ANIMS).orchestra(Orchestras.ORCHESTRA_MARESLEG_AKIMBO), .anim(LAMBDA_MARESLEG_SHORT_ANIMS).orchestra(Orchestras.ORCHESTRA_MARESLEG_AKIMBO),
new GunConfig().dura(600).draw(20).inspect(39).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE) new GunConfig().dura(600).draw(5).inspect(39).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
.dmg(12F).delay(20).reload(22, 10, 13, 0).jam(24).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(1, 6).addConfigs(all)) .mag(new MagazineSingleReload(1, 6).addConfigs(all))
@ -86,7 +93,7 @@ public class XFactory12ga {
.anim(LAMBDA_MARESLEG_SHORT_ANIMS).orchestra(Orchestras.ORCHESTRA_MARESLEG_AKIMBO) .anim(LAMBDA_MARESLEG_SHORT_ANIMS).orchestra(Orchestras.ORCHESTRA_MARESLEG_AKIMBO)
).setUnlocalizedName("gun_maresleg_akimbo"); ).setUnlocalizedName("gun_maresleg_akimbo");
ModItems.gun_maresleg_broken = new ItemGunBaseNT(WeaponQuality.LEGENDARY, new GunConfig() ModItems.gun_maresleg_broken = new ItemGunBaseNT(WeaponQuality.LEGENDARY, new GunConfig()
.dura(0).draw(20).inspect(39).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE) .dura(0).draw(5).inspect(39).reloadSequential(true).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
.dmg(12F).delay(20).reload(22, 10, 13, 0).jam(24).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(all)) .mag(new MagazineSingleReload(0, 6).addConfigs(all))
@ -175,7 +182,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("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)); .addBus("HAMMER", new BusAnimationSequence().addPos(30, 0, 0, 50).addPos(30, 0, 0, 550).addPos(0, 0, 0, 200));
case RELOAD: case RELOAD:
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack) <= 0; boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory) <= 0;
return new BusAnimation() return new BusAnimation()
.addBus("LIFT", new BusAnimationSequence().addPos(30, 0, 0, 400, IType.SIN_FULL)) .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)) .addBus("LEVER", new BusAnimationSequence().addPos(0, 0, 0, 400).addPos(-85, 0, 0, 200))
@ -228,7 +235,7 @@ public class XFactory12ga {
/** This fucking sucks */ /** This fucking sucks */
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_LIBERATOR_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_LIBERATOR_ANIMS = (stack, type) -> {
int ammo = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack); int ammo = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory);
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN));
@ -331,7 +338,7 @@ public class XFactory12ga {
case CYCLE: return ResourceManager.spas_12_anim.get("Fire"); case CYCLE: return ResourceManager.spas_12_anim.get("Fire");
case CYCLE_DRY: return new BusAnimation(); case CYCLE_DRY: return new BusAnimation();
case RELOAD: case RELOAD:
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack) <= 0; boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory) <= 0;
return ResourceManager.spas_12_anim.get(empty ? "ReloadEmptyStart" : "ReloadStart"); return ResourceManager.spas_12_anim.get(empty ? "ReloadEmptyStart" : "ReloadStart");
case RELOAD_CYCLE: return ResourceManager.spas_12_anim.get("Reload"); case RELOAD_CYCLE: return ResourceManager.spas_12_anim.get("Reload");
case RELOAD_END: return ResourceManager.spas_12_anim.get("ReloadEnd"); case RELOAD_END: return ResourceManager.spas_12_anim.get("ReloadEnd");

View File

@ -14,6 +14,7 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality; import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineSingleReload; import com.hbm.items.weapon.sedna.mags.MagazineSingleReload;
import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
@ -90,7 +91,7 @@ public class XFactory40mm {
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_CONGOLAKE_ANIMS = (stack, type) -> { @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); int ammo = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory);
switch(type) { switch(type) {
case EQUIP: return ResourceManager.congolake_anim.get("Equip"); case EQUIP: return ResourceManager.congolake_anim.get("Equip");
case CYCLE: return ResourceManager.congolake_anim.get(ammo <= 1 ? "FireEmpty" : "Fire"); case CYCLE: return ResourceManager.congolake_anim.get(ammo <= 1 ? "FireEmpty" : "Fire");

View File

@ -12,7 +12,7 @@ import com.hbm.items.weapon.sedna.Receiver;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality; import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineBelt;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
@ -47,7 +47,7 @@ public class XFactory50 {
.dura(3_000).draw(10).inspect(31).crosshair(Crosshair.L_CIRCLE).smoke(LAMBDA_SMOKE) .dura(3_000).draw(10).inspect(31).crosshair(Crosshair.L_CIRCLE).smoke(LAMBDA_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
.dmg(5F).delay(2).dry(10).auto(true).spread(0.005F).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F) .dmg(5F).delay(2).dry(10).auto(true).spread(0.005F).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 30).addConfigs(bmg50_sp, bmg50_fmj, bmg50_jhp, bmg50_ap, bmg50_du)) .mag(new MagazineBelt().addConfigs(bmg50_sp, bmg50_fmj, bmg50_jhp, bmg50_ap, bmg50_du))
.offset(1, -0.0625 * 2.5, -0.25D) .offset(1, -0.0625 * 2.5, -0.25D)
.setupStandardFire().recoil(Lego.LAMBDA_STANDARD_RECOIL)) .setupStandardFire().recoil(Lego.LAMBDA_STANDARD_RECOIL))
.setupStandardConfiguration() .setupStandardConfiguration()

View File

@ -13,6 +13,7 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality; import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.main.MainRegistry;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
@ -57,7 +58,7 @@ public class XFactory556mm {
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_G3_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_G3_ANIMS = (stack, type) -> {
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack) <= 0; boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory) <= 0;
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL)); .addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL));

View File

@ -13,6 +13,7 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality; import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.main.MainRegistry;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
@ -60,7 +61,7 @@ public class XFactory762mm {
}; };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_CARBINE_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_CARBINE_ANIMS = (stack, type) -> {
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack) <= 0; boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory) <= 0;
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL)); .addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL));

View File

@ -13,6 +13,7 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality; import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.main.MainRegistry;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.particle.SpentCasing.CasingType; import com.hbm.particle.SpentCasing.CasingType;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
@ -41,7 +42,7 @@ public class XFactory9mm {
.setCasing(casing9.clone().setColor(SpentCasing.COLOR_CASE_44).register("p9ap")); .setCasing(casing9.clone().setColor(SpentCasing.COLOR_CASE_44).register("p9ap"));
ModItems.gun_greasegun = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig() ModItems.gun_greasegun = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
.dura(3_000).draw(15).inspect(31).crosshair(Crosshair.L_CIRCLE).smoke(LAMBDA_SMOKE) .dura(3_000).draw(20).inspect(31).crosshair(Crosshair.L_CIRCLE).smoke(LAMBDA_SMOKE)
.rec(new Receiver(0) .rec(new Receiver(0)
.dmg(5F).delay(4).dry(40).auto(true).spread(0.015F).reload(60).jam(55).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)) .mag(new MagazineFullReload(0, 30).addConfigs(p9_sp, p9_fmj, p9_jhp, p9_ap))
@ -91,7 +92,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("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)); .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: case RELOAD:
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack) <= 0; boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory) <= 0;
return new BusAnimation() 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("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)) .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))
@ -126,7 +127,7 @@ public class XFactory9mm {
.addBus("LIFT", new BusAnimationSequence().addPos(0, 0, 0, 250).addPos(-25, 0, 0, 250, IType.SIN_FULL).addPos(-25, 0, 0, 500).addPos(0, 0, 0, 250, IType.SIN_FULL)) .addBus("LIFT", new BusAnimationSequence().addPos(0, 0, 0, 250).addPos(-25, 0, 0, 250, IType.SIN_FULL).addPos(-25, 0, 0, 500).addPos(0, 0, 0, 250, IType.SIN_FULL))
.addBus("SLIDE", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, 0, -2, 150, IType.SIN_FULL).addPos(0, 0, 0, 50, IType.SIN_UP)); .addBus("SLIDE", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, 0, -2, 150, IType.SIN_FULL).addPos(0, 0, 0, 50, IType.SIN_UP));
case RELOAD: case RELOAD:
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack) <= 0; boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory) <= 0;
return new BusAnimation() return new BusAnimation()
.addBus("MAG", new BusAnimationSequence().addPos(0, 0, 0, 250).addPos(0, -10, 0, 250, IType.SIN_UP).addPos(0, -10, 0, 750).addPos(0, 0, 0, 500, IType.SIN_DOWN)) .addBus("MAG", new BusAnimationSequence().addPos(0, 0, 0, 250).addPos(0, -10, 0, 250, IType.SIN_UP).addPos(0, -10, 0, 750).addPos(0, 0, 0, 500, IType.SIN_DOWN))
.addBus("LIFT", new BusAnimationSequence().addPos(-25, 0, 0, 250, IType.SIN_FULL).addPos(-25, 0, 0, 2000).addPos(0, 0, 0, 500, IType.SIN_FULL)) .addBus("LIFT", new BusAnimationSequence().addPos(-25, 0, 0, 250, IType.SIN_FULL).addPos(-25, 0, 0, 2000).addPos(0, 0, 0, 500, IType.SIN_FULL))

View File

@ -18,6 +18,7 @@ import com.hbm.items.weapon.sedna.impl.ItemGunStinger;
import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
import com.hbm.items.weapon.sedna.mags.MagazineSingleReload; import com.hbm.items.weapon.sedna.mags.MagazineSingleReload;
import com.hbm.lib.Library; import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.BusAnimationKeyframe.IType;
@ -118,7 +119,7 @@ public class XFactoryRocket {
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STINGER_SECONDARY_RELEASE = (stack, ctx) -> { ItemGunStinger.setIsLockingOn(stack, false); }; public static BiConsumer<ItemStack, LambdaContext> LAMBDA_STINGER_SECONDARY_RELEASE = (stack, ctx) -> { ItemGunStinger.setIsLockingOn(stack, false); };
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_PANZERSCHRECK_ANIMS = (stack, type) -> { @SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_PANZERSCHRECK_ANIMS = (stack, type) -> {
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack) <= 0; boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory) <= 0;
switch(type) { switch(type) {
case EQUIP: return new BusAnimation() case EQUIP: return new BusAnimation()
.addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN)); .addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_DOWN));

View File

@ -55,12 +55,12 @@ public class HUDComponentAmmoCounter implements IHUDComponent {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
IMagazine mag = gun.getConfig(stack, gunIndex).getReceivers(stack)[this.receiver].getMagazine(stack); IMagazine mag = gun.getConfig(stack, gunIndex).getReceivers(stack)[this.receiver].getMagazine(stack);
if(!noCounter) mc.fontRenderer.drawString(mag.reportAmmoStateForHUD(stack), pX + 17, pZ + 6, 0xFFFFFF); if(!noCounter) mc.fontRenderer.drawString(mag.reportAmmoStateForHUD(stack, player), pX + 17, pZ + 6, 0xFFFFFF);
GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting(); RenderHelper.enableGUIStandardItemLighting();
itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), mag.getIconForHUD(stack), pX, pZ); itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), mag.getIconForHUD(stack, player), pX, pZ);
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL12.GL_RESCALE_NORMAL);

View File

@ -75,7 +75,7 @@ public class ItemGunChemthrower extends ItemGunBaseNT implements IFillableItem {
public static int getMagCount(ItemStack stack) { return ItemGunBaseNT.getValueInt(stack, MagazineFluid.KEY_MAG_COUNT + 0); } public static int getMagCount(ItemStack stack) { return ItemGunBaseNT.getValueInt(stack, MagazineFluid.KEY_MAG_COUNT + 0); }
public static void setMagCount(ItemStack stack, int value) { ItemGunBaseNT.setValueInt(stack, MagazineFluid.KEY_MAG_COUNT + 0, value); } public static void setMagCount(ItemStack stack, int value) { ItemGunBaseNT.setValueInt(stack, MagazineFluid.KEY_MAG_COUNT + 0, value); }
public static BiFunction<ItemStack, LambdaContext, Boolean> LAMBDA_CAN_FIRE = (stack, ctx) -> { return ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack) >= CONSUMPTION; }; public static BiFunction<ItemStack, LambdaContext, Boolean> LAMBDA_CAN_FIRE = (stack, ctx) -> { return ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack, ctx.inventory) >= CONSUMPTION; };
public static BiConsumer<ItemStack, LambdaContext> LAMBDA_FIRE = (stack, ctx) -> { public static BiConsumer<ItemStack, LambdaContext> LAMBDA_FIRE = (stack, ctx) -> {
EntityLivingBase entity = ctx.entity; EntityLivingBase entity = ctx.entity;
@ -92,10 +92,10 @@ public class ItemGunChemthrower extends ItemGunBaseNT implements IFillableItem {
double sideOffset = offset.zCoord; double sideOffset = offset.zCoord;
EntityChemical chem = new EntityChemical(entity.worldObj, entity, sideOffset, heightOffset, forwardOffset); EntityChemical chem = new EntityChemical(entity.worldObj, entity, sideOffset, heightOffset, forwardOffset);
chem.setFluid((FluidType) mag.getType(stack)); chem.setFluid((FluidType) mag.getType(stack, ctx.inventory));
entity.worldObj.spawnEntityInWorld(chem); entity.worldObj.spawnEntityInWorld(chem);
mag.setAmount(stack, mag.getAmount(stack) - CONSUMPTION); mag.useUpAmmo(stack, ctx.inventory, CONSUMPTION);
ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + 1F, ctx.config.getDurability(stack))); ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + 1F, ctx.config.getDurability(stack)));
}; };
} }

View File

@ -45,7 +45,7 @@ public class ItemGunStinger extends ItemGunBaseNT {
if(!world.isRemote) { if(!world.isRemote) {
int prevTarget = this.getLockonTarget(stack); int prevTarget = this.getLockonTarget(stack);
if(isHeld && this.getIsLockingOn(stack) && this.getIsAiming(stack) && this.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack) > 0) { if(isHeld && this.getIsLockingOn(stack) && this.getIsAiming(stack) && this.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, player.inventory) > 0) {
int newLockonTarget = this.getLockonTarget(player); int newLockonTarget = this.getLockonTarget(player);
if(newLockonTarget == -1) { if(newLockonTarget == -1) {

View File

@ -2,6 +2,7 @@ package com.hbm.items.weapon.sedna.mags;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -14,25 +15,27 @@ import net.minecraft.item.ItemStack;
public interface IMagazine<T> { public interface IMagazine<T> {
/** What ammo is loaded currently */ /** What ammo is loaded currently */
public T getType(ItemStack stack); public T getType(ItemStack stack, IInventory inventory);
/** Sets the mag's ammo type */ /** Sets the mag's ammo type */
public void setType(ItemStack stack, T type); public void setType(ItemStack stack, T type);
/** How much ammo this mag can carry */ /** How much ammo this mag can carry */
public int getCapacity(ItemStack stack); public int getCapacity(ItemStack stack);
/** How much ammo is currently loaded */ /** How much ammo is currently loaded */
public int getAmount(ItemStack stack); public int getAmount(ItemStack stack, IInventory inventory);
/** Sets the mag's ammo level */ /** Sets the mag's ammo level */
public void setAmount(ItemStack stack, int amount); public void setAmount(ItemStack stack, int amount);
/** removes the specified amount fro mthe magazine */
public void useUpAmmo(ItemStack stack, IInventory inventory, int amount);
/** If a reload can even be initiated, i.e. the player even has bullets to load, inventory can be null */ /** If a reload can even be initiated, i.e. the player even has bullets to load, inventory can be null */
public boolean canReload(ItemStack stack, IInventory inventory); public boolean canReload(ItemStack stack, IInventory inventory);
/** The action done at the end of one reload cycle, either loading one shell or replacing the whole mag, inventory can be null */ /** The action done at the end of one reload cycle, either loading one shell or replacing the whole mag, inventory can be null */
public void reloadAction(ItemStack stack, IInventory inventory); public void reloadAction(ItemStack stack, IInventory inventory);
/** The stack that should be displayed for the ammo HUD */ /** The stack that should be displayed for the ammo HUD */
public ItemStack getIconForHUD(ItemStack stack); public ItemStack getIconForHUD(ItemStack stack, EntityPlayer player);
/** It explains itself */ /** It explains itself */
public String reportAmmoStateForHUD(ItemStack stack); public String reportAmmoStateForHUD(ItemStack stack, EntityPlayer player);
/** Casing config to use then ejecting */ /** Casing config to use then ejecting */
public SpentCasing getCasing(ItemStack stack); public SpentCasing getCasing(ItemStack stack, IInventory inventory);
/** When reloading, remember the amount before reload is initiated */ /** When reloading, remember the amount before reload is initiated */
public void setAmountBeforeReload(ItemStack stack, int amount); public void setAmountBeforeReload(ItemStack stack, int amount);
/** Amount of rounds before reload has started. Do note that the NBT stack sync likely arrives /** Amount of rounds before reload has started. Do note that the NBT stack sync likely arrives

View File

@ -0,0 +1,98 @@
package com.hbm.items.weapon.sedna.mags;
import java.util.ArrayList;
import java.util.List;
import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.particle.SpentCasing;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
public class MagazineBelt implements IMagazine<BulletConfig> {
protected List<BulletConfig> acceptedBullets = new ArrayList();
public MagazineBelt addConfigs(BulletConfig... cfgs) { for(BulletConfig cfg : cfgs) acceptedBullets.add(cfg); return this; }
@Override
public BulletConfig getType(ItemStack stack, IInventory inventory) {
return getFirstConfig(inventory);
}
@Override
public void useUpAmmo(ItemStack stack, IInventory inventory, int amount) {
BulletConfig first = this.getFirstConfig(inventory);
for(int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack slot = inventory.getStackInSlot(i);
if(slot != null) {
if(first.ammo.matchesRecipe(slot, true)) {
int toRemove = Math.min(slot.stackSize, amount);
amount -= toRemove;
inventory.decrStackSize(i, toRemove);
}
}
}
}
@Override public void setType(ItemStack stack, BulletConfig type) { }
@Override public int getCapacity(ItemStack stack) { return 0; }
@Override public void setAmount(ItemStack stack, int amount) { }
@Override public boolean canReload(ItemStack stack, IInventory inventory) { return false; }
@Override public void reloadAction(ItemStack stack, IInventory inventory) { }
@Override public void setAmountBeforeReload(ItemStack stack, int amount) { }
@Override public int getAmountBeforeReload(ItemStack stack) { return 0; }
@Override public void setAmountAfterReload(ItemStack stack, int amount) { }
@Override public int getAmountAfterReload(ItemStack stack) { return 0; }
@Override
public int getAmount(ItemStack stack, IInventory inventory) {
BulletConfig first = this.getFirstConfig(inventory);
int count = 0;
for(int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack slot = inventory.getStackInSlot(i);
if(slot != null) {
if(first.ammo.matchesRecipe(slot, true)) count += slot.stackSize;
}
}
return count;
}
@Override
public ItemStack getIconForHUD(ItemStack stack, EntityPlayer player) {
BulletConfig first = this.getFirstConfig(player.inventory);
return first.ammo.toStack();
}
@Override
public String reportAmmoStateForHUD(ItemStack stack, EntityPlayer player) {
return "x" + getAmount(stack, player.inventory);
}
@Override
public SpentCasing getCasing(ItemStack stack, IInventory invnetory) {
return getFirstConfig(invnetory).casing;
}
public BulletConfig getFirstConfig(IInventory inventory) {
if(inventory == null) return acceptedBullets.get(0);
for(int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack slot = inventory.getStackInSlot(i);
if(slot != null) {
for(BulletConfig config : this.acceptedBullets) {
if(config.ammo.matchesRecipe(slot, true)) return config;
}
}
}
return acceptedBullets.get(0);
}
}

View File

@ -6,6 +6,7 @@ import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -27,7 +28,7 @@ public class MagazineFluid implements IMagazine<FluidType> {
} }
@Override @Override
public FluidType getType(ItemStack stack) { public FluidType getType(ItemStack stack, IInventory inventory) {
int id = this.getMagType(stack, index); int id = this.getMagType(stack, index);
return Fluids.fromID(id); return Fluids.fromID(id);
} }
@ -41,16 +42,21 @@ public class MagazineFluid implements IMagazine<FluidType> {
public int getCapacity(ItemStack stack) { public int getCapacity(ItemStack stack) {
return capacity; return capacity;
} }
@Override
public void useUpAmmo(ItemStack stack, IInventory inventory, int amount) {
this.setAmount(stack, this.getAmount(stack, inventory) - amount);
}
@Override public int getAmount(ItemStack stack) { return getMagCount(stack, index); } @Override public int getAmount(ItemStack stack, IInventory inventory) { return getMagCount(stack, index); }
@Override public void setAmount(ItemStack stack, int amount) { setMagCount(stack, index, amount); } @Override public void setAmount(ItemStack stack, int amount) { setMagCount(stack, index, amount); }
@Override public boolean canReload(ItemStack stack, IInventory inventory) { return false; } @Override public boolean canReload(ItemStack stack, IInventory inventory) { return false; }
@Override public void reloadAction(ItemStack stack, IInventory inventory) { } @Override public void reloadAction(ItemStack stack, IInventory inventory) { }
@Override public SpentCasing getCasing(ItemStack stack) { return null; } @Override public SpentCasing getCasing(ItemStack stack, IInventory inventory) { return null; }
@Override public ItemStack getIconForHUD(ItemStack stack) { return new ItemStack(ModItems.fluid_icon, 1, this.getMagType(stack, index)); } @Override public ItemStack getIconForHUD(ItemStack stack, EntityPlayer player) { return new ItemStack(ModItems.fluid_icon, 1, this.getMagType(stack, index)); }
@Override public String reportAmmoStateForHUD(ItemStack stack) { return getIconForHUD(stack).getDisplayName(); } @Override public String reportAmmoStateForHUD(ItemStack stack, EntityPlayer player) { return getIconForHUD(stack, player).getDisplayName(); }
@Override public void setAmountBeforeReload(ItemStack stack, int amount) { ItemGunBaseNT.setValueInt(stack, KEY_MAG_PREV + index, amount); } @Override public void setAmountBeforeReload(ItemStack stack, int amount) { ItemGunBaseNT.setValueInt(stack, KEY_MAG_PREV + index, amount); }
@Override public int getAmountBeforeReload(ItemStack stack) { return ItemGunBaseNT.getValueInt(stack, KEY_MAG_PREV + index); } @Override public int getAmountBeforeReload(ItemStack stack) { return ItemGunBaseNT.getValueInt(stack, KEY_MAG_PREV + index); }
@ -61,5 +67,4 @@ public class MagazineFluid implements IMagazine<FluidType> {
public static void setMagType(ItemStack stack, int index, int value) { ItemGunBaseNT.setValueInt(stack, KEY_MAG_TYPE + index, value); } public static void setMagType(ItemStack stack, int index, int value) { ItemGunBaseNT.setValueInt(stack, KEY_MAG_TYPE + index, value); }
public static int getMagCount(ItemStack stack, int index) { return ItemGunBaseNT.getValueInt(stack, KEY_MAG_COUNT + index); } public static int getMagCount(ItemStack stack, int index) { return ItemGunBaseNT.getValueInt(stack, KEY_MAG_COUNT + index); }
public static void setMagCount(ItemStack stack, int index, int value) { ItemGunBaseNT.setValueInt(stack, KEY_MAG_COUNT + index, value); } public static void setMagCount(ItemStack stack, int index, int value) { ItemGunBaseNT.setValueInt(stack, KEY_MAG_COUNT + index, value); }
} }

View File

@ -16,7 +16,7 @@ public class MagazineFullReload extends MagazineSingleTypeBase {
@Override @Override
public boolean canReload(ItemStack stack, IInventory inventory) { public boolean canReload(ItemStack stack, IInventory inventory) {
if(this.getAmount(stack) >= this.getCapacity(stack)) return false; if(this.getAmount(stack, inventory) >= this.getCapacity(stack)) return false;
if(inventory == null) return true; if(inventory == null) return true;
@ -24,12 +24,12 @@ public class MagazineFullReload extends MagazineSingleTypeBase {
ItemStack slot = inventory.getStackInSlot(i); ItemStack slot = inventory.getStackInSlot(i);
if(slot != null) { if(slot != null) {
if(this.getAmount(stack) == 0) { if(this.getAmount(stack, inventory) == 0) {
for(BulletConfig config : this.acceptedBullets) { for(BulletConfig config : this.acceptedBullets) {
if(config.ammo.matchesRecipe(slot, true)) return true; if(config.ammo.matchesRecipe(slot, true)) return true;
} }
} else { } else {
BulletConfig config = this.getType(stack); BulletConfig config = this.getType(stack, inventory);
if(config == null) { config = this.acceptedBullets.get(0); this.setType(stack, config); } if(config == null) { config = this.acceptedBullets.get(0); this.setType(stack, config); }
if(config.ammo.matchesRecipe(slot, true)) return true; if(config.ammo.matchesRecipe(slot, true)) return true;
} }
@ -44,9 +44,8 @@ public class MagazineFullReload extends MagazineSingleTypeBase {
public void reloadAction(ItemStack stack, IInventory inventory) { public void reloadAction(ItemStack stack, IInventory inventory) {
if(inventory == null) { if(inventory == null) {
BulletConfig config = this.getType(stack); BulletConfig config = this.getType(stack, inventory);
if(config == null) { config = this.acceptedBullets.get(0); this.setType(stack, config); } //fixing broken NBT if(config == null) { config = this.acceptedBullets.get(0); this.setType(stack, config); } //fixing broken NBT
this.setAmount(stack, this.capacity); this.setAmount(stack, this.capacity);
return; return;
} }
@ -57,7 +56,7 @@ public class MagazineFullReload extends MagazineSingleTypeBase {
if(slot != null) { if(slot != null) {
//mag is empty, assume next best type //mag is empty, assume next best type
if(this.getAmount(stack) == 0) { if(this.getAmount(stack, inventory) == 0) {
for(BulletConfig config : this.acceptedBullets) { for(BulletConfig config : this.acceptedBullets) {
if(config.ammo.matchesRecipe(slot, true)) { if(config.ammo.matchesRecipe(slot, true)) {
@ -71,11 +70,11 @@ public class MagazineFullReload extends MagazineSingleTypeBase {
} }
//mag has a type set, only load that //mag has a type set, only load that
} else { } else {
BulletConfig config = this.getType(stack); BulletConfig config = this.getType(stack, inventory);
if(config == null) { config = this.acceptedBullets.get(0); this.setType(stack, config); } //fixing broken NBT if(config == null) { config = this.acceptedBullets.get(0); this.setType(stack, config); } //fixing broken NBT
if(config.ammo.matchesRecipe(slot, true)) { if(config.ammo.matchesRecipe(slot, true)) {
int alreadyLoaded = this.getAmount(stack); int alreadyLoaded = this.getAmount(stack, inventory);
int wantsToLoad = (int) Math.ceil((double) this.getCapacity(stack) / (double) config.ammoReloadCount) - (alreadyLoaded / config.ammoReloadCount); int wantsToLoad = (int) Math.ceil((double) this.getCapacity(stack) / (double) config.ammoReloadCount) - (alreadyLoaded / config.ammoReloadCount);
int toLoad = Math.min(wantsToLoad, slot.stackSize); int toLoad = Math.min(wantsToLoad, slot.stackSize);
this.setAmount(stack, Math.min((toLoad * config.ammoReloadCount) + alreadyLoaded, this.capacity)); this.setAmount(stack, Math.min((toLoad * config.ammoReloadCount) + alreadyLoaded, this.capacity));

View File

@ -16,7 +16,7 @@ public class MagazineSingleReload extends MagazineSingleTypeBase {
@Override @Override
public boolean canReload(ItemStack stack, IInventory inventory) { public boolean canReload(ItemStack stack, IInventory inventory) {
if(this.getAmount(stack) >= this.getCapacity(stack)) return false; if(this.getAmount(stack, inventory) >= this.getCapacity(stack)) return false;
if(inventory == null) return true; if(inventory == null) return true;
@ -24,12 +24,12 @@ public class MagazineSingleReload extends MagazineSingleTypeBase {
ItemStack slot = inventory.getStackInSlot(i); ItemStack slot = inventory.getStackInSlot(i);
if(slot != null) { if(slot != null) {
if(this.getAmount(stack) == 0) { if(this.getAmount(stack, inventory) == 0) {
for(BulletConfig config : this.acceptedBullets) { for(BulletConfig config : this.acceptedBullets) {
if(config.ammo.matchesRecipe(slot, true)) return true; if(config.ammo.matchesRecipe(slot, true)) return true;
} }
} else { } else {
BulletConfig config = this.getType(stack); BulletConfig config = this.getType(stack, inventory);
if(config == null) { config = this.acceptedBullets.get(0); this.setType(stack, config); } if(config == null) { config = this.acceptedBullets.get(0); this.setType(stack, config); }
if(config.ammo.matchesRecipe(slot, true)) return true; if(config.ammo.matchesRecipe(slot, true)) return true;
} }
@ -44,10 +44,9 @@ public class MagazineSingleReload extends MagazineSingleTypeBase {
public void reloadAction(ItemStack stack, IInventory inventory) { public void reloadAction(ItemStack stack, IInventory inventory) {
if(inventory == null) { if(inventory == null) {
BulletConfig config = this.getType(stack); BulletConfig config = this.getType(stack, inventory);
if(config == null) { config = this.acceptedBullets.get(0); this.setType(stack, config); } //fixing broken if(config == null) { config = this.acceptedBullets.get(0); this.setType(stack, config); } //fixing broken NBT
this.setAmount(stack, this.getAmount(stack, inventory) + 1);
this.setAmount(stack, this.getAmount(stack) + 1);
return; return;
} }
@ -57,7 +56,7 @@ public class MagazineSingleReload extends MagazineSingleTypeBase {
if(slot != null) { if(slot != null) {
//mag is empty, assume next best type //mag is empty, assume next best type
if(this.getAmount(stack) == 0) { if(this.getAmount(stack, inventory) == 0) {
for(BulletConfig config : this.acceptedBullets) { for(BulletConfig config : this.acceptedBullets) {
if(config.ammo.matchesRecipe(slot, true)) { if(config.ammo.matchesRecipe(slot, true)) {
@ -69,11 +68,11 @@ public class MagazineSingleReload extends MagazineSingleTypeBase {
} }
//mag has a type set, only load that //mag has a type set, only load that
} else { } else {
BulletConfig config = this.getType(stack); BulletConfig config = this.getType(stack, inventory);
if(config == null) { config = this.acceptedBullets.get(0); this.setType(stack, config); } //fixing broken NBT if(config == null) { config = this.acceptedBullets.get(0); this.setType(stack, config); } //fixing broken NBT
if(config.ammo.matchesRecipe(slot, true)) { if(config.ammo.matchesRecipe(slot, true)) {
int alreadyLoaded = this.getAmount(stack); int alreadyLoaded = this.getAmount(stack, inventory);
this.setAmount(stack, alreadyLoaded + 1); this.setAmount(stack, alreadyLoaded + 1);
inventory.decrStackSize(i, 1); inventory.decrStackSize(i, 1);
return; return;

View File

@ -7,6 +7,8 @@ import com.hbm.items.weapon.sedna.BulletConfig;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
/** Base class for typical magazines, i.e. ones that hold bullets, shells, grenades, etc, any ammo item. Stores a single type of BulletConfigs */ /** Base class for typical magazines, i.e. ones that hold bullets, shells, grenades, etc, any ammo item. Stores a single type of BulletConfigs */
@ -32,7 +34,7 @@ public abstract class MagazineSingleTypeBase implements IMagazine<BulletConfig>
public MagazineSingleTypeBase addConfigs(BulletConfig... cfgs) { for(BulletConfig cfg : cfgs) acceptedBullets.add(cfg); return this; } public MagazineSingleTypeBase addConfigs(BulletConfig... cfgs) { for(BulletConfig cfg : cfgs) acceptedBullets.add(cfg); return this; }
@Override @Override
public BulletConfig getType(ItemStack stack) { public BulletConfig getType(ItemStack stack, IInventory inventory) {
int type = getMagType(stack, index); int type = getMagType(stack, index);
if(type >= 0 && type < BulletConfig.configs.size()) { if(type >= 0 && type < BulletConfig.configs.size()) {
BulletConfig cfg = BulletConfig.configs.get(type); BulletConfig cfg = BulletConfig.configs.get(type);
@ -49,24 +51,29 @@ public abstract class MagazineSingleTypeBase implements IMagazine<BulletConfig>
} }
@Override @Override
public ItemStack getIconForHUD(ItemStack stack) { public ItemStack getIconForHUD(ItemStack stack, EntityPlayer player) {
BulletConfig config = this.getType(stack); BulletConfig config = this.getType(stack, player.inventory);
if(config != null) return config.ammo.toStack(); if(config != null) return config.ammo.toStack();
return null; return null;
} }
@Override @Override
public String reportAmmoStateForHUD(ItemStack stack) { public String reportAmmoStateForHUD(ItemStack stack, EntityPlayer player) {
return getAmount(stack) + " / " + getCapacity(stack); return getAmount(stack, player.inventory) + " / " + getCapacity(stack);
} }
@Override @Override
public SpentCasing getCasing(ItemStack stack) { public SpentCasing getCasing(ItemStack stack, IInventory inventory) {
return this.getType(stack).casing; return this.getType(stack, inventory).casing;
}
@Override
public void useUpAmmo(ItemStack stack, IInventory inventory, int amount) {
this.setAmount(stack, this.getAmount(stack, inventory) - amount);
} }
@Override public int getCapacity(ItemStack stack) { return capacity; } @Override public int getCapacity(ItemStack stack) { return capacity; }
@Override public int getAmount(ItemStack stack) { return getMagCount(stack, index); } @Override public int getAmount(ItemStack stack, IInventory inventory) { return getMagCount(stack, index); }
@Override public void setAmount(ItemStack stack, int amount) { setMagCount(stack, index, amount); } @Override public void setAmount(ItemStack stack, int amount) { setMagCount(stack, index, amount); }
@Override public void setAmountBeforeReload(ItemStack stack, int amount) { ItemGunBaseNT.setValueInt(stack, KEY_MAG_PREV + index, amount); } @Override public void setAmountBeforeReload(ItemStack stack, int amount) { ItemGunBaseNT.setValueInt(stack, KEY_MAG_PREV + index, amount); }

View File

@ -3,6 +3,7 @@ package com.hbm.render.item.weapon.sedna;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -80,7 +81,7 @@ public class ItemRenderAm180 extends ItemRenderWeaponBase {
HbmAnimations.applyRelevantTransformation("Mag"); HbmAnimations.applyRelevantTransformation("Mag");
GL11.glPushMatrix(); GL11.glPushMatrix();
int mag = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack); int mag = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory);
GL11.glTranslated(0, 0, 1.5); GL11.glTranslated(0, 0, 1.5);
GL11.glRotated(mag / 59D * 360D, 0, -1, 0); GL11.glRotated(mag / 59D * 360D, 0, -1, 0);
GL11.glTranslated(0, 0, -1.5); GL11.glTranslated(0, 0, -1.5);

View File

@ -4,6 +4,7 @@ import org.lwjgl.opengl.GL11;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.mags.IMagazine; import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -48,7 +49,7 @@ public class ItemRenderChemthrower extends ItemRenderWeaponBase {
GL11.glTranslated(0, 0.875, 1.75); GL11.glTranslated(0, 0.875, 1.75);
IMagazine mag = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack); IMagazine mag = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack);
double d = (double) mag.getAmount(stack) / (double) mag.getCapacity(stack); double d = (double) mag.getAmount(stack, MainRegistry.proxy.me().inventory) / (double) mag.getCapacity(stack);
GL11.glRotated(135 - d * 270, 1, 0, 0); GL11.glRotated(135 - d * 270, 1, 0, 0);
GL11.glTranslated(0, -0.875, -1.75); GL11.glTranslated(0, -0.875, -1.75);

View File

@ -6,6 +6,7 @@ import org.lwjgl.opengl.GL11;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.mags.IMagazine; import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -83,13 +84,13 @@ public class ItemRenderCongoLake extends ItemRenderWeaponBase {
GL11.glPushMatrix(); GL11.glPushMatrix();
{ {
IMagazine mag = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack); IMagazine mag = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack);
if(gun.getLastAnim(stack, 0) != AnimType.INSPECT || mag.getAmount(stack) > 0) { //omit when inspecting and no shell is loaded if(gun.getLastAnim(stack, 0) != AnimType.INSPECT || mag.getAmount(stack, MainRegistry.proxy.me().inventory) > 0) { //omit when inspecting and no shell is loaded
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.casings_tex); Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.casings_tex);
HbmAnimations.applyRelevantTransformation("Shell"); HbmAnimations.applyRelevantTransformation("Shell");
SpentCasing casing = mag.getCasing(stack); SpentCasing casing = mag.getCasing(stack, MainRegistry.proxy.me().inventory);
int[] colors = casing != null ? casing.getColors() : new int[] { SpentCasing.COLOR_CASE_40MM }; int[] colors = casing != null ? casing.getColors() : new int[] { SpentCasing.COLOR_CASE_40MM };
Color shellColor = new Color(colors[0]); Color shellColor = new Color(colors[0]);

View File

@ -4,6 +4,7 @@ import org.lwjgl.opengl.GL11;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.mags.IMagazine; import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -61,7 +62,7 @@ public class ItemRenderFlamer extends ItemRenderWeaponBase {
HbmAnimations.applyRelevantTransformation("Gauge"); HbmAnimations.applyRelevantTransformation("Gauge");
GL11.glTranslated(1.25, 1.25, 0); GL11.glTranslated(1.25, 1.25, 0);
IMagazine mag = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack); IMagazine mag = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack);
GL11.glRotated(-135 + (mag.getAmount(stack) * 270D / mag.getCapacity(stack)), 0, 0, 1); GL11.glRotated(-135 + (mag.getAmount(stack, MainRegistry.proxy.me().inventory) * 270D / mag.getCapacity(stack)), 0, 0, 1);
GL11.glTranslated(-1.25, -1.25, 0); GL11.glTranslated(-1.25, -1.25, 0);
ResourceManager.flamethrower.renderPart("Gauge"); ResourceManager.flamethrower.renderPart("Gauge");
GL11.glPopMatrix(); GL11.glPopMatrix();

View File

@ -50,7 +50,7 @@ public class ItemRenderGreasegun extends ItemRenderWeaponBase {
GL11.glRotated(lift[0], 1, 0, 0); GL11.glRotated(lift[0], 1, 0, 0);
GL11.glTranslated(0, 3, 3); GL11.glTranslated(0, 3, 3);
GL11.glRotated(turn[2], 0, 0, 1); if(gun.aimingProgress < 1F) GL11.glRotated(turn[2], 0, 0, 1);
GL11.glTranslated(0, 0, recoil[2]); GL11.glTranslated(0, 0, recoil[2]);

View File

@ -5,6 +5,7 @@ import java.awt.Color;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing;
import com.hbm.render.anim.HbmAnimations; import com.hbm.render.anim.HbmAnimations;
@ -55,7 +56,7 @@ public class ItemRenderSPAS12 extends ItemRenderWeaponBase {
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.casings_tex); Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.casings_tex);
HbmAnimations.applyRelevantTransformation("Shell"); HbmAnimations.applyRelevantTransformation("Shell");
SpentCasing casing = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getCasing(stack); SpentCasing casing = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getCasing(stack, MainRegistry.proxy.me().inventory);
int color0 = SpentCasing.COLOR_CASE_BRASS; int color0 = SpentCasing.COLOR_CASE_BRASS;
int color1 = SpentCasing.COLOR_CASE_BRASS; int color1 = SpentCasing.COLOR_CASE_BRASS;