diff --git a/src/main/java/com/hbm/entity/projectile/EntityBulletBaseMK4.java b/src/main/java/com/hbm/entity/projectile/EntityBulletBaseMK4.java index 8491176be..7eba8ed07 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityBulletBaseMK4.java +++ b/src/main/java/com/hbm/entity/projectile/EntityBulletBaseMK4.java @@ -1,8 +1,13 @@ package com.hbm.entity.projectile; import com.hbm.items.weapon.sedna.BulletConfig; +import com.hbm.lib.ModDamageSource; +import com.hbm.packet.PacketDispatcher; +import com.hbm.packet.toclient.AuxParticlePacketNT; +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; @@ -88,7 +93,21 @@ public class EntityBulletBaseMK4 extends EntityThrowableInterp { @Override protected void onImpact(MovingObjectPosition mop) { if(!worldObj.isRemote) { + if(mop.typeOfHit == mop.typeOfHit.ENTITY && !mop.entityHit.isEntityAlive()) return; + this.setDead(); + + if(mop.typeOfHit == mop.typeOfHit.ENTITY && mop.entityHit.isEntityAlive()) { + mop.entityHit.attackEntityFrom(ModDamageSource.turbofan, 1_000F); + + NBTTagCompound vdat = new NBTTagCompound(); + vdat.setString("type", "giblets"); + vdat.setInteger("ent", mop.entityHit.getEntityId()); + vdat.setInteger("cDiv", 2); + PacketDispatcher.wrapper.sendToAllAround( + new AuxParticlePacketNT(vdat, mop.entityHit.posX, mop.entityHit.posY + mop.entityHit.height * 0.5, mop.entityHit.posZ), + new TargetPoint(this.dimension, mop.entityHit.posX, mop.entityHit.posY + mop.entityHit.height * 0.5, mop.entityHit.posZ, 150)); + } } } diff --git a/src/main/java/com/hbm/items/weapon/sedna/BulletConfig.java b/src/main/java/com/hbm/items/weapon/sedna/BulletConfig.java index b3651a976..578770787 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/BulletConfig.java +++ b/src/main/java/com/hbm/items/weapon/sedna/BulletConfig.java @@ -17,7 +17,7 @@ public class BulletConfig { public ComparableStack ammo; public int ammoReloadCount = 1; - public float velocity = 5F; + public float velocity = 10F; public float spread = 0F; public float wear = 1F; public int projectilesMin = 1; diff --git a/src/main/java/com/hbm/items/weapon/sedna/GunConfig.java b/src/main/java/com/hbm/items/weapon/sedna/GunConfig.java index e0388871c..eeeaee080 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/GunConfig.java +++ b/src/main/java/com/hbm/items/weapon/sedna/GunConfig.java @@ -4,6 +4,7 @@ import java.util.function.BiConsumer; import java.util.function.BiFunction; import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; +import com.hbm.items.weapon.sedna.hud.IHUDComponent; import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.HbmAnimations.AnimType; @@ -20,8 +21,11 @@ public class GunConfig { public static final String O_RECEIVERS = "O_RECEIVERS"; public static final String F_DURABILITY = "F_DURABILITY"; public static final String I_DRAWDURATION = "I_DRAWDURATION"; + public static final String I_INSPECTDURATION = "I_INSPECTDURATION"; public static final String O_CROSSHAIR = "O_CROSSHAIR"; + public static final String B_DOESSMOKE = "B_DOESSMOKE"; public static final String B_RELOADANIMATIONSEQUENTIAL = "B_RELOADANIMATIONSEQUENTIAL"; + public static final String CON_ORCHESTRA = "CON_ORCHESTRA"; public static final String CON_ONPRESSPRIMARY = "CON_ONPRESSPRIMARY"; public static final String CON_ONPRESSSECONDARY = "CON_ONPRESSSECONDARY"; public static final String CON_ONPRESSTERTIARY = "CON_ONPRESSTERTIARY"; @@ -32,6 +36,7 @@ public class GunConfig { public static final String CON_ONRELEASERELOAD = "CON_ONRELEASERELOAD"; public static final String CON_DECIDER = "CON_DECIDER"; public static final String FUN_ANIMNATIONS = "FUN_ANIMNATIONS"; + public static final String O_HUDCOMPONENTS = "O_HUDCOMPONENTS"; /* FIELDS */ @@ -39,8 +44,12 @@ public class GunConfig { protected Receiver[] receivers_DNA; protected float durability_DNA; protected int drawDuration_DNA = 0; + protected int inspectDuration_DNA = 0; protected Crosshair crosshair_DNA; + protected boolean doesSmoke_DNA; protected boolean reloadAnimationsSequential_DNA; + /** This piece only triggers during reloads, playing sounds depending on the reload's progress making reload sounds easier and synced to animations */ + protected BiConsumer orchestra_DNA; /** Lambda functions for clicking shit */ protected BiConsumer onPressPrimary_DNA; protected BiConsumer onPressSecondary_DNA; @@ -55,14 +64,18 @@ public class GunConfig { protected BiConsumer decider_DNA; /** Lambda that returns the relevant animation for the given params */ protected BiFunction animations_DNA; + protected IHUDComponent[] hudComponents_DNA; /* GETTERS */ public Receiver[] getReceivers(ItemStack stack) { return WeaponUpgradeManager.eval(receivers_DNA, stack, O_RECEIVERS, this); } public float getDurability(ItemStack stack) { return WeaponUpgradeManager.eval(durability_DNA, stack, F_DURABILITY, this); } public int getDrawDuration(ItemStack stack) { return WeaponUpgradeManager.eval(drawDuration_DNA, stack, I_DRAWDURATION, this); } + public int getInspectDuration(ItemStack stack) { return WeaponUpgradeManager.eval(inspectDuration_DNA, stack, I_INSPECTDURATION, this); } public Crosshair getCrosshair(ItemStack stack) { return WeaponUpgradeManager.eval(crosshair_DNA, stack, O_CROSSHAIR, this); } + public boolean getDoesSmoke(ItemStack stack) { return WeaponUpgradeManager.eval(doesSmoke_DNA, stack, B_DOESSMOKE, this); } public boolean getReloadAnimSequential(ItemStack stack) { return WeaponUpgradeManager.eval(reloadAnimationsSequential_DNA, stack, B_RELOADANIMATIONSEQUENTIAL, this); } + public BiConsumer getOrchestra(ItemStack stack) { return WeaponUpgradeManager.eval(this.orchestra_DNA, stack, CON_ORCHESTRA, this); } public BiConsumer getPressPrimary(ItemStack stack) { return WeaponUpgradeManager.eval(this.onPressPrimary_DNA, stack, CON_ONPRESSPRIMARY, this); } public BiConsumer getPressSecondary(ItemStack stack) { return WeaponUpgradeManager.eval(this.onPressSecondary_DNA, stack, CON_ONPRESSSECONDARY, this); } @@ -77,13 +90,18 @@ public class GunConfig { public BiConsumer getDecider(ItemStack stack) { return WeaponUpgradeManager.eval(this.decider_DNA, stack, CON_DECIDER, this); } public BiFunction getAnims(ItemStack stack) { return WeaponUpgradeManager.eval(this.animations_DNA, stack, FUN_ANIMNATIONS, this); } + public IHUDComponent[] getHUDComponents(ItemStack stack) { return WeaponUpgradeManager.eval(this.hudComponents_DNA, stack, O_HUDCOMPONENTS, this); } /* SETTERS */ public GunConfig rec(Receiver... receivers) { this.receivers_DNA = receivers; return this; } public GunConfig dura(float dura) { this.durability_DNA = dura; return this; } public GunConfig draw(int draw) { this.drawDuration_DNA = draw; return this; } + public GunConfig inspect(int inspect) { this.inspectDuration_DNA = inspect; return this; } public GunConfig crosshair(Crosshair crosshair) { this.crosshair_DNA = crosshair; return this; } + public GunConfig smoke(boolean doesSmoke) { this.doesSmoke_DNA = doesSmoke; return this; } + + public GunConfig orchestra(BiConsumer orchestra) { this.orchestra_DNA = orchestra; return this; } //press public GunConfig pp(BiConsumer lambda) { this.onPressPrimary_DNA = lambda; return this; } @@ -100,6 +118,7 @@ public class GunConfig { //decider public GunConfig decider(BiConsumer lambda) { this.decider_DNA = lambda; return this; } - //anims - public GunConfig anim(BiFunction lambda) { this.animations_DNA = lambda; return this; } + //client + public GunConfig anim(BiFunction lambda) { this.animations_DNA = lambda; return this; } + public GunConfig hud(IHUDComponent... components) { this.hudComponents_DNA = components; return this; } } diff --git a/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java b/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java index 5b6ccf842..6b911c9c1 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java +++ b/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java @@ -1,9 +1,14 @@ package com.hbm.items.weapon.sedna; +import java.util.ArrayList; +import java.util.List; +import java.util.function.BiConsumer; + import com.hbm.handler.HbmKeybinds.EnumKeybind; import com.hbm.interfaces.IItemHUD; import com.hbm.items.IEquipReceiver; import com.hbm.items.IKeybindReceiver; +import com.hbm.items.weapon.sedna.hud.IHUDComponent; import com.hbm.main.MainRegistry; import com.hbm.packet.PacketDispatcher; import com.hbm.packet.toclient.GunAnimationPacket; @@ -21,22 +26,32 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipReceiver, IItemHUD { + /** Timestamp for rendering smoke nodes and muzzle flashes */ + public long lastShot; + /** [0;1] randomized every shot for various rendering applications */ + public double shotRand = 0D; + public List smokeNodes = new ArrayList(); + public static final String O_GUNCONFIG = "O_GUNCONFIG"; public static final String KEY_DRAWN = "drawn"; public static final String KEY_AIMING = "aiming"; + public static final String KEY_WEAR = "wear"; public static final String KEY_TIMER = "timer"; public static final String KEY_STATE = "state"; public static final String KEY_PRIMARY = "mouse1"; public static final String KEY_SECONDARY = "mouse2"; public static final String KEY_TERTIARY = "mouse3"; public static final String KEY_RELOAD = "reload"; + public static final String KEY_LASTANIM = "lastanim"; + public static final String KEY_ANIMTIMER = "animtimer"; public static float prevAimingProgress; public static float aimingProgress; @@ -59,7 +74,8 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei IDLE, //gun can be fired or reloaded WINDUP, //fire button is down, added delay before fire COOLDOWN, //gun has been fired, cooldown - RELOADING //gun is currently reloading + RELOADING, //gun is currently reloading + JAMMED, //gun is jammed, either after reloading or while firing } @Override @@ -85,7 +101,15 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei @Override public void onEquip(EntityPlayer player, ItemStack stack) { - if(player instanceof EntityPlayerMP) PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.EQUIP.ordinal()), (EntityPlayerMP) player); + playAnimation(player, stack, AnimType.EQUIP); + } + + public static void playAnimation(EntityPlayer player, ItemStack stack, AnimType type) { + if(player instanceof EntityPlayerMP) { + PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(type.ordinal()), (EntityPlayerMP) player); + setLastAnim(stack, type); + setAnimTimer(stack, 0); + } } @Override @@ -93,6 +117,7 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei if(!(entity instanceof EntityPlayer)) return; EntityPlayer player = (EntityPlayer) entity; + GunConfig config = this.getConfig(stack); if(world.isRemote) { @@ -104,50 +129,90 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei offset.rotateAroundY(-entity.rotationYaw / 180F * (float) Math.PI); world.spawnParticle("flame", entity.posX + offset.xCoord, entity.posY + entity.getEyeHeight() + offset.yCoord, entity.posZ + offset.zCoord, 0, 0, 0);*/ + /// AIMING /// prevAimingProgress = aimingProgress; boolean aiming = this.getIsAiming(stack); float aimSpeed = 0.25F; if(aiming && aimingProgress < 1F) aimingProgress += aimSpeed; if(!aiming && aimingProgress > 0F) aimingProgress -= aimSpeed; aimingProgress = MathHelper.clamp_float(aimingProgress, 0F, 1F); + + /// SMOKE NODES /// + if(config.getDoesSmoke(stack)) { + + boolean smoking = lastShot + 2000 > System.currentTimeMillis(); + if(!smoking && !smokeNodes.isEmpty()) smokeNodes.clear(); + + if(smoking) { + Vec3 prev = Vec3.createVectorHelper(-entity.motionX, -entity.motionY, -entity.motionZ); + prev.rotateAroundY((float) (entity.rotationYaw * Math.PI / 180D)); + double accel = 15D; + double side = (entity.rotationYaw - player.prevRotationYawHead) * 0.1D; + double waggle = 0.025D; + + for(SmokeNode node : smokeNodes) { + node.forward += -prev.zCoord * accel + world.rand.nextGaussian() * waggle; + node.lift += prev.yCoord + 1.5D; + node.side += prev.xCoord * accel + world.rand.nextGaussian() * waggle + side; + if(node.alpha > 0) node.alpha -= 0.025D; + node.width *= 1.15; + } + + double alpha = (System.currentTimeMillis() - lastShot) / 2000D; + alpha = (1 - alpha) * 0.5D; + + if(this.getState(stack) == GunState.RELOADING || smokeNodes.size() == 0) alpha = 0; + smokeNodes.add(new SmokeNode(alpha)); + } + } } return; } - GunConfig config = this.getConfig(stack); - + /// RESET WHEN NOT EQUIPPED /// if(!isHeld) { - this.setState(stack, GunState.DRAWING); - this.setTimer(stack, config.getDrawDuration(stack)); + GunState current = this.getState(stack); + if(current != GunState.JAMMED) { + this.setState(stack, GunState.DRAWING); + this.setTimer(stack, config.getDrawDuration(stack)); + } this.setIsAiming(stack, false); return; } + LambdaContext ctx = new LambdaContext(config, player); + + BiConsumer orchestra = config.getOrchestra(stack); + if(orchestra != null) orchestra.accept(stack, ctx); + + setAnimTimer(stack, getAnimTimer(stack) + 1); + + /// STTATE MACHINE /// int timer = this.getTimer(stack); if(timer > 0) this.setTimer(stack, timer - 1); - if(timer <= 1) nextState(player, stack); - } - - public void nextState(EntityPlayer player, ItemStack stack) { - GunConfig cfg = this.getConfig(stack); - cfg.getDecider(stack).accept(stack, new LambdaContext(cfg, player)); + if(timer <= 1) config.getDecider(stack).accept(stack, ctx); } // GUN DRAWN // public static boolean getIsDrawn(ItemStack stack) { return getValueBool(stack, KEY_DRAWN); } public static void setIsDrawn(ItemStack stack, boolean value) { setValueBool(stack, KEY_DRAWN, value); } - // GUN STATE TIMER // public static int getTimer(ItemStack stack) { return getValueInt(stack, KEY_TIMER); } public static void setTimer(ItemStack stack, int value) { setValueInt(stack, KEY_TIMER, value); } - // GUN STATE // public static GunState getState(ItemStack stack) { return EnumUtil.grabEnumSafely(GunState.class, getValueByte(stack, KEY_STATE)); } public static void setState(ItemStack stack, GunState value) { setValueByte(stack, KEY_STATE, (byte) value.ordinal()); } - // GUN AIMING // public static boolean getIsAiming(ItemStack stack) { return getValueBool(stack, KEY_AIMING); } public static void setIsAiming(ItemStack stack, boolean value) { setValueBool(stack, KEY_AIMING, value); } + // GUN AIMING // + public static float getWear(ItemStack stack) { return getValueFloat(stack, KEY_WEAR); } + public static void setWear(ItemStack stack, float value) { setValueFloat(stack, KEY_WEAR, value); } + // ANIM TRACKING // + public static AnimType getLastAnim(ItemStack stack) { return EnumUtil.grabEnumSafely(AnimType.class, getValueInt(stack, KEY_LASTANIM)); } + public static void setLastAnim(ItemStack stack, AnimType value) { setValueInt(stack, KEY_LASTANIM, value.ordinal()); } + public static int getAnimTimer(ItemStack stack) { return getValueInt(stack, KEY_ANIMTIMER); } + public static void setAnimTimer(ItemStack stack, int value) { setValueInt(stack, KEY_ANIMTIMER, value); } // BUTTON STATES // public static boolean getPrimary(ItemStack stack) { return getValueBool(stack, KEY_PRIMARY); } @@ -164,6 +229,9 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei public static int getValueInt(ItemStack stack, String name) { if(stack.hasTagCompound()) return stack.getTagCompound().getInteger(name); return 0; } public static void setValueInt(ItemStack stack, String name, int value) { if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound(); stack.getTagCompound().setInteger(name, value); } + public static float getValueFloat(ItemStack stack, String name) { if(stack.hasTagCompound()) return stack.getTagCompound().getFloat(name); return 0; } + public static void setValueFloat(ItemStack stack, String name, float value) { if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound(); stack.getTagCompound().setFloat(name, value); } + public static byte getValueByte(ItemStack stack, String name) { if(stack.hasTagCompound()) return stack.getTagCompound().getByte(name); return 0; } public static void setValueByte(ItemStack stack, String name, byte value) { if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound(); stack.getTagCompound().setByte(name, value); } @@ -184,11 +252,32 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei @Override @SideOnly(Side.CLIENT) public void renderHUD(Pre event, ElementType type, EntityPlayer player, ItemStack stack) { + + ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); + if(type == ElementType.CROSSHAIRS) { event.setCanceled(true); if(aimingProgress >= 1F) return; - ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); RenderScreenOverlay.renderCustomCrosshairs(event.resolution, Minecraft.getMinecraft().ingameGUI, gun.getConfig(stack).getCrosshair(stack)); } + + IHUDComponent[] components = gun.getConfig(stack).getHUDComponents(stack); + + for(IHUDComponent component : components) { + int bottomOffset = 0; + component.renderHUDComponent(event, type, player, stack, bottomOffset); + bottomOffset += component.getComponentHeight(player, stack); + } + } + + public static class SmokeNode { + + public double forward = 0D; + public double side = 0D; + public double lift = 0D; + public double alpha; + public double width = 1D; + + public SmokeNode(double alpha) { this.alpha = alpha; } } } 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 c1a6603a3..793b0d45c 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/Receiver.java +++ b/src/main/java/com/hbm/items/weapon/sedna/Receiver.java @@ -39,7 +39,7 @@ public class Receiver { protected float baseDamage_DNA; protected int delayAfterFire_DNA; protected int roundsPerCycle_DNA = 1; - protected float spreadMod_DNA = 1F; + protected float spreadModExtra_DNA = 0F; protected boolean refireOnHold_DNA = false; protected CasingEjector ejector_DNA = null; protected int reloadDuration_DNA; @@ -54,7 +54,7 @@ public class Receiver { public float getBaseDamage(ItemStack stack) { return WeaponUpgradeManager.eval(this.baseDamage_DNA, stack, F_BASEDAMAGE, this); } public int getDelayAfterFire(ItemStack stack) { return WeaponUpgradeManager.eval(this.delayAfterFire_DNA, stack, I_DELAYAFTERFIRE, this); } public int getRoundsPerCycle(ItemStack stack) { return WeaponUpgradeManager.eval(this.roundsPerCycle_DNA, stack, I_ROUNDSPERCYCLE, this); } - public float getSpreadMod(ItemStack stack) { return WeaponUpgradeManager.eval(this.spreadMod_DNA, stack, F_SPREADMOD, this); } + public float getSpreadMod(ItemStack stack) { return WeaponUpgradeManager.eval(this.spreadModExtra_DNA, stack, F_SPREADMOD, this); } public boolean getRefireOnHold(ItemStack stack) { return WeaponUpgradeManager.eval(this.refireOnHold_DNA, stack, B_REFIREONHOLD, this); } public CasingEjector getEjector(ItemStack stack) { return WeaponUpgradeManager.eval(this.ejector_DNA, stack, O_EJECTOR, this); } public int getReloadDuration(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadDuration_DNA, stack, I_RELOADDURATION, this); } @@ -70,7 +70,7 @@ public class Receiver { public Receiver dmg(float dmg) { this.baseDamage_DNA = dmg; return this; } public Receiver delay(int delay) { this.delayAfterFire_DNA = delay; return this; } public Receiver rounds(int rounds) { this.roundsPerCycle_DNA = rounds; return this; } - public Receiver spread(int spread) { this.spreadMod_DNA = spread; return this; } + public Receiver spread(int spread) { this.spreadModExtra_DNA = spread; return this; } public Receiver auto(boolean auto) { this.refireOnHold_DNA = auto; return this; } public Receiver burst(CasingEjector ejector) { this.ejector_DNA = ejector; return this; } public Receiver reload(int delay) { this.reloadDuration_DNA = delay; return this; } diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java b/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java index 99140471a..a67ef8f06 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java @@ -1,20 +1,27 @@ package com.hbm.items.weapon.sedna.factory; +import java.util.function.BiConsumer; + import com.hbm.items.ModItems; import com.hbm.items.weapon.sedna.BulletConfig; import com.hbm.items.weapon.sedna.Crosshair; 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.mags.MagazineRevolverDrum; +import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; +import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; +import com.hbm.render.anim.HbmAnimations.AnimType; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; public class GunFactory { - + public static BulletConfig ammo_debug; + public static BulletConfig ammo_debug_buckshot; public static void init() { @@ -23,13 +30,14 @@ public class GunFactory { /// BULLLET CFGS /// ammo_debug = new BulletConfig().setItem(ModItems.ammo_debug).setSpread(0.01F); + ammo_debug_buckshot = new BulletConfig().setItem(ModItems.ammo_12gauge).setSpread(0.1F).setProjectiles(6, 6); /// GUNS /// ModItems.gun_debug = new ItemGunBaseNT(new GunConfig() - .dura(600).draw(15).crosshair(Crosshair.L_CLASSIC) + .dura(600F).draw(15).inspect(23).crosshair(Crosshair.L_CLASSIC).hud(Lego.HUD_COMPONENT_DURABILITY, Lego.HUD_COMPONENT_AMMO).smoke(true).orchestra(DEBUG_ORCHESTRA) .rec(new Receiver(0) - .dmg(10F).delay(12).reload(20).sound("hbm:weapon.44Shoot", 1.0F, 1.0F) - .mag(new MagazineRevolverDrum(0, 6).addConfigs(ammo_debug)) + .dmg(10F).delay(12).reload(46).sound("hbm:weapon.44Shoot", 1.0F, 1.0F) + .mag(new MagazineFullReload(0, 12).addConfigs(ammo_debug, ammo_debug_buckshot)) .canFire(Lego.LAMBDA_STANDARD_CAN_FIRE).fire(Lego.LAMBDA_STANDARD_FIRE)) .pp(Lego.LAMBDA_STANDARD_CLICK_PRIMARY) .pr(Lego.LAMBDA_STANDARD_RELOAD) .pt(Lego.LAMBDA_TOGGLE_AIM) .decider(GunStateDecider.LAMBDA_STANDARD_DECIDER) @@ -39,4 +47,24 @@ public class GunFactory { /// PROXY BULLSHIT /// MainRegistry.proxy.registerGunCfg(); } + + public static BiConsumer DEBUG_ORCHESTRA = (stack, ctx) -> { + EntityPlayer player = ctx.player; + AnimType type = ItemGunBaseNT.getLastAnim(stack); + int timer = ItemGunBaseNT.getAnimTimer(stack); + + if(type == AnimType.RELOAD) { + if(timer == 3) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 1F); + if(timer == 10) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 1F); + if(timer == 34) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1F); + if(timer == 40) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F); + } + if(type == AnimType.CYCLE) { + if(timer == 11) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverCock", 1F, 1F); + } + if(type == AnimType.INSPECT) { + if(timer == 3) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.dryFireClick", 1F, 1F); + if(timer == 16) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.revolverClose", 1F, 1F); + } + }; } diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactoryClient.java b/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactoryClient.java index 6712017ec..f5b50fa2b 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactoryClient.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactoryClient.java @@ -14,6 +14,7 @@ public class GunFactoryClient { public static void init() { ammo_debug.setRenderer(RENDER_STANDARD_BULLET); + ammo_debug_buckshot.setRenderer(RENDER_STANDARD_BULLET); } public static BiConsumer RENDER_STANDARD_BULLET = (bullet, interp) -> { diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/GunStateDecider.java b/src/main/java/com/hbm/items/weapon/sedna/factory/GunStateDecider.java index 3fc55d712..1cdfd9e26 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/GunStateDecider.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/GunStateDecider.java @@ -64,6 +64,7 @@ public class GunStateDecider { if(lastState == GunState.COOLDOWN) { + EntityPlayer player = ctx.player; GunConfig cfg = ctx.config; Receiver rec = cfg.getReceivers(stack)[recIndex]; @@ -74,6 +75,11 @@ public class GunStateDecider { rec.getOnFire(stack).accept(stack, ctx); ItemGunBaseNT.setState(stack, GunState.COOLDOWN); ItemGunBaseNT.setTimer(stack, rec.getDelayAfterFire(stack)); + + player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, rec.getFireSound(stack), rec.getFireVolume(stack), rec.getFirePitch(stack)); + + int remaining = rec.getRoundsPerCycle(stack) - 1; + for(int i = 0; i < remaining; i++) if(rec.getCanFire(stack).apply(stack, ctx)) rec.getOnFire(stack).accept(stack, ctx); //if not, revert to idle } else { ItemGunBaseNT.setState(stack, GunState.IDLE); diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/Lego.java b/src/main/java/com/hbm/items/weapon/sedna/factory/Lego.java index 0cb990e23..06caabc1b 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/Lego.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/Lego.java @@ -10,15 +10,14 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.ItemGunBaseNT.GunState; import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; import com.hbm.items.weapon.sedna.Receiver; +import com.hbm.items.weapon.sedna.hud.HUDComponentAmmoCounter; +import com.hbm.items.weapon.sedna.hud.HUDComponentDurabilityBar; import com.hbm.items.weapon.sedna.mags.IMagazine; -import com.hbm.packet.PacketDispatcher; -import com.hbm.packet.toclient.GunAnimationPacket; import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.HbmAnimations.AnimType; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; /** @@ -29,6 +28,9 @@ import net.minecraft.item.ItemStack; public class Lego { public static final Random ANIM_RAND = new Random(); + + public static HUDComponentDurabilityBar HUD_COMPONENT_DURABILITY = new HUDComponentDurabilityBar(); + public static HUDComponentAmmoCounter HUD_COMPONENT_AMMO = new HUDComponentAmmoCounter(0); /** * If IDLE and the mag of receiver 0 can be loaded, set state to RELOADING. Used by keybinds. */ @@ -36,17 +38,18 @@ public class Lego { EntityPlayer player = ctx.player; Receiver rec = ctx.config.getReceivers(stack)[0]; + GunState state = ItemGunBaseNT.getState(stack); - if(ItemGunBaseNT.getState(stack) == GunState.IDLE) { + if(state == GunState.IDLE) { ItemGunBaseNT.setIsAiming(stack, false); if(rec.getMagazine(stack).canReload(stack, ctx.player)) { ItemGunBaseNT.setState(stack, GunState.RELOADING); ItemGunBaseNT.setTimer(stack, rec.getReloadDuration(stack)); - if(player instanceof EntityPlayerMP) PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.RELOAD.ordinal()), (EntityPlayerMP) player); + ItemGunBaseNT.playAnimation(player, stack, AnimType.RELOAD); } else { - if(player instanceof EntityPlayerMP) PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.INSPECT.ordinal()), (EntityPlayerMP) player); + ItemGunBaseNT.playAnimation(player, stack, AnimType.INSPECT); } } }; @@ -54,14 +57,18 @@ public class Lego { /** * If IDLE and ammo is loaded, fire and set to JUST_FIRED. */ public static BiConsumer LAMBDA_STANDARD_CLICK_PRIMARY = (stack, ctx) -> { - + + EntityPlayer player = ctx.player; Receiver rec = ctx.config.getReceivers(stack)[0]; + GunState state = ItemGunBaseNT.getState(stack); - if(ItemGunBaseNT.getState(stack) == GunState.IDLE && rec.getCanFire(stack).apply(stack, ctx)) { + if(state == GunState.IDLE && rec.getCanFire(stack).apply(stack, ctx)) { ItemGunBaseNT.setState(stack, GunState.COOLDOWN); ItemGunBaseNT.setTimer(stack, rec.getDelayAfterFire(stack)); rec.getOnFire(stack).accept(stack, ctx); + player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, rec.getFireSound(stack), rec.getFireVolume(stack), rec.getFirePitch(stack)); + int remaining = rec.getRoundsPerCycle(stack) - 1; for(int i = 0; i < remaining; i++) if(rec.getCanFire(stack).apply(stack, ctx)) rec.getOnFire(stack).accept(stack, ctx); } @@ -82,24 +89,24 @@ public class Lego { /** Spawns an EntityBulletBaseMK4 with the loaded bulletcfg */ public static BiConsumer LAMBDA_STANDARD_FIRE = (stack, ctx) -> { EntityPlayer player = ctx.player; - if(player instanceof EntityPlayerMP) PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.CYCLE.ordinal()), (EntityPlayerMP) player); + ItemGunBaseNT.playAnimation(player, stack, AnimType.CYCLE); double sideOffset = ItemGunBaseNT.getIsAiming(stack) ? 0 : -0.3125D; float aim = ItemGunBaseNT.getIsAiming(stack) ? 0.25F : 1F; Receiver primary = ctx.config.getReceivers(stack)[0]; IMagazine mag = primary.getMagazine(stack); + BulletConfig config = (BulletConfig) mag.getType(stack); - EntityBulletBaseMK4 mk4 = new EntityBulletBaseMK4(player, (BulletConfig) mag.getType(stack), primary.getBaseDamage(stack), primary.getSpreadMod(stack) * aim, sideOffset, -0.0625, 0.75); - player.worldObj.spawnEntityInWorld(mk4); - player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, primary.getFireSound(stack), primary.getFireVolume(stack), primary.getFirePitch(stack)); + int projectiles = config.projectilesMin; + if(config.projectilesMax > config.projectilesMin) projectiles += player.getRNG().nextInt(config.projectilesMax - config.projectilesMin + 1); - mag.setAmount(stack, mag.getAmount(stack) - 1);; - }; - - /** No reload, simply play inspect animation */ - public static BiConsumer LAMBDA_DEBUG_RELOAD = (stack, ctx) -> { - EntityPlayer player = ctx.player; - if(player instanceof EntityPlayerMP) PacketDispatcher.wrapper.sendTo(new GunAnimationPacket(AnimType.INSPECT.ordinal()), (EntityPlayerMP) player); + for(int i = 0; i < projectiles; i++) { + EntityBulletBaseMK4 mk4 = new EntityBulletBaseMK4(player, config, primary.getBaseDamage(stack), primary.getSpreadMod(stack) * aim + 1F, sideOffset, -0.0625, 0.75); + player.worldObj.spawnEntityInWorld(mk4); + } + + mag.setAmount(stack, mag.getAmount(stack) - 1); + ItemGunBaseNT.setWear(stack, ItemGunBaseNT.getWear(stack) + config.wear); }; /** anims for the DEBUG revolver, mostly a copy of the li'lpip but with some fixes regarding the cylinder movement */ @@ -117,10 +124,10 @@ public class Lego { .addBus("RELOAD_JOLT", new BusAnimationSequence().addPos(0, 0, 0, 600).addPos(2, 0, 0, 50).addPos(0, 0, 0, 100)) .addBus("RELOAD_BULLETS", new BusAnimationSequence().addPos(0, 0, 0, 650).addPos(10, 0, 0, 300).addPos(10, 0, 0, 200).addPos(0, 0, 0, 700)) .addBus("RELOAD_BULLETS_CON", new BusAnimationSequence().addPos(1, 0, 0, 0).addPos(1, 0, 0, 950).addPos(0, 0, 0, 1 ) ); - case INSPECT: if(ANIM_RAND.nextBoolean()) return new BusAnimation() - .addBus("RELAOD_TILT", new BusAnimationSequence().addPos(-15, 0, 0, 100).addPos(65, 0, 0, 100).addPos(45, 0, 0, 50).addPos(0, 0, 0, 200).addPos(0, 0, 0, 1450 - 1250).addPos(-80, 0, 0, 100).addPos(-80, 0, 0, 100).addPos(0, 0, 0, 200)) - .addBus("RELOAD_CYLINDER", new BusAnimationSequence().addPos(0, 0, 0, 200).addPos(90, 0, 0, 100).addPos(90, 0, 0, 1700 - 1250).addPos(0, 0, 0, 70)); - else return new BusAnimation().addBus("ROTATE", new BusAnimationSequence().addPos(-360 * 5, 0, 0, 350 * 5)); + case INSPECT: //if(ANIM_RAND.nextBoolean()) return new BusAnimation().addBus("ROTATE", new BusAnimationSequence().addPos(-360 * 5, 0, 0, 350 * 5)); + case JAMMED: return new BusAnimation() + .addBus("RELAOD_TILT", new BusAnimationSequence().addPos(-15, 0, 0, 100).addPos(65, 0, 0, 100).addPos(45, 0, 0, 50).addPos(0, 0, 0, 200).addPos(0, 0, 0, 200).addPos(-80, 0, 0, 100).addPos(-80, 0, 0, 100).addPos(0, 0, 0, 200)) + .addBus("RELOAD_CYLINDER", new BusAnimationSequence().addPos(0, 0, 0, 200).addPos(90, 0, 0, 100).addPos(90, 0, 0, 450).addPos(0, 0, 0, 70)); } return null; diff --git a/src/main/java/com/hbm/items/weapon/sedna/hud/HUDComponentAmmoCounter.java b/src/main/java/com/hbm/items/weapon/sedna/hud/HUDComponentAmmoCounter.java new file mode 100644 index 000000000..e305c3572 --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/sedna/hud/HUDComponentAmmoCounter.java @@ -0,0 +1,52 @@ +package com.hbm.items.weapon.sedna.hud; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import com.hbm.items.weapon.sedna.ItemGunBaseNT; +import com.hbm.items.weapon.sedna.mags.IMagazine; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; +import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; + +public class HUDComponentAmmoCounter implements IHUDComponent { + + protected static final RenderItem itemRenderer = RenderItem.getInstance(); + protected int receiver; + + public HUDComponentAmmoCounter(int receiver) { + this.receiver = receiver; + } + + @Override + public int getComponentHeight(EntityPlayer player, ItemStack stack){ + return 22; + } + + @Override + public void renderHUDComponent(Pre event, ElementType type, EntityPlayer player, ItemStack stack, int bottomOffset) { + + ScaledResolution resolution = event.resolution; + Minecraft mc = Minecraft.getMinecraft(); + + int pX = resolution.getScaledWidth() / 2 + 62 + 36; + int pZ = resolution.getScaledHeight() - bottomOffset - 21; + ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); + IMagazine mag = gun.getConfig(stack).getReceivers(stack)[this.receiver].getMagazine(stack); + + mc.fontRenderer.drawString(mag.reportAmmoStateForHUD(stack), pX + 17, pZ + 6, 0xFFFFFF); + + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + RenderHelper.enableGUIStandardItemLighting(); + itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.getTextureManager(), mag.getIconForHUD(stack), pX, pZ); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + } +} diff --git a/src/main/java/com/hbm/items/weapon/sedna/hud/HUDComponentDurabilityBar.java b/src/main/java/com/hbm/items/weapon/sedna/hud/HUDComponentDurabilityBar.java new file mode 100644 index 000000000..93f7cbbf0 --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/sedna/hud/HUDComponentDurabilityBar.java @@ -0,0 +1,43 @@ +package com.hbm.items.weapon.sedna.hud; + +import org.lwjgl.opengl.GL11; + +import com.hbm.items.weapon.sedna.ItemGunBaseNT; +import com.hbm.lib.RefStrings; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; +import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; + +public class HUDComponentDurabilityBar implements IHUDComponent { + + private static final ResourceLocation misc = new ResourceLocation(RefStrings.MODID + ":textures/misc/overlay_misc.png"); + + @Override + public int getComponentHeight(EntityPlayer player, ItemStack stack) { + return 5; + } + + @Override + public void renderHUDComponent(Pre event, ElementType type, EntityPlayer player, ItemStack stack, int bottomOffset) { + + ScaledResolution resolution = event.resolution; + Minecraft mc = Minecraft.getMinecraft(); + + int pX = resolution.getScaledWidth() / 2 + 62 + 36; + int pZ = resolution.getScaledHeight() - 21; + + ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); + int dura = (int) (50 * gun.getWear(stack) / gun.getConfig(stack).getDurability(stack)); + + GL11.glColor4f(1F, 1F, 1F, 1F); + + mc.renderEngine.bindTexture(misc); + mc.ingameGUI.drawTexturedModalRect(pX, pZ + 16, 94, 0, 52, 3); + mc.ingameGUI.drawTexturedModalRect(pX + 1, pZ + 16, 95, 3, 50 - dura, 3); + } +} diff --git a/src/main/java/com/hbm/items/weapon/sedna/hud/IHUDComponent.java b/src/main/java/com/hbm/items/weapon/sedna/hud/IHUDComponent.java new file mode 100644 index 000000000..4405d6abd --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/sedna/hud/IHUDComponent.java @@ -0,0 +1,12 @@ +package com.hbm.items.weapon.sedna.hud; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; +import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; + +public interface IHUDComponent { + + public int getComponentHeight(EntityPlayer player, ItemStack stack); + public void renderHUDComponent(Pre event, ElementType type, EntityPlayer player, ItemStack stack, int bottomOffset); +} diff --git a/src/main/java/com/hbm/items/weapon/sedna/mags/IMagazine.java b/src/main/java/com/hbm/items/weapon/sedna/mags/IMagazine.java index 55d7d4bb7..b875e1ee5 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/mags/IMagazine.java +++ b/src/main/java/com/hbm/items/weapon/sedna/mags/IMagazine.java @@ -9,12 +9,12 @@ import net.minecraft.item.ItemStack; * * @author hbm */ -public interface IMagazine { +public interface IMagazine { /** What ammo is loaded currently */ - public Object getType(ItemStack stack); + public T getType(ItemStack stack); /** Sets the mag's ammo type */ - public void setType(ItemStack stack, Object type); + public void setType(ItemStack stack, T type); /** How much ammo this mag can carry */ public int getCapacity(ItemStack stack); /** How much ammo is currently loaded */ @@ -26,5 +26,7 @@ public interface IMagazine { /** The action done at the end of one reload cycle, either loading one shell or replacing the whole mag */ public void reloadAction(ItemStack stack, EntityPlayer player); /** The stack that should be displayed for the ammo HUD */ - public ItemStack getIcon(ItemStack stack); + public ItemStack getIconForHUD(ItemStack stack); + /** It explains itself */ + public String reportAmmoStateForHUD(ItemStack stack); } diff --git a/src/main/java/com/hbm/items/weapon/sedna/mags/MagazineRevolverDrum.java b/src/main/java/com/hbm/items/weapon/sedna/mags/MagazineFullReload.java similarity index 83% rename from src/main/java/com/hbm/items/weapon/sedna/mags/MagazineRevolverDrum.java rename to src/main/java/com/hbm/items/weapon/sedna/mags/MagazineFullReload.java index df7990b0e..473958f62 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/mags/MagazineRevolverDrum.java +++ b/src/main/java/com/hbm/items/weapon/sedna/mags/MagazineFullReload.java @@ -6,9 +6,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; /** Uses individual bullets which are loaded all at once */ -public class MagazineRevolverDrum extends MagazineStandardBase { +public class MagazineFullReload extends MagazineSingleTypeBase { - public MagazineRevolverDrum(int index, int capacity) { + public MagazineFullReload(int index, int capacity) { super(index, capacity); } @@ -26,7 +26,7 @@ public class MagazineRevolverDrum extends MagazineStandardBase { if(config.ammo.matchesRecipe(slot, true)) return true; } } else { - BulletConfig config = (BulletConfig) this.getType(stack); + BulletConfig config = this.getType(stack); if(config == null) { config = this.acceptedBullets.get(0); this.setType(stack, config); } if(config.ammo.matchesRecipe(slot, true)) return true; } @@ -59,7 +59,7 @@ public class MagazineRevolverDrum extends MagazineStandardBase { } //mag has a type set, only load that } else { - BulletConfig config = (BulletConfig) this.getType(stack); + BulletConfig config = this.getType(stack); if(config == null) { config = this.acceptedBullets.get(0); this.setType(stack, config); } //fixing broken NBT if(config.ammo.matchesRecipe(slot, true)) { @@ -72,13 +72,4 @@ public class MagazineRevolverDrum extends MagazineStandardBase { } } } - - @Override - public ItemStack getIcon(ItemStack stack) { - Object o = this.getType(stack); - if(o instanceof BulletConfig) { - return ((BulletConfig) o).ammo.toStack(); - } - return null; - } } diff --git a/src/main/java/com/hbm/items/weapon/sedna/mags/MagazineStandardBase.java b/src/main/java/com/hbm/items/weapon/sedna/mags/MagazineSingleTypeBase.java similarity index 70% rename from src/main/java/com/hbm/items/weapon/sedna/mags/MagazineStandardBase.java rename to src/main/java/com/hbm/items/weapon/sedna/mags/MagazineSingleTypeBase.java index 874d14195..0af651cca 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/mags/MagazineStandardBase.java +++ b/src/main/java/com/hbm/items/weapon/sedna/mags/MagazineSingleTypeBase.java @@ -8,8 +8,8 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT; import net.minecraft.item.ItemStack; -/** Base class for typical magazines, i.e. ones that hold bullets, shells, grenades, etc, any ammo item. Type methods deal with BulletConfigs */ -public abstract class MagazineStandardBase implements IMagazine { +/** Base class for typical magazines, i.e. ones that hold bullets, shells, grenades, etc, any ammo item. Stores a single type of BulletConfigs */ +public abstract class MagazineSingleTypeBase implements IMagazine { public static final String KEY_MAG_COUNT = "magcount"; public static final String KEY_MAG_TYPE = "magtype"; @@ -21,15 +21,15 @@ public abstract class MagazineStandardBase implements IMagazine { /** How much ammo this mag can hold */ public int capacity; - public MagazineStandardBase(int index, int capacity) { + public MagazineSingleTypeBase(int index, int capacity) { this.index = index; this.capacity = capacity; } - public MagazineStandardBase 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 - public Object getType(ItemStack stack) { + public BulletConfig getType(ItemStack stack) { int type = getMagType(stack, index); if(type >= 0 && type < BulletConfig.configs.size()) { return BulletConfig.configs.get(type); @@ -38,12 +38,23 @@ public abstract class MagazineStandardBase implements IMagazine { } @Override - public void setType(ItemStack stack, Object type) { - if(!(type instanceof BulletConfig)) return; + public void setType(ItemStack stack, BulletConfig type) { int i = BulletConfig.configs.indexOf(type); if(i >= 0) setMagType(stack, index, i); } + @Override + public ItemStack getIconForHUD(ItemStack stack) { + BulletConfig config = this.getType(stack); + if(config != null) return config.ammo.toStack(); + return null; + } + + @Override + public String reportAmmoStateForHUD(ItemStack stack) { + return getAmount(stack) + " / " + getCapacity(stack); + } + @Override public int getCapacity(ItemStack stack) { return capacity; } @Override public int getAmount(ItemStack stack) { return getMagCount(stack, index); } @Override public void setAmount(ItemStack stack, int amount) { setMagCount(stack, index, amount); } diff --git a/src/main/java/com/hbm/packet/toclient/GunAnimationPacket.java b/src/main/java/com/hbm/packet/toclient/GunAnimationPacket.java index 377ac340b..51aaca407 100644 --- a/src/main/java/com/hbm/packet/toclient/GunAnimationPacket.java +++ b/src/main/java/com/hbm/packet/toclient/GunAnimationPacket.java @@ -55,7 +55,7 @@ public class GunAnimationPacket implements IMessage { if(stack == null) return null; - if(stack.getItem() instanceof com.hbm.items.weapon.sedna.ItemGunBaseNT) { + if(stack.getItem() instanceof ItemGunBaseNT) { handleSedna(player, stack, slot, AnimType.values()[m.type]); } @@ -94,6 +94,11 @@ public class GunAnimationPacket implements IMessage { ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); GunConfig config = gun.getConfig(stack); + if(type == AnimType.CYCLE) { + gun.lastShot = System.currentTimeMillis(); + gun.shotRand = player.worldObj.rand.nextDouble(); + } + BiFunction anims = config.getAnims(stack); BusAnimation animation = anims.apply(stack, type); diff --git a/src/main/java/com/hbm/render/anim/HbmAnimations.java b/src/main/java/com/hbm/render/anim/HbmAnimations.java index 699703db6..078c479b6 100644 --- a/src/main/java/com/hbm/render/anim/HbmAnimations.java +++ b/src/main/java/com/hbm/render/anim/HbmAnimations.java @@ -28,7 +28,8 @@ public class HbmAnimations { SPINUP, //animation for actionstart SPINDOWN, //animation for actionend EQUIP, //animation for drawing the weapon - INSPECT //animation for inspecting the weapon + INSPECT, //animation for inspecting the weapon + JAMMED //animation for jammed weapons } // A NOTE ON SHOTGUN STYLE RELOADS diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderDebug.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderDebug.java index b6981e6f1..8b8247ac3 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderDebug.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderDebug.java @@ -27,6 +27,8 @@ public class ItemRenderDebug extends ItemRenderWeaponBase { @Override public void renderFirstPerson(ItemStack stack) { + ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); + double scale = 0.125D; GL11.glScaled(scale, scale, scale); GL11.glRotated(90, 0, 1, 0); @@ -44,11 +46,18 @@ public class ItemRenderDebug extends ItemRenderWeaponBase { standardAimingTransform(stack, 0, 0, recoil[2], -recoil[2], 0, 0); GL11.glRotated(recoil[2] * 10, 0, 0, 1); + GL11.glShadeModel(GL11.GL_SMOOTH); + + GL11.glPushMatrix(); + GL11.glTranslated(-9, 2.5, 0); + GL11.glRotated(recoil[2] * -10, 0, 0, 1); + this.renderSmokeNodes(gun.smokeNodes, 0.5D); + GL11.glPopMatrix(); + GL11.glRotated(reloadLift[0], 0, 0, 1); GL11.glTranslated(reloadJolt[0], 0, 0); GL11.glRotated(reloadTilt[0], 1, 0, 0); - GL11.glShadeModel(GL11.GL_SMOOTH); Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.debug_gun_tex); ResourceManager.lilmac.renderPart("Gun"); @@ -73,6 +82,17 @@ public class ItemRenderDebug extends ItemRenderWeaponBase { GL11.glPopMatrix(); GL11.glShadeModel(GL11.GL_FLAT); + + GL11.glPushMatrix(); + GL11.glTranslated(0.125, 2.5, 0); + this.renderGapFlash(gun.lastShot); + 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 diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderWeaponBase.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderWeaponBase.java index dc9a64b8b..1c714db8e 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderWeaponBase.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderWeaponBase.java @@ -1,10 +1,14 @@ package com.hbm.render.item.weapon.sedna; +import java.util.List; + import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import org.lwjgl.util.glu.Project; import com.hbm.items.weapon.sedna.ItemGunBaseNT; +import com.hbm.items.weapon.sedna.ItemGunBaseNT.SmokeNode; +import com.hbm.lib.RefStrings; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -14,14 +18,18 @@ import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; public abstract class ItemRenderWeaponBase implements IItemRenderer { + public static final ResourceLocation flash_plume = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/lilmac_plume.png"); + public static float interp; @Override @@ -226,4 +234,144 @@ public abstract class ItemRenderWeaponBase implements IItemRenderer { double z = sZ + (aZ - sZ) * aimingProgress; GL11.glTranslated(x, y, z); } + + public static void renderSmokeNodes(List nodes, double scale) { + Tessellator tess = Tessellator.instance; + + if(nodes.size() > 1) { + + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_CULL_FACE); + GL11.glAlphaFunc(GL11.GL_GREATER, 0F); + GL11.glDepthMask(false); + + tess.startDrawingQuads(); + tess.setNormal(0F, 1F, 0F); + + for(int i = 0; i < nodes.size() - 1; i++) { + SmokeNode node = nodes.get(i); + SmokeNode past = nodes.get(i + 1); + + tess.setColorRGBA_F(1F, 1F, 1F, (float) node.alpha); + tess.addVertex(node.forward, node.lift, node.side); + tess.setColorRGBA_F(1F, 1F, 1F, 0F); + tess.addVertex(node.forward, node.lift, node.side + node.width * scale); + tess.setColorRGBA_F(1F, 1F, 1F, 0F); + tess.addVertex(past.forward, past.lift, past.side + past.width * scale); + tess.setColorRGBA_F(1F, 1F, 1F, (float) past.alpha); + tess.addVertex(past.forward, past.lift, past.side); + + tess.setColorRGBA_F(1F, 1F, 1F, (float) node.alpha); + tess.addVertex(node.forward, node.lift, node.side); + tess.setColorRGBA_F(1F, 1F, 1F, 0F); + tess.addVertex(node.forward, node.lift, node.side - node.width * scale); + tess.setColorRGBA_F(1F, 1F, 1F, 0F); + tess.addVertex(past.forward, past.lift, past.side - past.width * scale); + tess.setColorRGBA_F(1F, 1F, 1F, (float) past.alpha); + tess.addVertex(past.forward, past.lift, past.side); + } + tess.draw(); + + GL11.glDepthMask(true); + GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.1F); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glDisable(GL11.GL_BLEND); + } + } + + public static void renderMuzzleFlash(long lastShot) { + Tessellator tess = Tessellator.instance; + + int flash = 75; + + if(System.currentTimeMillis() - lastShot < flash) { + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + GL11.glPushMatrix(); + + double fire = (System.currentTimeMillis() - lastShot) / (double) flash; + + double width = 6 * fire; + double length = 15 * fire; + double inset = 2; + Minecraft.getMinecraft().renderEngine.bindTexture(flash_plume); + tess.startDrawingQuads(); + tess.setNormal(0F, 1F, 0F); + tess.setColorRGBA_F(1F, 1F, 1F, 1F); + + tess.addVertexWithUV(0, -width, - inset, 1, 1); + tess.addVertexWithUV(0, width, - inset, 0, 1); + tess.addVertexWithUV(0.1, width, length - inset, 0 ,0); + tess.addVertexWithUV(0.1, -width, length - inset, 1, 0); + + tess.addVertexWithUV(0, width, inset, 0, 1); + tess.addVertexWithUV(0, -width, inset, 1, 1); + tess.addVertexWithUV(0.1, -width, -length + inset, 1, 0); + tess.addVertexWithUV(0.1, width, -length + inset, 0 ,0); + + tess.addVertexWithUV(0, - inset, width, 0, 1); + tess.addVertexWithUV(0, - inset, -width, 1, 1); + tess.addVertexWithUV(0.1, length - inset, -width, 1, 0); + tess.addVertexWithUV(0.1, length - inset, width, 0 ,0); + + tess.addVertexWithUV(0, inset, -width, 1, 1); + tess.addVertexWithUV(0, inset, width, 0, 1); + tess.addVertexWithUV(0.1, -length + inset, width, 0 ,0); + tess.addVertexWithUV(0.1, -length + inset, -width, 1, 0); + + tess.draw(); + GL11.glPopMatrix(); + GL11.glDisable(GL11.GL_BLEND); + } + } + + public static void renderGapFlash(long lastShot) { + Tessellator tess = Tessellator.instance; + + int flash = 75; + + if(System.currentTimeMillis() - lastShot < flash) { + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + GL11.glPushMatrix(); + + double fire = (System.currentTimeMillis() - lastShot) / (double) flash; + + double height = 4 * fire; + double length = 15 * fire; + double lift = 3 * fire; + double offset = 1 * fire; + double lengthOffset = 0.125; + Minecraft.getMinecraft().renderEngine.bindTexture(flash_plume); + tess.startDrawingQuads(); + tess.setNormal(0F, 1F, 0F); + tess.setColorRGBA_F(1F, 1F, 1F, 1F); + + tess.addVertexWithUV(0, -height, -offset, 1, 1); + tess.addVertexWithUV(0, height, -offset, 0, 1); + tess.addVertexWithUV(0, height + lift, length - offset, 0 ,0); + tess.addVertexWithUV(0, -height + lift, length - offset, 1, 0); + + tess.addVertexWithUV(0, height, offset, 0, 1); + tess.addVertexWithUV(0, -height, offset, 1, 1); + tess.addVertexWithUV(0, -height + lift, -length + offset, 1, 0); + tess.addVertexWithUV(0, height + lift, -length + offset, 0 ,0); + + tess.addVertexWithUV(0, -height, -offset, 1, 1); + tess.addVertexWithUV(0, height, -offset, 0, 1); + tess.addVertexWithUV(lengthOffset, height, length - offset, 0 ,0); + tess.addVertexWithUV(lengthOffset, -height, length - offset, 1, 0); + + tess.addVertexWithUV(0, height, offset, 0, 1); + tess.addVertexWithUV(0, -height, offset, 1, 1); + tess.addVertexWithUV(lengthOffset, -height, -length + offset, 1, 0); + tess.addVertexWithUV(lengthOffset, height, -length + offset, 0 ,0); + + tess.draw(); + GL11.glPopMatrix(); + GL11.glDisable(GL11.GL_BLEND); + } + } } diff --git a/src/main/resources/assets/hbm/sounds.json b/src/main/resources/assets/hbm/sounds.json index 02bb67a4c..27d07dcc9 100644 --- a/src/main/resources/assets/hbm/sounds.json +++ b/src/main/resources/assets/hbm/sounds.json @@ -220,6 +220,30 @@ "weapon.switchmode1": {"category": "player", "sounds": [{"name": "weapon/switchmode1", "stream": false}]}, "weapon.switchmode2": {"category": "player", "sounds": [{"name": "weapon/switchmode2", "stream": false}]}, + "weapon.reload.boltClose": {"category": "player", "sounds": ["weapon/reload/boltClose"]}, + "weapon.reload.boltOpen": {"category": "player", "sounds": ["weapon/reload/boltOpen"]}, + "weapon.reload.closeClick": {"category": "player", "sounds": ["weapon/reload/closeClick"]}, + "weapon.reload.dryFireClick": {"category": "player", "sounds": ["weapon/reload/dryFireClick"]}, + "weapon.reload.insertCanister": {"category": "player", "sounds": ["weapon/reload/insertCanister"]}, + "weapon.reload.insertGrenade": {"category": "player", "sounds": ["weapon/reload/insertGrenade"]}, + "weapon.reload.insertLarge": {"category": "player", "sounds": ["weapon/reload/insertLarge"]}, + "weapon.reload.insertRocket": {"category": "player", "sounds": ["weapon/reload/insertRocket"]}, + "weapon.reload.leverCock": {"category": "player", "sounds": ["weapon/reload/leverCock"]}, + "weapon.reload.magInsert": {"category": "player", "sounds": ["weapon/reload/magInsert"]}, + "weapon.reload.magRemove": {"category": "player", "sounds": ["weapon/reload/magRemove"]}, + "weapon.reload.magSmallInsert": {"category": "player", "sounds": ["weapon/reload/magSmallInsert"]}, + "weapon.reload.magSmallRemove": {"category": "player", "sounds": ["weapon/reload/magSmallRemove"]}, + "weapon.reload.openLatch": {"category": "player", "sounds": ["weapon/reload/openLatch"]}, + "weapon.reload.pistolCock": {"category": "player", "sounds": ["weapon/reload/pistolCock"]}, + "weapon.reload.pressureValve": {"category": "player", "sounds": ["weapon/reload/pressureValve"]}, + "weapon.reload.revolverClose": {"category": "player", "sounds": ["weapon/reload/revolverClose"]}, + "weapon.reload.revolverCock": {"category": "player", "sounds": ["weapon/reload/revolverCock"]}, + "weapon.reload.revolverSpin": {"category": "player", "sounds": ["weapon/reload/revolverSpin"]}, + "weapon.reload.rifleCock": {"category": "player", "sounds": ["weapon/reload/rifleCock"]}, + "weapon.reload.shotgunCock": {"category": "player", "sounds": ["weapon/reload/shotgunCock"]}, + "weapon.reload.shotgunReload": {"category": "player", "sounds": ["weapon/reload/shotgunReload1", "weapon/reload/shotgunReload2", "weapon/reload/shotgunReload3"]}, + "weapon.reload.tubeFwoomp": {"category": "player", "sounds": ["weapon/reload/tubeFwoomp"]}, + "turret.chekhov_fire": {"category": "block", "sounds": [{"name": "turret/chekhov_fire", "stream": false}]}, "turret.jeremy_fire": {"category": "block", "sounds": ["turret/jeremy_fire1", "turret/jeremy_fire2", "turret/jeremy_fire3", "turret/jeremy_fire4", "turret/jeremy_fire5"]}, "turret.jeremy_reload": {"category": "block", "sounds": [{"name": "turret/jeremy_reload", "stream": false}]}, diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/boltClose.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/boltClose.ogg new file mode 100644 index 000000000..45bd93171 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/boltClose.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/boltOpen.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/boltOpen.ogg new file mode 100644 index 000000000..3124cec57 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/boltOpen.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/closeClick.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/closeClick.ogg new file mode 100644 index 000000000..39f036143 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/closeClick.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/dryFireClick.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/dryFireClick.ogg new file mode 100644 index 000000000..a34d6da1d Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/dryFireClick.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/insertCanister.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/insertCanister.ogg new file mode 100644 index 000000000..bff37cdd3 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/insertCanister.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/insertGrenade.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/insertGrenade.ogg new file mode 100644 index 000000000..0b7a888a0 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/insertGrenade.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/insertLarge.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/insertLarge.ogg new file mode 100644 index 000000000..35e2a855b Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/insertLarge.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/insertRocket.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/insertRocket.ogg new file mode 100644 index 000000000..eb24d346a Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/insertRocket.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/leverCock.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/leverCock.ogg new file mode 100644 index 000000000..1591a4903 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/leverCock.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/magInsert.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/magInsert.ogg new file mode 100644 index 000000000..3db4f7dfe Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/magInsert.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/magRemove.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/magRemove.ogg new file mode 100644 index 000000000..995ada889 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/magRemove.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/magSmallInsert.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/magSmallInsert.ogg new file mode 100644 index 000000000..7c9b92a31 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/magSmallInsert.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/magSmallRemove.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/magSmallRemove.ogg new file mode 100644 index 000000000..2411f23eb Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/magSmallRemove.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/openLatch.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/openLatch.ogg new file mode 100644 index 000000000..57ce982d2 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/openLatch.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/pistolCock.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/pistolCock.ogg new file mode 100644 index 000000000..0898895cb Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/pistolCock.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/pressureValve.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/pressureValve.ogg new file mode 100644 index 000000000..ba3c3fc1b Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/pressureValve.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/revolverClose.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/revolverClose.ogg new file mode 100644 index 000000000..1e682c858 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/revolverClose.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/revolverCock.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/revolverCock.ogg new file mode 100644 index 000000000..184cade5f Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/revolverCock.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/revolverSpin.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/revolverSpin.ogg new file mode 100644 index 000000000..25cd591a6 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/revolverSpin.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/rifleCock.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/rifleCock.ogg new file mode 100644 index 000000000..474c91826 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/rifleCock.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/shotgunCock.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/shotgunCock.ogg new file mode 100644 index 000000000..8e36020b2 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/shotgunCock.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/shotgunReload1.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/shotgunReload1.ogg new file mode 100644 index 000000000..7ab6c8105 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/shotgunReload1.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/shotgunReload2.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/shotgunReload2.ogg new file mode 100644 index 000000000..43e966250 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/shotgunReload2.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/shotgunReload3.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/shotgunReload3.ogg new file mode 100644 index 000000000..512c6ea81 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/shotgunReload3.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/reload/tubeFwoomp.ogg b/src/main/resources/assets/hbm/sounds/weapon/reload/tubeFwoomp.ogg new file mode 100644 index 000000000..f50d3f8b5 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/reload/tubeFwoomp.ogg differ