diff --git a/src/main/java/com/hbm/inventory/container/ContainerWeaponTable.java b/src/main/java/com/hbm/inventory/container/ContainerWeaponTable.java index 4196b792c..d4528cac9 100644 --- a/src/main/java/com/hbm/inventory/container/ContainerWeaponTable.java +++ b/src/main/java/com/hbm/inventory/container/ContainerWeaponTable.java @@ -85,6 +85,7 @@ public class ContainerWeaponTable extends Container { public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) { if(mode == 999_999) { + if(player.worldObj.isRemote) return null; ItemStack stack = gun.getStackInSlot(0); if(stack != null && stack.getItem() instanceof ItemGunBaseNT) { int configs = ((ItemGunBaseNT) stack.getItem()).getConfigCount(); diff --git a/src/main/java/com/hbm/items/weapon/sedna/Receiver.java b/src/main/java/com/hbm/items/weapon/sedna/Receiver.java index b87515a1a..ab9b74f83 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/Receiver.java +++ b/src/main/java/com/hbm/items/weapon/sedna/Receiver.java @@ -23,7 +23,7 @@ public class Receiver { public static final String I_DELAYAFTERFIRE = "I_DELAYAFTERFIRE"; public static final String I_DELAYAFTERDRYFIRE = "I_DELAYAFTERDRYFIRE"; public static final String I_ROUNDSPERCYCLE = "I_ROUNDSPERCYCLE"; - public static final String F_SPRADINNATE = "F_SPRADINNATE"; + public static final String F_SPREADINNATE = "F_SPREADINNATE"; public static final String F_SPREADAMMO = "F_SPREADAMMO"; public static final String F_SPREADHIPFIRE = "F_SPREADHIPFIRE"; public static final String F_SPREADDURABILITY = "F_SPREADDURABILITY"; @@ -90,7 +90,7 @@ public class Receiver { public int getDelayAfterFire(ItemStack stack) { return WeaponModManager.eval(this.delayAfterFire_DNA, stack, I_DELAYAFTERFIRE, this, parent.index); } public int getDelayAfterDryFire(ItemStack stack) { return WeaponModManager.eval(this.delayAfterDryFire_DNA, stack, I_DELAYAFTERDRYFIRE, this, parent.index); } public int getRoundsPerCycle(ItemStack stack) { return WeaponModManager.eval(this.roundsPerCycle_DNA, stack, I_ROUNDSPERCYCLE, this, parent.index); } - public float getInnateSpread(ItemStack stack) { return WeaponModManager.eval(this.spreadInnate_DNA, stack, F_SPRADINNATE, this, parent.index); } + public float getInnateSpread(ItemStack stack) { return WeaponModManager.eval(this.spreadInnate_DNA, stack, F_SPREADINNATE, this, parent.index); } public float getAmmoSpread(ItemStack stack) { return WeaponModManager.eval(this.spreadMultAmmo_DNA, stack, F_SPREADAMMO, this, parent.index); } public float getHipfireSpread(ItemStack stack) { return WeaponModManager.eval(this.spreadPenaltyHipfire_DNA, stack, F_SPREADHIPFIRE, this, parent.index); } public float getDurabilitySpread(ItemStack stack) { return WeaponModManager.eval(this.spreadDurability_DNA, stack, F_SPREADDURABILITY, this, parent.index); } diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/Orchestras.java b/src/main/java/com/hbm/items/weapon/sedna/factory/Orchestras.java index 626338018..777748869 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/Orchestras.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/Orchestras.java @@ -9,6 +9,7 @@ import com.hbm.items.weapon.sedna.Receiver; import com.hbm.items.weapon.sedna.impl.ItemGunStinger; import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; import com.hbm.items.weapon.sedna.mags.IMagazine; +import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.lib.ModDamageSource; import com.hbm.main.MainRegistry; import com.hbm.packet.PacketDispatcher; @@ -922,7 +923,7 @@ public class Orchestras { SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory); if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, aiming ? 0.125 : 0.5, aiming ? -0.125 : -0.25, aiming ? -0.25 : -0.5D, 0, 0.18, -0.12, 0.01, (float)entity.getRNG().nextGaussian() * 15F, (float)entity.getRNG().nextGaussian() * 15F, casing.getName()); } - if(timer == 1) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverSpin", 1F, 0.75F); + if(timer == (WeaponModManager.hasUpgrade(stack, 0, 207) ? 3 : 1)) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverSpin", 1F, 0.75F); } if(type == AnimType.CYCLE_DRY) { if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 0.75F); @@ -1312,7 +1313,7 @@ public class Orchestras { if(entity.worldObj.isRemote) return; AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); - boolean aiming = ItemGunBaseNT.getIsAiming(stack); + boolean aiming = ItemGunBaseNT.getIsAiming(stack) && !WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SCOPE); if(type == AnimType.EQUIP) { if(timer == 10) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.openLatch", 1F, 1F); diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory44.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory44.java index 11bb0b7dc..2855016ec 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory44.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory44.java @@ -150,6 +150,7 @@ public class XFactory44 { public static BiConsumer SMACK_A_FUCKER = (stack, ctx) -> { if(ItemGunBaseNT.getState(stack, ctx.configIndex) == GunState.IDLE || ItemGunBaseNT.getLastAnim(stack, ctx.configIndex) == AnimType.CYCLE) { + ItemGunBaseNT.setIsAiming(stack, false); ItemGunBaseNT.setState(stack, ctx.configIndex, GunState.DRAWING); ItemGunBaseNT.setTimer(stack, ctx.configIndex, ctx.config.getInspectDuration(stack)); ItemGunBaseNT.playAnimation(ctx.getPlayer(), stack, AnimType.INSPECT, ctx.configIndex); diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/WeapnModG3SawedOff.java b/src/main/java/com/hbm/items/weapon/sedna/mods/WeapnModG3SawedOff.java new file mode 100644 index 000000000..ce7a202e6 --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/WeapnModG3SawedOff.java @@ -0,0 +1,33 @@ +package com.hbm.items.weapon.sedna.mods; + +import java.util.function.BiFunction; + +import com.hbm.items.weapon.sedna.GunConfig; +import com.hbm.items.weapon.sedna.factory.XFactory556mm; +import com.hbm.render.anim.BusAnimation; +import com.hbm.render.anim.BusAnimationSequence; +import com.hbm.render.anim.BusAnimationKeyframe.IType; +import com.hbm.render.anim.HbmAnimations.AnimType; + +import net.minecraft.item.ItemStack; + +public class WeapnModG3SawedOff extends WeaponModBase { + + public WeapnModG3SawedOff(int id) { + super(id, "SHIELD"); + } + + @Override + public T eval(T base, ItemStack gun, String key, Object parent) { + if(key == GunConfig.I_DRAWDURATION) return cast(5, base); + if(key == GunConfig.FUN_ANIMNATIONS) return (T) LAMBDA_G3_ANIMS; + return base; + } + + @SuppressWarnings("incomplete-switch") public static BiFunction LAMBDA_G3_ANIMS = (stack, type) -> { + switch(type) { + case EQUIP: return new BusAnimation().addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 250, IType.SIN_FULL)); + } + return XFactory556mm.LAMBDA_G3_ANIMS.apply(stack, type); + }; +} diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModChoke.java b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModChoke.java new file mode 100644 index 000000000..85820fa4a --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModChoke.java @@ -0,0 +1,19 @@ +package com.hbm.items.weapon.sedna.mods; + +import com.hbm.items.weapon.sedna.Receiver; + +import net.minecraft.item.ItemStack; + +public class WeaponModChoke extends WeaponModBase { + + public WeaponModChoke(int id) { + super(id, "BARREL"); + } + + @Override + public T eval(T base, ItemStack gun, String key, Object parent) { + if(key == Receiver.F_SPREADAMMO) { return cast((Float) base * 0.5F, base); } + + return base; + } +} diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModGreasegun.java b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModGreasegun.java new file mode 100644 index 000000000..60ffeff59 --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModGreasegun.java @@ -0,0 +1,50 @@ +package com.hbm.items.weapon.sedna.mods; + +import java.util.function.BiConsumer; + +import com.hbm.items.weapon.sedna.GunConfig; +import com.hbm.items.weapon.sedna.ItemGunBaseNT; +import com.hbm.items.weapon.sedna.Receiver; +import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; +import com.hbm.items.weapon.sedna.factory.Orchestras; +import com.hbm.particle.SpentCasing; +import com.hbm.particle.helper.CasingCreator; +import com.hbm.render.anim.HbmAnimations.AnimType; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; + +public class WeaponModGreasegun extends WeaponModBase { + + public WeaponModGreasegun(int id) { + super(id, "FURNITURE"); + this.setPriority(PRIORITY_ADDITIVE); + } + + @Override + public T eval(T base, ItemStack gun, String key, Object parent) { + if(key == GunConfig.F_DURABILITY) return cast((Float) base * 3F, base); + if(key == Receiver.F_BASEDAMAGE) return cast((Float) base + 2F, base); + if(key == Receiver.F_SPREADINNATE) return cast(0F, base); + if(key == Receiver.I_DELAYAFTERFIRE) return cast((Integer) base / 2, base); + if(key == GunConfig.CON_ORCHESTRA) return (T) ORCHESTRA_GREASEGUN; + return base; + } + + public static BiConsumer ORCHESTRA_GREASEGUN = (stack, ctx) -> { + EntityLivingBase entity = ctx.entity; + if(entity.worldObj.isRemote) return; + 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 == 1) { + 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, -7.5F + (float)entity.getRNG().nextGaussian() * 5F, 12F + (float)entity.getRNG().nextGaussian() * 5F, casing.getName()); + } + return; + } + Orchestras.ORCHESTRA_GREASEGUN.accept(stack, ctx); + }; +} diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModMASBayonet.java b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModMASBayonet.java new file mode 100644 index 000000000..74c14c653 --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModMASBayonet.java @@ -0,0 +1,78 @@ +package com.hbm.items.weapon.sedna.mods; + +import java.util.function.BiConsumer; +import java.util.function.BiFunction; + +import com.hbm.items.weapon.sedna.GunConfig; +import com.hbm.items.weapon.sedna.ItemGunBaseNT; +import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; +import com.hbm.items.weapon.sedna.factory.Orchestras; +import com.hbm.items.weapon.sedna.factory.XFactory44; +import com.hbm.items.weapon.sedna.factory.XFactory762mm; +import com.hbm.render.anim.BusAnimation; +import com.hbm.render.anim.BusAnimationSequence; +import com.hbm.render.anim.BusAnimationKeyframe.IType; +import com.hbm.render.anim.HbmAnimations.AnimType; +import com.hbm.util.EntityDamageUtil; + +import net.minecraft.block.Block; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MovingObjectPosition; + +public class WeaponModMASBayonet extends WeaponModBase { + + public WeaponModMASBayonet(int id) { + super(id, "BAYONET"); + } + + @Override + public T eval(T base, ItemStack gun, String key, Object parent) { + if(key == GunConfig.FUN_ANIMNATIONS) return (T) LAMBDA_MAS36_ANIMS; + if(key == GunConfig.I_INSPECTDURATION) return cast(30, base); + if(key == GunConfig.CON_ONPRESSSECONDARY) return (T) XFactory44.SMACK_A_FUCKER; + if(key == GunConfig.CON_ORCHESTRA) return (T) ORCHESTRA_MAS36; + if(key == GunConfig.I_INSPECTCANCEL) return cast(false, base); + return base; + } + + public static BiConsumer ORCHESTRA_MAS36 = (stack, ctx) -> { + EntityLivingBase entity = ctx.entity; + if(entity.worldObj.isRemote) return; + AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); + int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); + + if(type == AnimType.INSPECT) { + + if(timer == 15 && ctx.getPlayer() != null) { + MovingObjectPosition mop = EntityDamageUtil.getMouseOver(ctx.getPlayer(), 3.0D); + if(mop != null) { + if(mop.typeOfHit == mop.typeOfHit.ENTITY) { + float damage = 10F; + mop.entityHit.attackEntityFrom(DamageSource.causePlayerDamage(ctx.getPlayer()), damage); + mop.entityHit.motionX *= 2; + mop.entityHit.motionZ *= 2; + entity.worldObj.playSoundAtEntity(mop.entityHit, "hbm:weapon.fire.stab", 1F, 0.9F + entity.getRNG().nextFloat() * 0.2F); + } + if(mop.typeOfHit == mop.typeOfHit.BLOCK) { + Block b = entity.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ); + entity.worldObj.playSoundEffect(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, b.stepSound.getStepResourcePath(), 2F, 0.9F + entity.getRNG().nextFloat() * 0.2F); + } + } + } + return; + } + + Orchestras.ORCHESTRA_MAS36.accept(stack, ctx); + }; + + @SuppressWarnings("incomplete-switch") public static BiFunction LAMBDA_MAS36_ANIMS = (stack, type) -> { + switch(type) { + case INSPECT: return new BusAnimation() + .addBus("STAB", new BusAnimationSequence().addPos(0, 1, -2, 250, IType.SIN_DOWN).hold(250).addPos(0, 1, 5, 250, IType.SIN_UP).hold(250).addPos(0, 0, 0, 500, IType.SIN_FULL)); + } + + return XFactory762mm.LAMBDA_MAS36_ANIMS.apply(stack, type); + }; +} diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModManager.java b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModManager.java index 066b55969..0ddc74d47 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModManager.java +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModManager.java @@ -112,7 +112,32 @@ public class WeaponModManager { new WeaponModDefinition(EnumModGeneric.BRONZE_DURA).addMod(bronzeGuns, new WeaponModGenericDurability(117)); new WeaponModDefinition(EnumModSpecial.SPEEDLOADER).addMod(ModItems.gun_liberator, new WeaponModLiberatorSpeedloader(200)); + new WeaponModDefinition(EnumModSpecial.SILENCER).addMod(new Item[] {ModItems.gun_uzi, ModItems.gun_uzi_akimbo, ModItems.gun_g3}, new WeaponModSilencer(ID_SILENCER)); + new WeaponModDefinition(EnumModSpecial.SCOPE).addMod(new Item[] {ModItems.gun_heavy_revolver, ModItems.gun_g3, ModItems.gun_mas36}, new WeaponModScope(ID_SCOPE)); + new WeaponModDefinition(EnumModSpecial.SAW) + .addMod(new Item[] {ModItems.gun_maresleg, ModItems.gun_double_barrel}, new WeaponModSawedOff(ID_SAWED_OFF)) + .addMod(ModItems.gun_panzerschreck, new WeaponModPanzerschreckSawedOff(ID_NO_SHIELD)) + .addMod(ModItems.gun_g3, new WeapnModG3SawedOff(ID_NO_STOCK)); + new WeaponModDefinition(EnumModSpecial.GREASEGUN).addMod(ModItems.gun_greasegun, new WeaponModGreasegun(ID_GREASEGUN_CLEAN)); + new WeaponModDefinition(EnumModSpecial.SLOWDOWN).addMod(ModItems.gun_minigun, new WeaponModSlowdown(207)); + new WeaponModDefinition(EnumModSpecial.SPEEDUP) + .addMod(ModItems.gun_minigun, new WeaponModMinigunSpeedup(208)) + .addMod(new Item[] {ModItems.gun_autoshotgun, ModItems.gun_autoshotgun_shredder}, new WeaponModShredderSpeedup(209)); + new WeaponModDefinition(EnumModSpecial.CHOKE).addMod(new Item[] {ModItems.gun_pepperbox, ModItems.gun_maresleg, ModItems.gun_double_barrel, ModItems.gun_liberator, ModItems.gun_spas12}, new WeaponModChoke(210)); + new WeaponModDefinition(EnumModSpecial.FURNITURE_GREEN).addMod(ModItems.gun_g3, new WeaponModPolymerFurniture(ID_FURNITURE_GREEN)); + new WeaponModDefinition(EnumModSpecial.FURNITURE_BLACK).addMod(ModItems.gun_g3, new WeaponModPolymerFurniture(ID_FURNITURE_BLACK)); + new WeaponModDefinition(EnumModSpecial.BAYONET).addMod(ModItems.gun_mas36, new WeaponModMASBayonet(ID_MAS_BAYONET)); } + + public static final int ID_SILENCER = 201; + public static final int ID_SCOPE = 202; + public static final int ID_SAWED_OFF = 203; + public static final int ID_NO_SHIELD = 204; + public static final int ID_NO_STOCK = 205; + public static final int ID_GREASEGUN_CLEAN = 206; + public static final int ID_FURNITURE_GREEN = 211; + public static final int ID_FURNITURE_BLACK = 212; + public static final int ID_MAS_BAYONET = 213; public static ItemStack[] getUpgradeItems(ItemStack stack, int cfg) { if(!stack.hasTagCompound()) return new ItemStack[0]; @@ -129,6 +154,15 @@ public class WeaponModManager { return mods; } + public static boolean hasUpgrade(ItemStack stack, int cfg, int id) { + if(!stack.hasTagCompound()) return false; + int[] modIds = stack.stackTagCompound.getIntArray(KEY_MOD_LIST + cfg); + for(int i = 0; i < modIds.length; i++) { + if(modIds[i] == id) return true; + } + return false; + } + /** Installs the supplied mods to the gun */ public static void install(ItemStack stack, int cfg, ItemStack... mods) { List toInstall = new ArrayList(); diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModMinigunSpeedup.java b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModMinigunSpeedup.java new file mode 100644 index 000000000..131c4cb9a --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModMinigunSpeedup.java @@ -0,0 +1,19 @@ +package com.hbm.items.weapon.sedna.mods; + +import com.hbm.items.weapon.sedna.Receiver; + +import net.minecraft.item.ItemStack; + +public class WeaponModMinigunSpeedup extends WeaponModBase { + + public WeaponModMinigunSpeedup(int id) { + super(id, "SPEED"); + } + + @Override + public T eval(T base, ItemStack gun, String key, Object parent) { + if(key == Receiver.I_ROUNDSPERCYCLE) return cast((Integer) base * 3, base); + if(key == Receiver.F_SPREADINNATE) return cast((Float) base * 1.5F, base); + return base; + } +} diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModPanzerschreckSawedOff.java b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModPanzerschreckSawedOff.java new file mode 100644 index 000000000..7e45dfaa6 --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModPanzerschreckSawedOff.java @@ -0,0 +1,49 @@ +package com.hbm.items.weapon.sedna.mods; + +import java.util.function.BiConsumer; +import java.util.function.BiFunction; + +import com.hbm.extprop.HbmLivingProps; +import com.hbm.items.weapon.sedna.BulletConfig; +import com.hbm.items.weapon.sedna.GunConfig; +import com.hbm.items.weapon.sedna.Receiver; +import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; +import com.hbm.items.weapon.sedna.factory.Lego; +import com.hbm.items.weapon.sedna.factory.XFactoryRocket; +import com.hbm.render.anim.BusAnimation; +import com.hbm.render.anim.BusAnimationSequence; +import com.hbm.render.anim.BusAnimationKeyframe.IType; +import com.hbm.render.anim.HbmAnimations.AnimType; +import com.hbm.util.EntityDamageUtil; +import com.hbm.util.DamageResistanceHandler.DamageClass; + +import net.minecraft.item.ItemStack; + +public class WeaponModPanzerschreckSawedOff extends WeaponModBase { + + public WeaponModPanzerschreckSawedOff(int id) { + super(id, "SHIELD"); + } + + @Override + public T eval(T base, ItemStack gun, String key, Object parent) { + if(key == GunConfig.I_DRAWDURATION) return cast(5, base); + if(key == Receiver.CON_ONFIRE) { return (T) LAMBDA_FIRE; } + return base; + } + + @SuppressWarnings("incomplete-switch") public static BiFunction LAMBDA_PANZERSCHRECK_ANIMS = (stack, type) -> { + switch(type) { + case EQUIP: return new BusAnimation().addBus("EQUIP", new BusAnimationSequence().addPos(60, 0, 0, 0).addPos(0, 0, 0, 250, IType.SIN_DOWN)); + } + return XFactoryRocket.LAMBDA_PANZERSCHRECK_ANIMS.apply(stack, type); + }; + + public static BiConsumer LAMBDA_FIRE = (stack, ctx) -> { + Lego.LAMBDA_STANDARD_FIRE.accept(stack, ctx); + if(ctx.entity != null) { + HbmLivingProps.getData(ctx.entity).fire += 100; + EntityDamageUtil.attackEntityFromNT(ctx.entity, BulletConfig.getDamage(ctx.entity, ctx.entity, DamageClass.FIRE), 4F, true, false, 0F, 0F, 0F); + } + }; +} diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModPolymerFurniture.java b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModPolymerFurniture.java new file mode 100644 index 000000000..5961dfe2c --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModPolymerFurniture.java @@ -0,0 +1,27 @@ +package com.hbm.items.weapon.sedna.mods; + +import java.util.function.BiConsumer; + +import com.hbm.items.weapon.sedna.ItemGunBaseNT; +import com.hbm.items.weapon.sedna.Receiver; +import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; + +import net.minecraft.item.ItemStack; + +public class WeaponModPolymerFurniture extends WeaponModBase { + + public WeaponModPolymerFurniture(int id) { + super(id, "FURNITURE"); + } + + @Override + public T eval(T base, ItemStack gun, String key, Object parent) { + if(key == Receiver.CON_ONRECOIL) return (T) LAMBDA_RECOIL_G3; + return base; + } + + public static BiConsumer LAMBDA_RECOIL_G3 = (stack, ctx) -> { + ItemGunBaseNT.setupRecoil((float) (ctx.getPlayer().getRNG().nextGaussian() * 0.125), (float) (ctx.getPlayer().getRNG().nextGaussian() * 0.125)); + }; + +} diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModSawedOff.java b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModSawedOff.java new file mode 100644 index 000000000..95f9b5f23 --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModSawedOff.java @@ -0,0 +1,30 @@ +package com.hbm.items.weapon.sedna.mods; + +import com.hbm.items.ModItems; +import com.hbm.items.weapon.sedna.GunConfig; +import com.hbm.items.weapon.sedna.Receiver; +import com.hbm.items.weapon.sedna.factory.XFactory12ga; + +import net.minecraft.item.ItemStack; + +public class WeaponModSawedOff extends WeaponModBase { + + public WeaponModSawedOff(int id) { + super(id, "BARREL"); + } + + @Override + public T eval(T base, ItemStack gun, String key, Object parent) { + + if(key == Receiver.F_SPREADINNATE) { return cast(Math.max(0.025F, (Float) base), base); } + if(key == Receiver.F_SPREADAMMO) { return cast((Float) base * 1.5F, base); } + if(key == Receiver.F_BASEDAMAGE) { return cast((Float) base * 1.35F, base); } + + if(gun.getItem() == ModItems.gun_maresleg) { + if(key == GunConfig.FUN_ANIMNATIONS) return (T) XFactory12ga.LAMBDA_MARESLEG_SHORT_ANIMS; + if(key == GunConfig.I_DRAWDURATION) return cast(5, base); + } + + return base; + } +} diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModScope.java b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModScope.java new file mode 100644 index 000000000..e9e0abcbb --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModScope.java @@ -0,0 +1,23 @@ +package com.hbm.items.weapon.sedna.mods; + +import com.hbm.items.weapon.sedna.GunConfig; +import com.hbm.items.weapon.sedna.factory.XFactory44; + +import net.minecraft.item.ItemStack; + +public class WeaponModScope extends WeaponModBase { + + public WeaponModScope(int id) { + super(id, "SCOPE"); + } + + @Override + public T eval(T base, ItemStack gun, String key, Object parent) { + + if(key == GunConfig.O_SCOPETEXTURE) { + return (T) XFactory44.scope_lilmac; + } + + return base; + } +} diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModShredderSpeedup.java b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModShredderSpeedup.java new file mode 100644 index 000000000..fd34cb64b --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModShredderSpeedup.java @@ -0,0 +1,19 @@ +package com.hbm.items.weapon.sedna.mods; + +import com.hbm.items.weapon.sedna.Receiver; + +import net.minecraft.item.ItemStack; + +public class WeaponModShredderSpeedup extends WeaponModBase { + + public WeaponModShredderSpeedup(int id) { + super(id, "SPEED"); + } + + @Override + public T eval(T base, ItemStack gun, String key, Object parent) { + if(key == Receiver.I_DELAYAFTERFIRE) return cast((Integer) base / 2, base); + if(key == Receiver.I_DELAYAFTERDRYFIRE) return cast((Integer) base / 2, base); + return base; + } +} diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModSilencer.java b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModSilencer.java new file mode 100644 index 000000000..49c413883 --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModSilencer.java @@ -0,0 +1,22 @@ +package com.hbm.items.weapon.sedna.mods; + +import com.hbm.items.weapon.sedna.Receiver; + +import net.minecraft.item.ItemStack; + +public class WeaponModSilencer extends WeaponModBase { + + public WeaponModSilencer(int id) { + super(id, "SILENCER"); + } + + @Override + public T eval(T base, ItemStack gun, String key, Object parent) { + + if(key == Receiver.S_FIRESOUND) { + return (T) "hbm:weapon.fire.silenced"; + } + + return base; + } +} diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModSlowdown.java b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModSlowdown.java new file mode 100644 index 000000000..bb1919dd7 --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModSlowdown.java @@ -0,0 +1,19 @@ +package com.hbm.items.weapon.sedna.mods; + +import com.hbm.items.weapon.sedna.Receiver; + +import net.minecraft.item.ItemStack; + +public class WeaponModSlowdown extends WeaponModBase { + + public WeaponModSlowdown(int id) { + super(id, "SPEED"); + } + + @Override + public T eval(T base, ItemStack gun, String key, Object parent) { + if(key == Receiver.I_DELAYAFTERFIRE) return cast((Integer) base * 2, base); + if(key == Receiver.F_SPREADINNATE) return cast(0F, base); + return base; + } +} diff --git a/src/main/java/com/hbm/main/ResourceManager.java b/src/main/java/com/hbm/main/ResourceManager.java index d0829625e..3b90bdf37 100644 --- a/src/main/java/com/hbm/main/ResourceManager.java +++ b/src/main/java/com/hbm/main/ResourceManager.java @@ -942,6 +942,7 @@ public class ResourceManager { public static final ResourceLocation henry_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/henry.png"); public static final ResourceLocation henry_lincoln_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/henry_lincoln.png"); public static final ResourceLocation greasegun_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/greasegun.png"); + public static final ResourceLocation greasegun_clean_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/greasegun_clean.png"); public static final ResourceLocation maresleg_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/maresleg.png"); public static final ResourceLocation maresleg_broken_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/maresleg_broken.png"); public static final ResourceLocation flaregun_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/flaregun.png"); @@ -959,6 +960,8 @@ public class ResourceManager { public static final ResourceLocation uzi_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/uzi.png"); public static final ResourceLocation panzerschreck_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/panzerschreck.png"); public static final ResourceLocation g3_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/g3.png"); + public static final ResourceLocation g3_green_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/g3_polymer_green.png"); + public static final ResourceLocation g3_black_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/g3_polymer_black.png"); public static final ResourceLocation shredder_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/shredder.png"); public static final ResourceLocation shredder_orig_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/shredder_orig.png"); public static final ResourceLocation sexy_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/sexy.png"); diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderDoubleBarrel.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderDoubleBarrel.java index 1b5612bc4..1102a81c6 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderDoubleBarrel.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderDoubleBarrel.java @@ -4,6 +4,7 @@ import org.lwjgl.opengl.GL11; import com.hbm.items.ModItems; import com.hbm.items.weapon.sedna.ItemGunBaseNT; +import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.main.ResourceManager; import com.hbm.render.anim.HbmAnimations; @@ -172,6 +173,6 @@ public class ItemRenderDoubleBarrel extends ItemRenderWeaponBase { } public boolean isSawedOff(ItemStack stack) { - return stack.getItem() == ModItems.gun_double_barrel_sacred_dragon; + return stack.getItem() == ModItems.gun_double_barrel_sacred_dragon || WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SAWED_OFF); } } diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderG3.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderG3.java index e5e34b83d..c68b2c560 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderG3.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderG3.java @@ -3,11 +3,13 @@ package com.hbm.render.item.weapon.sedna; import org.lwjgl.opengl.GL11; import com.hbm.items.weapon.sedna.ItemGunBaseNT; +import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.main.ResourceManager; import com.hbm.render.anim.HbmAnimations; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; public class ItemRenderG3 extends ItemRenderWeaponBase { @@ -34,7 +36,7 @@ public class ItemRenderG3 extends ItemRenderWeaponBase { public void renderFirstPerson(ItemStack stack) { ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); - Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.g3_tex); + Minecraft.getMinecraft().renderEngine.bindTexture(getTexture(stack)); double scale = 0.375D; GL11.glScaled(scale, scale, scale); @@ -60,7 +62,7 @@ public class ItemRenderG3 extends ItemRenderWeaponBase { GL11.glShadeModel(GL11.GL_SMOOTH); ResourceManager.g3.renderPart("Rifle"); - ResourceManager.g3.renderPart("Stock"); + if(hasStock(stack)) ResourceManager.g3.renderPart("Stock"); ResourceManager.g3.renderPart("Flash_Hider"); ResourceManager.g3.renderPart("Trigger_Rifle.002"); @@ -122,11 +124,19 @@ public class ItemRenderG3 extends ItemRenderWeaponBase { @Override public void setupInv(ItemStack stack) { super.setupInv(stack); - double scale = 0.875D; - GL11.glScaled(scale, scale, scale); - GL11.glRotated(25, 1, 0, 0); - GL11.glRotated(45, 0, 1, 0); - GL11.glTranslated(-0.5, 0.5, 0); + if(hasStock(stack)) { + double scale = 0.875D; + GL11.glScaled(scale, scale, scale); + GL11.glRotated(25, 1, 0, 0); + GL11.glRotated(45, 0, 1, 0); + GL11.glTranslated(-0.5, 0.5, 0); + } else { + double scale = 1.125D; + GL11.glScaled(scale, scale, scale); + GL11.glRotated(25, 1, 0, 0); + GL11.glRotated(45, 0, 1, 0); + GL11.glTranslated(2.5, 0.5, 0); + } } @Override @@ -142,9 +152,9 @@ public class ItemRenderG3 extends ItemRenderWeaponBase { GL11.glEnable(GL11.GL_LIGHTING); GL11.glShadeModel(GL11.GL_SMOOTH); - Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.g3_tex); + Minecraft.getMinecraft().renderEngine.bindTexture(getTexture(stack)); ResourceManager.g3.renderPart("Rifle"); - ResourceManager.g3.renderPart("Stock"); + if(hasStock(stack)) ResourceManager.g3.renderPart("Stock"); ResourceManager.g3.renderPart("Magazine"); ResourceManager.g3.renderPart("Flash_Hider"); ResourceManager.g3.renderPart("Bolt"); @@ -159,4 +169,14 @@ public class ItemRenderG3 extends ItemRenderWeaponBase { GL11.glPopMatrix(); GL11.glShadeModel(GL11.GL_FLAT); } + + public boolean hasStock(ItemStack stack) { + return !WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_NO_STOCK); + } + + public ResourceLocation getTexture(ItemStack stack) { + if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_FURNITURE_GREEN)) return ResourceManager.g3_green_tex; + if(WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_FURNITURE_BLACK)) return ResourceManager.g3_black_tex; + return ResourceManager.g3_tex; + } } diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderGreasegun.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderGreasegun.java index cc488ab5f..dbbe9a7c9 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderGreasegun.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderGreasegun.java @@ -3,6 +3,7 @@ package com.hbm.render.item.weapon.sedna; import org.lwjgl.opengl.GL11; import com.hbm.items.weapon.sedna.ItemGunBaseNT; +import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.main.ResourceManager; import com.hbm.render.anim.HbmAnimations; @@ -34,7 +35,7 @@ public class ItemRenderGreasegun extends ItemRenderWeaponBase { public void renderFirstPerson(ItemStack stack) { ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); - Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.greasegun_tex); + Minecraft.getMinecraft().renderEngine.bindTexture(isRefurbished(stack) ? ResourceManager.greasegun_clean_tex : ResourceManager.greasegun_tex); double scale = 0.375D; GL11.glScaled(scale, scale, scale); @@ -146,8 +147,12 @@ public class ItemRenderGreasegun extends ItemRenderWeaponBase { GL11.glEnable(GL11.GL_LIGHTING); GL11.glShadeModel(GL11.GL_SMOOTH); - Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.greasegun_tex); + Minecraft.getMinecraft().renderEngine.bindTexture(isRefurbished(stack) ? ResourceManager.greasegun_clean_tex : ResourceManager.greasegun_tex); ResourceManager.greasegun.renderAll(); GL11.glShadeModel(GL11.GL_FLAT); } + + public boolean isRefurbished(ItemStack stack) { + return WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_GREASEGUN_CLEAN); + } } diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderHeavyRevolver.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderHeavyRevolver.java index 55020e68b..2cf24c68e 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderHeavyRevolver.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderHeavyRevolver.java @@ -4,6 +4,7 @@ import org.lwjgl.opengl.GL11; import com.hbm.items.ModItems; import com.hbm.items.weapon.sedna.ItemGunBaseNT; +import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.main.ResourceManager; import com.hbm.render.anim.HbmAnimations; @@ -116,12 +117,6 @@ public class ItemRenderHeavyRevolver extends ItemRenderWeaponBase { GL11.glTranslated(0.125, 2.5, 0); this.renderGapFlash(gun.lastShot[0]); GL11.glPopMatrix(); - - GL11.glPushMatrix(); - GL11.glTranslated(-9.5, 2.5, 0); - GL11.glRotated(90 * gun.shotRand, 1, 0, 0); - //this.renderMuzzleFlash(gun.lastShot); - GL11.glPopMatrix(); } @Override @@ -181,6 +176,6 @@ public class ItemRenderHeavyRevolver extends ItemRenderWeaponBase { } public boolean isScoped(ItemStack stack) { - return stack.getItem() == ModItems.gun_heavy_revolver_lilmac; + return stack.getItem() == ModItems.gun_heavy_revolver_lilmac || WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SCOPE); } } diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderMAS36.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderMAS36.java index 5ff2805ca..b43620e10 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderMAS36.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderMAS36.java @@ -5,6 +5,7 @@ import java.nio.DoubleBuffer; import org.lwjgl.opengl.GL11; import com.hbm.items.weapon.sedna.ItemGunBaseNT; +import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.main.ResourceManager; import com.hbm.render.anim.HbmAnimations; @@ -20,7 +21,7 @@ public class ItemRenderMAS36 extends ItemRenderWeaponBase { @Override public float getViewFOV(ItemStack stack, float fov) { float aimingProgress = ItemGunBaseNT.prevAimingProgress + (ItemGunBaseNT.aimingProgress - ItemGunBaseNT.prevAimingProgress) * interp; - return fov * (1 - aimingProgress * 0.33F); + return fov * (1 - aimingProgress * (isScoped(stack) ? 0.66F : 0.33F)); } @Override @@ -28,18 +29,24 @@ public class ItemRenderMAS36 extends ItemRenderWeaponBase { GL11.glTranslated(0, 0, 0.875); float offset = 0.8F; - standardAimingTransform(stack, + + if(isScoped(stack)) { + standardAimingTransform(stack, -1.5F * offset, -1.25F * offset, 1.75F * offset, - 0, -4.6825 / 8D, 0.75); - /*standardAimingTransform(stack, - -1.5F * offset, -1.25F * offset, 1.75F * offset, - -0.2, -5.875 / 8D, 1.125);*/ + -0.2, -5.875 / 8D, 1.125); + } else { + standardAimingTransform(stack, + -1.5F * offset, -1.25F * offset, 1.75F * offset, + 0, -4.6825 / 8D, 0.75); + } } private static DoubleBuffer buf = null; @Override public void renderFirstPerson(ItemStack stack) { + boolean isScoped = isScoped(stack); + if(isScoped && ItemGunBaseNT.prevAimingProgress == 1 && ItemGunBaseNT.aimingProgress == 1) return; if(buf == null) buf = GLAllocation.createDirectByteBuffer(8*4).asDoubleBuffer(); ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); @@ -57,16 +64,20 @@ public class ItemRenderMAS36 extends ItemRenderWeaponBase { double[] showClip = HbmAnimations.getRelevantTransformation("SHOW_CLIP"); double[] clip = HbmAnimations.getRelevantTransformation("CLIP"); double[] bullets = HbmAnimations.getRelevantTransformation("BULLETS"); + double[] stab = HbmAnimations.getRelevantTransformation("STAB"); GL11.glTranslated(0, -3, -3); GL11.glRotated(equip[0], 1, 0, 0); GL11.glRotated(lift[0], 1, 0, 0); GL11.glTranslated(0, 3, 3); + + GL11.glTranslated(stab[0], stab[1], stab[2]); GL11.glTranslated(0, 0, recoil[2]); GL11.glShadeModel(GL11.GL_SMOOTH); ResourceManager.mas36.renderPart("Gun"); + if(hasBayonet(stack)) ResourceManager.mas36.renderPart("Bayonet"); GL11.glPushMatrix(); GL11.glTranslated(0, 0.3125, -2.125); @@ -88,7 +99,7 @@ public class ItemRenderMAS36 extends ItemRenderWeaponBase { ResourceManager.mas36.renderPart("Bullet"); GL11.glPopMatrix(); - //ResourceManager.mas36.renderPart("Scope"); + if(isScoped) ResourceManager.mas36.renderPart("Scope"); if(showClip[0] != 0) { GL11.glPushMatrix(); @@ -161,8 +172,8 @@ public class ItemRenderMAS36 extends ItemRenderWeaponBase { ResourceManager.mas36.renderPart("Gun"); ResourceManager.mas36.renderPart("Stock"); ResourceManager.mas36.renderPart("Bolt"); - //ResourceManager.mas36.renderPart("Scope"); - //ResourceManager.mas36.renderPart("Bayonet"); + if(isScoped(stack)) ResourceManager.mas36.renderPart("Scope"); + if(hasBayonet(stack)) ResourceManager.mas36.renderPart("Bayonet"); GL11.glShadeModel(GL11.GL_FLAT); } @@ -175,9 +186,17 @@ public class ItemRenderMAS36 extends ItemRenderWeaponBase { ResourceManager.mas36.renderPart("Gun"); ResourceManager.mas36.renderPart("Stock"); ResourceManager.mas36.renderPart("Bolt"); - //ResourceManager.mas36.renderPart("Scope"); + if(isScoped(stack)) ResourceManager.mas36.renderPart("Scope"); GL11.glTranslated(0, -1, -6); - //ResourceManager.mas36.renderPart("Bayonet"); + if(hasBayonet(stack)) ResourceManager.mas36.renderPart("Bayonet"); GL11.glShadeModel(GL11.GL_FLAT); } + + public boolean isScoped(ItemStack stack) { + return WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SCOPE); + } + + public boolean hasBayonet(ItemStack stack) { + return WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_MAS_BAYONET); + } } diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderMaresleg.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderMaresleg.java index e8dfaa091..c6de5ba6c 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderMaresleg.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderMaresleg.java @@ -4,6 +4,7 @@ import org.lwjgl.opengl.GL11; import com.hbm.items.ModItems; import com.hbm.items.weapon.sedna.ItemGunBaseNT; +import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.main.ResourceManager; import com.hbm.render.anim.HbmAnimations; @@ -170,6 +171,6 @@ public class ItemRenderMaresleg extends ItemRenderWeaponBase { } public boolean getShort(ItemStack stack) { - return stack.getItem() == ModItems.gun_maresleg_broken; + return stack.getItem() == ModItems.gun_maresleg_broken || WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_SAWED_OFF); } } diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderPanzerschreck.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderPanzerschreck.java index 6ad4374c6..4d65f4323 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderPanzerschreck.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderPanzerschreck.java @@ -3,6 +3,7 @@ package com.hbm.render.item.weapon.sedna; import org.lwjgl.opengl.GL11; import com.hbm.items.weapon.sedna.ItemGunBaseNT; +import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.main.ResourceManager; import com.hbm.render.anim.HbmAnimations; @@ -53,7 +54,7 @@ public class ItemRenderPanzerschreck extends ItemRenderWeaponBase { GL11.glShadeModel(GL11.GL_SMOOTH); ResourceManager.panzerschreck.renderPart("Tube"); - ResourceManager.panzerschreck.renderPart("Shield"); + if(hasShield(stack)) ResourceManager.panzerschreck.renderPart("Shield"); GL11.glPushMatrix(); GL11.glTranslated(rocket[0], rocket[1], rocket[2]); @@ -104,7 +105,11 @@ public class ItemRenderPanzerschreck extends ItemRenderWeaponBase { GL11.glShadeModel(GL11.GL_SMOOTH); Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.panzerschreck_tex); ResourceManager.panzerschreck.renderPart("Tube"); - ResourceManager.panzerschreck.renderPart("Shield"); + if(hasShield(stack)) ResourceManager.panzerschreck.renderPart("Shield"); GL11.glShadeModel(GL11.GL_FLAT); } + + public boolean hasShield(ItemStack stack) { + return !WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_NO_SHIELD); + } } diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderUzi.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderUzi.java index d2bcd93ae..4752e9443 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderUzi.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderUzi.java @@ -3,6 +3,7 @@ package com.hbm.render.item.weapon.sedna; import org.lwjgl.opengl.GL11; import com.hbm.items.weapon.sedna.ItemGunBaseNT; +import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.main.ResourceManager; import com.hbm.render.anim.HbmAnimations; @@ -65,6 +66,9 @@ public class ItemRenderUzi extends ItemRenderWeaponBase { GL11.glShadeModel(GL11.GL_SMOOTH); ResourceManager.uzi.renderPart("Gun"); + boolean silenced = hasSilencer(stack, 0); + if(silenced) ResourceManager.uzi.renderPart("Silencer"); + GL11.glPushMatrix(); GL11.glTranslated(0, 0.3125D, -5.75); GL11.glRotated(180 - stockFront[0], 1, 0, 0); @@ -88,23 +92,25 @@ public class ItemRenderUzi extends ItemRenderWeaponBase { if(bullet[0] == 1) ResourceManager.uzi.renderPart("Bullet"); GL11.glPopMatrix(); - double smokeScale = 0.5; - - GL11.glPushMatrix(); - GL11.glTranslated(0, 0.75, 8.5); - GL11.glRotated(90, 0, 1, 0); - GL11.glScaled(smokeScale, smokeScale, smokeScale); - this.renderSmokeNodes(gun.getConfig(stack, 0).smokeNodes, 0.75D); - GL11.glPopMatrix(); - - GL11.glShadeModel(GL11.GL_FLAT); - - GL11.glPushMatrix(); - GL11.glTranslated(0, 0.75, 8.5); - GL11.glRotated(90, 0, 1, 0); - GL11.glRotated(90 * gun.shotRand, 1, 0, 0); - this.renderMuzzleFlash(gun.lastShot[0], 75, 7.5); - GL11.glPopMatrix(); + if(!silenced) { + double smokeScale = 0.5; + + GL11.glPushMatrix(); + GL11.glTranslated(0, 0.75, 8.5); + GL11.glRotated(90, 0, 1, 0); + GL11.glScaled(smokeScale, smokeScale, smokeScale); + this.renderSmokeNodes(gun.getConfig(stack, 0).smokeNodes, 0.75D); + GL11.glPopMatrix(); + + GL11.glShadeModel(GL11.GL_FLAT); + + GL11.glPushMatrix(); + GL11.glTranslated(0, 0.75, 8.5); + GL11.glRotated(90, 0, 1, 0); + GL11.glRotated(90 * gun.shotRand, 1, 0, 0); + this.renderMuzzleFlash(gun.lastShot[0], 75, 7.5); + GL11.glPopMatrix(); + } } @Override @@ -133,7 +139,7 @@ public class ItemRenderUzi extends ItemRenderWeaponBase { } @Override - public void renderOther(ItemStack stack, ItemRenderType type) { + public void renderModTable(ItemStack stack, int index) { GL11.glEnable(GL11.GL_LIGHTING); GL11.glShadeModel(GL11.GL_SMOOTH); @@ -143,6 +149,34 @@ public class ItemRenderUzi extends ItemRenderWeaponBase { ResourceManager.uzi.renderPart("StockFront"); ResourceManager.uzi.renderPart("Slide"); ResourceManager.uzi.renderPart("Magazine"); + if(hasSilencer(stack, index)) ResourceManager.uzi.renderPart("Silencer"); GL11.glShadeModel(GL11.GL_FLAT); } + + @Override + public void renderOther(ItemStack stack, ItemRenderType type) { + GL11.glEnable(GL11.GL_LIGHTING); + + boolean silenced = hasSilencer(stack, 0); + + if(silenced) { + double scale = 0.625D; + GL11.glScaled(scale, scale, scale); + GL11.glTranslated(0, 0, -4); + } + + GL11.glShadeModel(GL11.GL_SMOOTH); + Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex); + ResourceManager.uzi.renderPart("Gun"); + ResourceManager.uzi.renderPart("StockBack"); + ResourceManager.uzi.renderPart("StockFront"); + ResourceManager.uzi.renderPart("Slide"); + ResourceManager.uzi.renderPart("Magazine"); + if(silenced) ResourceManager.uzi.renderPart("Silencer"); + GL11.glShadeModel(GL11.GL_FLAT); + } + + public boolean hasSilencer(ItemStack stack, int cfg) { + return WeaponModManager.hasUpgrade(stack, cfg, WeaponModManager.ID_SILENCER); + } } diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderUziAkimbo.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderUziAkimbo.java index fa98585e3..68ab84b23 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderUziAkimbo.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderUziAkimbo.java @@ -3,6 +3,7 @@ package com.hbm.render.item.weapon.sedna; import org.lwjgl.opengl.GL11; import com.hbm.items.weapon.sedna.ItemGunBaseNT; +import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.main.ResourceManager; import com.hbm.render.anim.HbmAnimations; @@ -56,7 +57,7 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase { double[] speen = HbmAnimations.getRelevantTransformation("SPEEN", index); GL11.glTranslated(yeet[0], yeet[1], yeet[2]); - GL11.glRotated(speen[0], 0, 0, 1); + GL11.glRotated(speen[0], 0, 0, i); GL11.glTranslated(0, -2, -4); GL11.glRotated(equip[0], 1, 0, 0); @@ -70,6 +71,9 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase { GL11.glShadeModel(GL11.GL_SMOOTH); ResourceManager.uzi.renderPart(index == 0 ? "GunMirror" : "Gun"); + + boolean silenced = hasSilencer(stack, index); + if(silenced) ResourceManager.uzi.renderPart("Silencer"); GL11.glPushMatrix(); GL11.glTranslated(0, 0.3125D, -5.75); @@ -93,24 +97,26 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase { ResourceManager.uzi.renderPart("Magazine"); if(bullet[0] == 1) ResourceManager.uzi.renderPart("Bullet"); GL11.glPopMatrix(); - - double smokeScale = 0.5; - GL11.glPushMatrix(); - GL11.glTranslated(0, 0.75, 8.5); - GL11.glRotated(90, 0, 1, 0); - GL11.glScaled(smokeScale, smokeScale, smokeScale); - this.renderSmokeNodes(gun.getConfig(stack, index).smokeNodes, 0.75D); - GL11.glPopMatrix(); - - GL11.glShadeModel(GL11.GL_FLAT); - - GL11.glPushMatrix(); - GL11.glTranslated(0, 0.75, 8.5); - GL11.glRotated(90, 0, 1, 0); - GL11.glRotated(90 * gun.shotRand, 1, 0, 0); - this.renderMuzzleFlash(gun.lastShot[index], 75, 7.5); - GL11.glPopMatrix(); + if(!silenced) { + double smokeScale = 0.5; + + GL11.glPushMatrix(); + GL11.glTranslated(0, 0.75, 8.5); + GL11.glRotated(90, 0, 1, 0); + GL11.glScaled(smokeScale, smokeScale, smokeScale); + this.renderSmokeNodes(gun.getConfig(stack, index).smokeNodes, 0.75D); + GL11.glPopMatrix(); + + GL11.glShadeModel(GL11.GL_FLAT); + + GL11.glPushMatrix(); + GL11.glTranslated(0, 0.75, 8.5); + GL11.glRotated(90, 0, 1, 0); + GL11.glRotated(90 * gun.shotRand, 1, 0, 0); + this.renderMuzzleFlash(gun.lastShot[index], 75, 7.5); + GL11.glPopMatrix(); + } GL11.glPopMatrix(); } @@ -156,6 +162,7 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase { ResourceManager.uzi.renderPart("StockFront"); ResourceManager.uzi.renderPart("Slide"); ResourceManager.uzi.renderPart("Magazine"); + if(hasSilencer(stack, 1)) ResourceManager.uzi.renderPart("Silencer"); GL11.glShadeModel(GL11.GL_FLAT); } @@ -169,6 +176,7 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase { ResourceManager.uzi.renderPart("StockFront"); ResourceManager.uzi.renderPart("Slide"); ResourceManager.uzi.renderPart("Magazine"); + if(hasSilencer(stack, 0)) ResourceManager.uzi.renderPart("Silencer"); GL11.glShadeModel(GL11.GL_FLAT); } @@ -178,11 +186,12 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase { GL11.glShadeModel(GL11.GL_SMOOTH); Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex); - ResourceManager.uzi.renderPart(index == 1 ? "GunMirror" : "Gun"); + ResourceManager.uzi.renderPart(index == 0 ? "GunMirror" : "Gun"); ResourceManager.uzi.renderPart("StockBack"); ResourceManager.uzi.renderPart("StockFront"); ResourceManager.uzi.renderPart("Slide"); ResourceManager.uzi.renderPart("Magazine"); + if(hasSilencer(stack, index)) ResourceManager.uzi.renderPart("Silencer"); GL11.glShadeModel(GL11.GL_FLAT); } @@ -191,6 +200,10 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase { GL11.glEnable(GL11.GL_LIGHTING); GL11.glShadeModel(GL11.GL_SMOOTH); Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex); + + boolean silencer0 = hasSilencer(stack, 1); + boolean silencer1 = hasSilencer(stack, 0); + boolean anySilenced = silencer0 || silencer1; GL11.glPushMatrix(); GL11.glRotated(225, 0, 0, 1); @@ -198,11 +211,17 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase { GL11.glRotated(25, 1, 0, 0); GL11.glRotated(45, 0, 1, 0); GL11.glTranslated(0, 1, 0); + if(anySilenced) { + double scale = 0.625D; + GL11.glScaled(scale, scale, scale); + GL11.glTranslated(0, 0, -4); + } ResourceManager.uzi.renderPart("Gun"); ResourceManager.uzi.renderPart("StockBack"); ResourceManager.uzi.renderPart("StockFront"); ResourceManager.uzi.renderPart("Slide"); ResourceManager.uzi.renderPart("Magazine"); + if(silencer0) ResourceManager.uzi.renderPart("Silencer"); GL11.glPopMatrix(); GL11.glTranslated(0, 0, 5); @@ -214,13 +233,23 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase { GL11.glRotated(25, 1, 0, 0); GL11.glRotated(-45, 0, 1, 0); GL11.glTranslated(0, 1, 0); + if(anySilenced) { + double scale = 0.625D; + GL11.glScaled(scale, scale, scale); + GL11.glTranslated(0, 0, -4); + } ResourceManager.uzi.renderPart("GunMirror"); ResourceManager.uzi.renderPart("StockBack"); ResourceManager.uzi.renderPart("StockFront"); ResourceManager.uzi.renderPart("Slide"); ResourceManager.uzi.renderPart("Magazine"); + if(silencer1) ResourceManager.uzi.renderPart("Silencer"); GL11.glPopMatrix(); GL11.glShadeModel(GL11.GL_FLAT); } + + public boolean hasSilencer(ItemStack stack, int cfg) { + return WeaponModManager.hasUpgrade(stack, cfg, WeaponModManager.ID_SILENCER); + } } diff --git a/src/main/resources/assets/hbm/sounds/weapon/fire/stab1.ogg b/src/main/resources/assets/hbm/sounds/weapon/fire/stab1.ogg new file mode 100644 index 000000000..da9f6bcc3 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/fire/stab1.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/fire/stab2.ogg b/src/main/resources/assets/hbm/sounds/weapon/fire/stab2.ogg new file mode 100644 index 000000000..03f51118b Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/fire/stab2.ogg differ diff --git a/src/main/resources/assets/hbm/textures/models/weapons/g3_polymer.png b/src/main/resources/assets/hbm/textures/models/weapons/g3_polymer_green.png similarity index 100% rename from src/main/resources/assets/hbm/textures/models/weapons/g3_polymer.png rename to src/main/resources/assets/hbm/textures/models/weapons/g3_polymer_green.png diff --git a/src/main/resources/assets/hbm/textures/models/weapons/uzi.png b/src/main/resources/assets/hbm/textures/models/weapons/uzi.png index ad691a7e9..0afe8123d 100644 Binary files a/src/main/resources/assets/hbm/textures/models/weapons/uzi.png and b/src/main/resources/assets/hbm/textures/models/weapons/uzi.png differ