diff --git a/src/main/java/com/hbm/entity/mob/glyphid/EntityGlyphidBehemoth.java b/src/main/java/com/hbm/entity/mob/glyphid/EntityGlyphidBehemoth.java index 22a53e3d2..ed07a28eb 100644 --- a/src/main/java/com/hbm/entity/mob/glyphid/EntityGlyphidBehemoth.java +++ b/src/main/java/com/hbm/entity/mob/glyphid/EntityGlyphidBehemoth.java @@ -86,7 +86,7 @@ public class EntityGlyphidBehemoth extends EntityGlyphid { public void acidAttack(){ if(!worldObj.isRemote && entityToAttack instanceof EntityLivingBase && this.getDistanceToEntity(entityToAttack) < 20) { this.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2 * 20, 6)); - EntityChemical chem = new EntityChemical(worldObj, this); + EntityChemical chem = new EntityChemical(worldObj, this, 0, 0, 0); chem.setFluid(Fluids.SULFURIC_ACID); worldObj.spawnEntityInWorld(chem); diff --git a/src/main/java/com/hbm/entity/projectile/EntityBulletBaseMK4.java b/src/main/java/com/hbm/entity/projectile/EntityBulletBaseMK4.java index f4b37d283..bd228c2e0 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityBulletBaseMK4.java +++ b/src/main/java/com/hbm/entity/projectile/EntityBulletBaseMK4.java @@ -55,9 +55,9 @@ public class EntityBulletBaseMK4 extends EntityThrowableInterp { this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI)); - motionX += entity.motionX; + /*motionX += entity.motionX; motionY += entity.motionY; - motionZ += entity.motionZ; + motionZ += entity.motionZ;*/ this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, 1.0F, this.config.spread + gunSpread); } diff --git a/src/main/java/com/hbm/entity/projectile/EntityChemical.java b/src/main/java/com/hbm/entity/projectile/EntityChemical.java index f1a1e5e6c..ed3e7391e 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityChemical.java +++ b/src/main/java/com/hbm/entity/projectile/EntityChemical.java @@ -62,7 +62,7 @@ public class EntityChemical extends EntityThrowableNT { this.isImmuneToFire = true; } - public EntityChemical(World world, EntityLivingBase thrower) { + public EntityChemical(World world, EntityLivingBase thrower, double sideOffset, double heightOffset, double frontOffset) { super(world, thrower); this.ignoreFrustumCheck = true; this.isImmuneToFire = true; diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 2fdd58c9c..2b7fe6025 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -1609,7 +1609,6 @@ public class ModItems { public static Item gun_waluigi; public static Item gun_darter; public static Item gun_glass_cannon; - public static Item gun_m2; public static Item gun_lunatic_marksman; public static Item gun_uac_pistol; @@ -1637,6 +1636,7 @@ public class ModItems { public static Item gun_g3; public static Item gun_stinger; public static Item gun_chemthrower; + public static Item gun_m2; public static Item ammo_standard; @@ -4161,7 +4161,6 @@ public class ModItems { gun_moist_nugget = new ItemNugget(3, false).setUnlocalizedName("gun_moist_nugget").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_moist_nugget"); gun_darter = new ItemGunDart(GunDartFactory.getDarterConfig()).setFull3D().setUnlocalizedName("gun_darter").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_darter"); gun_glass_cannon = new ItemEnergyGunBase(GunPoweredFactory.getGlassCannonConfig()).setFull3D().setUnlocalizedName("gun_glass_cannon").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_darter"); - gun_m2 = new ItemGunBase(Gun50BMGFactory.getM2Config()).setFull3D().setUnlocalizedName("gun_m2").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_darter"); gun_lunatic_marksman = new ItemGunBase(Gun50BMGFactory.getLunaticMarksman()).setFull3D().setUnlocalizedName("gun_lunatic_marksman").setCreativeTab(MainRegistry.weaponTab); gun_uac_pistol = new ItemGunBase(Gun45ACPFactory.getUACPistolConfig(), Gun45ACPFactory.getUACPistolBurstConfig()).setFull3D().setUnlocalizedName("gun_uac_pistol").setCreativeTab(MainRegistry.weaponTab); @@ -6940,7 +6939,6 @@ public class ModItems { GameRegistry.registerItem(gun_flechette, gun_flechette.getUnlocalizedName()); GameRegistry.registerItem(gun_ar15, gun_ar15.getUnlocalizedName()); GameRegistry.registerItem(gun_calamity, gun_calamity.getUnlocalizedName()); - GameRegistry.registerItem(gun_m2, gun_m2.getUnlocalizedName()); GameRegistry.registerItem(gun_minigun, gun_minigun.getUnlocalizedName()); GameRegistry.registerItem(gun_lacunae, gun_lacunae.getUnlocalizedName()); GameRegistry.registerItem(gun_folly, gun_folly.getUnlocalizedName()); @@ -7025,6 +7023,7 @@ public class ModItems { GameRegistry.registerItem(gun_g3, gun_g3.getUnlocalizedName()); GameRegistry.registerItem(gun_stinger, gun_stinger.getUnlocalizedName()); GameRegistry.registerItem(gun_chemthrower, gun_chemthrower.getUnlocalizedName()); + GameRegistry.registerItem(gun_m2, gun_m2.getUnlocalizedName()); GameRegistry.registerItem(ammo_standard, ammo_standard.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/items/weapon/ItemCryoCannon.java b/src/main/java/com/hbm/items/weapon/ItemCryoCannon.java index 4831b4556..d35d177b1 100644 --- a/src/main/java/com/hbm/items/weapon/ItemCryoCannon.java +++ b/src/main/java/com/hbm/items/weapon/ItemCryoCannon.java @@ -69,7 +69,7 @@ public class ItemCryoCannon extends ItemGunBase { @Override protected void spawnProjectile(World world, EntityPlayer player, ItemStack stack, int config) { - EntityChemical chem = new EntityChemical(world, player); + EntityChemical chem = new EntityChemical(world, player, 0, 0, 0); chem.setFluid(Fluids.OXYGEN); world.spawnEntityInWorld(chem); diff --git a/src/main/java/com/hbm/items/weapon/ItemGunChemthrower.java b/src/main/java/com/hbm/items/weapon/ItemGunChemthrower.java index b37da9f1d..9dec64259 100644 --- a/src/main/java/com/hbm/items/weapon/ItemGunChemthrower.java +++ b/src/main/java/com/hbm/items/weapon/ItemGunChemthrower.java @@ -87,7 +87,7 @@ public class ItemGunChemthrower extends ItemGunBase implements IFillableItem { @Override protected void spawnProjectile(World world, EntityPlayer player, ItemStack stack, int config) { //spawn fluid projectile - EntityChemical chem = new EntityChemical(world, player); + EntityChemical chem = new EntityChemical(world, player, 0, 0, 0); chem.setFluid(this.getFluidType(stack)); world.spawnEntityInWorld(chem); } 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 a9123315b..a8e3bcfba 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 @@ -56,6 +56,7 @@ public class GunFactory { XFactoryFlamer.init(); XFactoryRocket.init(); XFactory556mm.init(); + XFactory50.init(); /// PROXY BULLSHIT /// MainRegistry.proxy.registerGunCfg(); @@ -69,6 +70,7 @@ public class GunFactory { P9_SP, P9_FMJ, P9_JHP, P9_AP, R556_SP, R556_FMJ, R556_JHP, R556_AP, R762_SP, R762_FMJ, R762_JHP, R762_AP, R762_DU, + BMG50_SP, BMG50_FMJ, BMG50_JHP, BMG50_AP, BMG50_DU, G12_BP, G12_BP_MAGNUM, G12_BP_SLUG, G12, G40_FLARE, G40, ROCKET_HE, ROCKET_HEAT, 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 b9a3b0294..62772ae2a 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 @@ -6,6 +6,7 @@ import static com.hbm.items.weapon.sedna.factory.XFactory22lr.*; import static com.hbm.items.weapon.sedna.factory.XFactory357.*; import static com.hbm.items.weapon.sedna.factory.XFactory40mm.*; import static com.hbm.items.weapon.sedna.factory.XFactory44.*; +import static com.hbm.items.weapon.sedna.factory.XFactory50.*; import static com.hbm.items.weapon.sedna.factory.XFactory556mm.*; import static com.hbm.items.weapon.sedna.factory.XFactory762mm.*; import static com.hbm.items.weapon.sedna.factory.XFactory9mm.*; @@ -43,6 +44,7 @@ public class GunFactoryClient { MinecraftForgeClient.registerItemRenderer(ModItems.gun_g3, new ItemRenderG3()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_stinger, new ItemRenderStinger()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_chemthrower, new ItemRenderChemthrower()); + MinecraftForgeClient.registerItemRenderer(ModItems.gun_m2, new ItemRenderM2()); //PROJECTILES ammo_debug.setRenderer(LegoClient.RENDER_STANDARD_BULLET); ammo_debug_buckshot.setRenderer(LegoClient.RENDER_STANDARD_BULLET); @@ -81,6 +83,11 @@ public class GunFactoryClient { r556_fmj.setRenderer(LegoClient.RENDER_STANDARD_BULLET); r556_jhp.setRenderer(LegoClient.RENDER_STANDARD_BULLET); r556_ap.setRenderer(LegoClient.RENDER_AP_BULLET); + bmg50_sp.setRenderer(LegoClient.RENDER_STANDARD_BULLET); + bmg50_fmj.setRenderer(LegoClient.RENDER_STANDARD_BULLET); + bmg50_jhp.setRenderer(LegoClient.RENDER_STANDARD_BULLET); + bmg50_ap.setRenderer(LegoClient.RENDER_AP_BULLET); + bmg50_du.setRenderer(LegoClient.RENDER_DU_BULLET); //HUDS ((ItemGunBaseNT) ModItems.gun_debug) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); ((ItemGunBaseNT) ModItems.gun_pepperbox) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); @@ -101,7 +108,8 @@ public class GunFactoryClient { ((ItemGunBaseNT) ModItems.gun_panzerschreck) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); ((ItemGunBaseNT) ModItems.gun_g3) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); ((ItemGunBaseNT) ModItems.gun_stinger) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); - ((ItemGunBaseNT) ModItems.gun_chemthrower) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO_NOCOUNTER); + ((ItemGunBaseNT) ModItems.gun_chemthrower) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); + ((ItemGunBaseNT) ModItems.gun_m2) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); ((ItemGunBaseNT) ModItems.gun_light_revolver_dani).getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY_MIRROR, LegoClient.HUD_COMPONENT_AMMO_MIRROR); ((ItemGunBaseNT) ModItems.gun_light_revolver_dani).getConfig(null, 1).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO); 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 aba68cf83..4c7eccfcd 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 @@ -688,4 +688,51 @@ public class Orchestras { if(timer == 30) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.insertCanister", 1F, 1F); } }; + + public static BiConsumer ORCHESTRA_CHEMTHROWER = (stack, ctx) -> { + EntityPlayer player = ctx.player; + AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); + int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); + + if(type == AnimType.CYCLE && player.worldObj.isRemote) { + AudioWrapper runningAudio = ItemGunBaseNT.loopedSounds.get(player); + + if(timer < 5) { + //start sound + if(runningAudio == null || !runningAudio.isPlaying()) { + AudioWrapper audio = MainRegistry.proxy.getLoopedSound("hbm:weapon.fire.flameLoop", (float) player.posX, (float) player.posY, (float) player.posZ, 1F, 15F, 1F, 10); + ItemGunBaseNT.loopedSounds.put(player, audio); + audio.startSound(); + } + //keepalive + if(runningAudio != null && runningAudio.isPlaying()) { + runningAudio.keepAlive(); + runningAudio.updatePosition((float) player.posX, (float) player.posY, (float) player.posZ); + } + } else { + //stop sound due to timeout + if(runningAudio != null && runningAudio.isPlaying()) runningAudio.stopSound(); + } + } + //stop sound due to state change + if(type != AnimType.CYCLE && player.worldObj.isRemote) { + AudioWrapper runningAudio = ItemGunBaseNT.loopedSounds.get(player); + if(runningAudio != null && runningAudio.isPlaying()) runningAudio.stopSound(); + } + }; + + public static BiConsumer ORCHESTRA_M2 = (stack, ctx) -> { + EntityPlayer player = ctx.player; + if(player.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 == 0) { + SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack); + if(casing != null) CasingCreator.composeEffect(player.worldObj, player, 0.375, aiming ? 0 : -0.125, aiming ? 0 : -0.3125D, 0, 0.06, -0.18, 0.01, casing.getName()); + } + } + }; } diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory50.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory50.java new file mode 100644 index 000000000..fa9425c42 --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory50.java @@ -0,0 +1,72 @@ +package com.hbm.items.weapon.sedna.factory; + +import java.util.function.BiConsumer; +import java.util.function.BiFunction; + +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.ItemGunBaseNT.LambdaContext; +import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; +import com.hbm.items.weapon.sedna.mags.MagazineFullReload; +import com.hbm.lib.RefStrings; +import com.hbm.particle.SpentCasing; +import com.hbm.particle.SpentCasing.CasingType; +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 XFactory50 { + + public static BulletConfig bmg50_sp; + public static BulletConfig bmg50_fmj; + public static BulletConfig bmg50_jhp; + public static BulletConfig bmg50_ap; + public static BulletConfig bmg50_du; + + public static void init() { + SpentCasing casing762 = new SpentCasing(CasingType.BOTTLENECK).setColor(SpentCasing.COLOR_CASE_BRASS).setScale(1.5F); + bmg50_sp = new BulletConfig().setItem(EnumAmmo.BMG50_SP) + .setCasing(casing762.clone().register("bmg50")); + bmg50_fmj = new BulletConfig().setItem(EnumAmmo.BMG50_FMJ).setDamage(0.8F).setArmorPiercing(0.1F) + .setCasing(casing762.clone().register("bmg50fmj")); + bmg50_jhp = new BulletConfig().setItem(EnumAmmo.BMG50_JHP).setDamage(1.5F).setArmorPiercing(-0.25F) + .setCasing(casing762.clone().register("bmg50jhp")); + bmg50_ap = new BulletConfig().setItem(EnumAmmo.BMG50_AP).setDoesPenetrate(true).setDamageFalloutByPen(false).setDamage(1.5F).setArmorPiercing(0.15F) + .setCasing(casing762.clone().setColor(SpentCasing.COLOR_CASE_44).register("bmg50ap")); + bmg50_du = new BulletConfig().setItem(EnumAmmo.BMG50_DU).setDoesPenetrate(true).setDamageFalloutByPen(false).setDamage(2.5F).setArmorPiercing(0.25F) + .setCasing(casing762.clone().setColor(SpentCasing.COLOR_CASE_44).register("bmg50du")); + + ModItems.gun_m2 = new ItemGunBaseNT(new GunConfig() + .dura(3_000).draw(10).inspect(31).crosshair(Crosshair.L_CIRCLE).smoke(LAMBDA_SMOKE) + .rec(new Receiver(0) + .dmg(5F).delay(2).dry(10).auto(true).spread(0.005F).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F) + .mag(new MagazineFullReload(0, 30).addConfigs(bmg50_sp, bmg50_fmj, bmg50_jhp, bmg50_ap, bmg50_du)) + .offset(1, -0.0625 * 2.5, -0.25D) + .setupStandardFire().recoil(Lego.LAMBDA_STANDARD_RECOIL)) + .setupStandardConfiguration() + .anim(LAMBDA_M2_ANIMS).orchestra(Orchestras.ORCHESTRA_M2) + ).setUnlocalizedName("gun_m2").setTextureName(RefStrings.MODID + ":gun_darter"); + } + + public static BiConsumer LAMBDA_SMOKE = (stack, ctx) -> { + Lego.handleStandardSmoke(ctx.player, stack, 2000, 0.05D, 1.1D, 0); + }; + + @SuppressWarnings("incomplete-switch") public static BiFunction LAMBDA_M2_ANIMS = (stack, type) -> { + switch(type) { + case EQUIP: return new BusAnimation() + .addBus("EQUIP", new BusAnimationSequence().addPos(80, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL)); + case CYCLE: return new BusAnimation() + .addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, -0.25, 25).addPos(0, 0, 0, 75)); + } + + return null; + }; +} diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryFlamer.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryFlamer.java index f4b1b58e1..8135a8c68 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryFlamer.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryFlamer.java @@ -55,11 +55,11 @@ public class XFactoryFlamer { .dura(90_000).draw(10).inspect(17).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE) .rec(new Receiver(0) .delay(1).auto(true) - .mag(new MagazineFluid(0, 300)) + .mag(new MagazineFluid(0, 3_000)) .offset(0.75, -0.0625, -0.25D) .canFire(ItemGunChemthrower.LAMBDA_CAN_FIRE).fire(ItemGunChemthrower.LAMBDA_FIRE)) .pp(Lego.LAMBDA_STANDARD_CLICK_PRIMARY).decider(GunStateDecider.LAMBDA_STANDARD_DECIDER) - .anim(LAMBDA_CHEMTHROWER_ANIMS).orchestra(Orchestras.ORCHESTRA_FLAMER) + .anim(LAMBDA_CHEMTHROWER_ANIMS).orchestra(Orchestras.ORCHESTRA_CHEMTHROWER) ).setUnlocalizedName("gun_chemthrower").setTextureName(RefStrings.MODID + ":gun_darter"); } diff --git a/src/main/java/com/hbm/items/weapon/sedna/impl/ItemGunChemthrower.java b/src/main/java/com/hbm/items/weapon/sedna/impl/ItemGunChemthrower.java index 6eae059ec..4d21faecf 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/impl/ItemGunChemthrower.java +++ b/src/main/java/com/hbm/items/weapon/sedna/impl/ItemGunChemthrower.java @@ -6,7 +6,6 @@ import java.util.function.BiFunction; import com.hbm.entity.projectile.EntityChemical; import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; -import com.hbm.items.weapon.sedna.BulletConfig; import com.hbm.items.weapon.sedna.GunConfig; import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.Receiver; @@ -84,18 +83,17 @@ public class ItemGunChemthrower extends ItemGunBaseNT implements IFillableItem { Receiver primary = ctx.config.getReceivers(stack)[0]; IMagazine mag = primary.getMagazine(stack); - BulletConfig config = (BulletConfig) mag.getType(stack); Vec3 offset = primary.getProjectileOffset(stack); double forwardOffset = offset.xCoord; double heightOffset = offset.yCoord; double sideOffset = offset.zCoord; - EntityChemical chem = new EntityChemical(player.worldObj, player); + EntityChemical chem = new EntityChemical(player.worldObj, player, sideOffset, heightOffset, forwardOffset); chem.setFluid((FluidType) mag.getType(stack)); player.worldObj.spawnEntityInWorld(chem); mag.setAmount(stack, mag.getAmount(stack) - CONSUMPTION); - ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + config.wear, ctx.config.getDurability(stack))); + ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + 1F, ctx.config.getDurability(stack))); }; } diff --git a/src/main/java/com/hbm/items/weapon/sedna/mags/MagazineFluid.java b/src/main/java/com/hbm/items/weapon/sedna/mags/MagazineFluid.java index bfe8d5caa..44f83d895 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/mags/MagazineFluid.java +++ b/src/main/java/com/hbm/items/weapon/sedna/mags/MagazineFluid.java @@ -50,7 +50,7 @@ public class MagazineFluid implements IMagazine { @Override public SpentCasing getCasing(ItemStack stack) { return null; } @Override public ItemStack getIconForHUD(ItemStack stack) { return new ItemStack(ModItems.fluid_icon, 1, this.getMagType(stack, index)); } - @Override public String reportAmmoStateForHUD(ItemStack stack) { return getAmount(stack) + " / " + getCapacity(stack) + "mB"; } + @Override public String reportAmmoStateForHUD(ItemStack stack) { return getIconForHUD(stack).getDisplayName(); } @Override public void setAmountBeforeReload(ItemStack stack, int amount) { ItemGunBaseNT.setValueInt(stack, KEY_MAG_PREV + index, amount); } @Override public int getAmountBeforeReload(ItemStack stack) { return ItemGunBaseNT.getValueInt(stack, KEY_MAG_PREV + index); } diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index 234f22f1f..f4b679989 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -589,8 +589,6 @@ public class ClientProxy extends ServerProxy { MinecraftForgeClient.registerItemRenderer(ModItems.detonator_laser, new ItemRenderDetonatorLaser()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_remington, new ItemRenderWeaponRemington()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_glass_cannon, new ItemRenderWeaponGlass()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_chemthrower, new ItemRenderWeaponChemthrower()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_m2, new ItemRenderM2()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_revolver_nopip, new ItemRenderWeaponNovac()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_revolver_pip, new ItemRenderWeaponLilMac()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_revolver_blackjack, new ItemRenderWeaponNovac()); diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderChemthrower.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderChemthrower.java index c3a3430f9..cac296b8e 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderChemthrower.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderChemthrower.java @@ -1,26 +1,92 @@ 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.mags.IMagazine; +import com.hbm.main.ResourceManager; +import com.hbm.render.anim.HbmAnimations; + +import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; -import net.minecraftforge.client.IItemRenderer; -public class ItemRenderChemthrower implements IItemRenderer { +public class ItemRenderChemthrower extends ItemRenderWeaponBase { @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - // TODO Auto-generated method stub - return false; + protected float getTurnMagnitude(ItemStack stack) { return ItemGunBaseNT.getIsAiming(stack) ? 2.5F : -0.25F; } + + @Override + public void setupFirstPerson(ItemStack stack) { + GL11.glTranslated(0, 0, 0.875); + + float offset = 0.8F; + standardAimingTransform(stack, + -2F * offset, -2F * offset, 2.5F * offset, + 0, -4.375 / 8D, 1); } @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - // TODO Auto-generated method stub - return false; + public void renderFirstPerson(ItemStack stack) { + + ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); + Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.chemthrower_tex); + double scale = 0.75D; + GL11.glScaled(scale, scale, scale); + + double[] equip = HbmAnimations.getRelevantTransformation("EQUIP"); + + GL11.glTranslated(0, -2, -4); + GL11.glRotated(equip[0], -1, 0, 0); + GL11.glTranslated(0, 2, 4); + + GL11.glShadeModel(GL11.GL_SMOOTH); + + GL11.glRotated(90, 0, 1, 0); + ResourceManager.chemthrower.renderPart("Gun"); + ResourceManager.chemthrower.renderPart("Hose"); + ResourceManager.chemthrower.renderPart("Nozzle"); + + GL11.glTranslated(0, 0.875, 1.75); + IMagazine mag = gun.getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack); + double d = (double) mag.getAmount(stack) / (double) mag.getCapacity(stack); + GL11.glRotated(135 - d * 270, 1, 0, 0); + GL11.glTranslated(0, -0.875, -1.75); + + ResourceManager.chemthrower.renderPart("Gauge"); + + GL11.glShadeModel(GL11.GL_FLAT); } @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - // TODO Auto-generated method stub + public void setupThirdPerson(ItemStack stack) { + super.setupThirdPerson(stack); + double scale = 2D; + GL11.glScaled(scale, scale, scale); + GL11.glTranslated(0, -2.5, 0.5); } + @Override + public void setupInv(ItemStack stack) { + super.setupInv(stack); + double scale = 2D; + GL11.glScaled(scale, scale, scale); + GL11.glRotated(25, 1, 0, 0); + GL11.glRotated(45, 0, 1, 0); + GL11.glTranslated(0.875, 0, 0); + } + + @Override + public void renderOther(ItemStack stack, ItemRenderType type) { + GL11.glEnable(GL11.GL_LIGHTING); + + GL11.glRotated(90, 0, 1, 0); + GL11.glShadeModel(GL11.GL_SMOOTH); + Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.chemthrower_tex); + ResourceManager.chemthrower.renderPart("Gun"); + ResourceManager.chemthrower.renderPart("Hose"); + ResourceManager.chemthrower.renderPart("Nozzle"); + ResourceManager.chemthrower.renderPart("Gauge"); + GL11.glShadeModel(GL11.GL_FLAT); + } } diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderM2.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderM2.java new file mode 100644 index 000000000..165593a13 --- /dev/null +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderM2.java @@ -0,0 +1,100 @@ +package com.hbm.render.item.weapon.sedna; + +import org.lwjgl.opengl.GL11; + +import com.hbm.items.weapon.sedna.ItemGunBaseNT; +import com.hbm.main.ResourceManager; +import com.hbm.render.anim.HbmAnimations; + +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; + +public class ItemRenderM2 extends ItemRenderWeaponBase { + + @Override + protected float getTurnMagnitude(ItemStack stack) { return ItemGunBaseNT.getIsAiming(stack) ? 2.5F : -0.5F; } + + @Override + public void setupFirstPerson(ItemStack stack) { + GL11.glTranslated(0, 0, 0.875); + + float offset = 0.8F; + standardAimingTransform(stack, + -1.5F * offset, -2.5F * offset, 1.75F * offset, + 0, -12.5 / 8D, 1.75); + } + + @Override + public void renderFirstPerson(ItemStack stack) { + + ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); + Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.greasegun_tex); + double scale = 0.75D; + GL11.glScaled(scale, scale, scale); + + double[] equip = HbmAnimations.getRelevantTransformation("EQUIP"); + double[] recoil = HbmAnimations.getRelevantTransformation("RECOIL"); + + GL11.glTranslated(0, 1, -2.25); + GL11.glRotated(equip[0], 1, 0, 0); + GL11.glTranslated(0, -1, 2.25); + + GL11.glTranslated(0, 0, recoil[2]); + + GL11.glShadeModel(GL11.GL_SMOOTH); + + GL11.glPushMatrix(); + GL11.glRotated(180, 0, 1, 0); + Minecraft.getMinecraft().getTextureManager().bindTexture(ResourceManager.m2_tex); + ResourceManager.m2.renderAll(); + GL11.glPopMatrix(); + + double smokeScale = 0.5; + + GL11.glPushMatrix(); + GL11.glTranslated(0, 1.625, 5); + GL11.glRotated(90, 0, 1, 0); + GL11.glScaled(smokeScale, smokeScale, smokeScale); + this.renderSmokeNodes(gun.getConfig(stack, 0).smokeNodes, 0.375D); + GL11.glPopMatrix(); + + GL11.glShadeModel(GL11.GL_FLAT); + + GL11.glPushMatrix(); + GL11.glTranslated(0, 1.625, 5); + GL11.glRotated(90, 0, 1, 0); + GL11.glRotated(90 * gun.shotRand, 1, 0, 0); + GL11.glScaled(0.5, 0.5, 0.5); + this.renderMuzzleFlash(gun.lastShot[0], 75, 7.5); + GL11.glPopMatrix(); + } + + @Override + public void setupThirdPerson(ItemStack stack) { + super.setupThirdPerson(stack); + double scale = 5D; + GL11.glScaled(scale, scale, scale); + GL11.glTranslated(0.5, -2, 3); + } + + @Override + public void setupInv(ItemStack stack) { + super.setupInv(stack); + double scale = 2.625D; + GL11.glScaled(scale, scale, scale); + GL11.glRotated(25, 1, 0, 0); + GL11.glRotated(45, 0, 1, 0); + GL11.glTranslated(0.5, -1.25, 0); + } + + @Override + public void renderOther(ItemStack stack, ItemRenderType type) { + GL11.glEnable(GL11.GL_LIGHTING); + + GL11.glRotated(180, 0, 1, 0); + GL11.glShadeModel(GL11.GL_SMOOTH); + Minecraft.getMinecraft().getTextureManager().bindTexture(ResourceManager.m2_tex); + ResourceManager.m2.renderAll(); + GL11.glShadeModel(GL11.GL_FLAT); + } +} diff --git a/src/main/resources/assets/hbm/textures/items/ammo_standard.bmg50_ap.png b/src/main/resources/assets/hbm/textures/items/ammo_standard.bmg50_ap.png new file mode 100644 index 000000000..0892a1817 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/ammo_standard.bmg50_ap.png differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_standard.bmg50_du.png b/src/main/resources/assets/hbm/textures/items/ammo_standard.bmg50_du.png new file mode 100644 index 000000000..11994e39e Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/ammo_standard.bmg50_du.png differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_standard.bmg50_fmj.png b/src/main/resources/assets/hbm/textures/items/ammo_standard.bmg50_fmj.png new file mode 100644 index 000000000..bbe08b3fa Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/ammo_standard.bmg50_fmj.png differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_standard.bmg50_jhp.png b/src/main/resources/assets/hbm/textures/items/ammo_standard.bmg50_jhp.png new file mode 100644 index 000000000..1692e288b Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/ammo_standard.bmg50_jhp.png differ diff --git a/src/main/resources/assets/hbm/textures/items/ammo_standard.bmg50_sp.png b/src/main/resources/assets/hbm/textures/items/ammo_standard.bmg50_sp.png new file mode 100644 index 000000000..5a61f083b Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/ammo_standard.bmg50_sp.png differ