From 3b94f3dafd15817f99ce49fdc09b1180c585e7b9 Mon Sep 17 00:00:00 2001 From: Boblet Date: Fri, 11 Aug 2023 12:02:18 +0200 Subject: [PATCH] 40mm leadburster --- .../entity/projectile/EntityThrowableNT.java | 43 ++++---- .../com/hbm/handler/guncfg/Gun9mmFactory.java | 2 +- .../hbm/handler/guncfg/GunGrenadeFactory.java | 103 +++++++++++++++++- src/main/java/com/hbm/items/ModItems.java | 3 + src/main/java/com/hbm/lib/HbmCollection.java | 4 +- src/main/resources/assets/hbm/lang/en_US.lang | 2 +- .../assets/hbm/textures/items/boltgun.png | Bin 0 -> 324 bytes .../assets/hbm/textures/items/gun_ar15.png | Bin 0 -> 208 bytes .../hbm/textures/items/gun_bio_revolver.png | Bin 0 -> 309 bytes .../assets/hbm/textures/items/gun_coilgun.png | Bin 0 -> 341 bytes .../assets/hbm/textures/items/gun_flamer.png | Bin 0 -> 304 bytes .../assets/hbm/textures/items/gun_spas12.png | Bin 0 -> 227 bytes 12 files changed, 132 insertions(+), 25 deletions(-) create mode 100644 src/main/resources/assets/hbm/textures/items/boltgun.png create mode 100644 src/main/resources/assets/hbm/textures/items/gun_ar15.png create mode 100644 src/main/resources/assets/hbm/textures/items/gun_bio_revolver.png create mode 100644 src/main/resources/assets/hbm/textures/items/gun_coilgun.png create mode 100644 src/main/resources/assets/hbm/textures/items/gun_flamer.png create mode 100644 src/main/resources/assets/hbm/textures/items/gun_spas12.png diff --git a/src/main/java/com/hbm/entity/projectile/EntityThrowableNT.java b/src/main/java/com/hbm/entity/projectile/EntityThrowableNT.java index 892e59e79..15cda441f 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityThrowableNT.java +++ b/src/main/java/com/hbm/entity/projectile/EntityThrowableNT.java @@ -234,27 +234,30 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile { } } - float hyp = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - - for(this.rotationPitch = (float) (Math.atan2(this.motionY, (double) hyp) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { - ; + if(!this.onGround) { + float hyp = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + + for(this.rotationPitch = (float) (Math.atan2(this.motionY, (double) hyp) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { + ; + } + + while(this.rotationPitch - this.prevRotationPitch >= 180.0F) { + this.prevRotationPitch += 360.0F; + } + + while(this.rotationYaw - this.prevRotationYaw < -180.0F) { + this.prevRotationYaw -= 360.0F; + } + + while(this.rotationYaw - this.prevRotationYaw >= 180.0F) { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; } - - while(this.rotationPitch - this.prevRotationPitch >= 180.0F) { - this.prevRotationPitch += 360.0F; - } - - while(this.rotationYaw - this.prevRotationYaw < -180.0F) { - this.prevRotationYaw -= 360.0F; - } - - while(this.rotationYaw - this.prevRotationYaw >= 180.0F) { - this.prevRotationYaw += 360.0F; - } - - this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; - this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + float drag = this.getAirDrag(); double gravity = this.getGravityVelocity(); diff --git a/src/main/java/com/hbm/handler/guncfg/Gun9mmFactory.java b/src/main/java/com/hbm/handler/guncfg/Gun9mmFactory.java index 827950fd8..2e7c68cc4 100644 --- a/src/main/java/com/hbm/handler/guncfg/Gun9mmFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/Gun9mmFactory.java @@ -44,7 +44,7 @@ public class Gun9mmFactory { config.reloadSoundEnd = false; config.name = "mp40"; - config.manufacturer = EnumGunManufacturer.NAZI; + config.manufacturer = EnumGunManufacturer.ERFURT; config.config = new ArrayList(); config.config.add(BulletConfigSyncingUtil.P9_NORMAL); diff --git a/src/main/java/com/hbm/handler/guncfg/GunGrenadeFactory.java b/src/main/java/com/hbm/handler/guncfg/GunGrenadeFactory.java index 2d31dca38..d6516af60 100644 --- a/src/main/java/com/hbm/handler/guncfg/GunGrenadeFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/GunGrenadeFactory.java @@ -2,6 +2,7 @@ package com.hbm.handler.guncfg; import java.util.ArrayList; +import com.hbm.entity.projectile.EntityBulletBaseNT; import com.hbm.explosion.ExplosionNukeSmall; import com.hbm.handler.BulletConfigSyncingUtil; import com.hbm.handler.BulletConfiguration; @@ -14,14 +15,20 @@ import com.hbm.lib.HbmCollection.EnumGunManufacturer; import com.hbm.particle.SpentCasing; import com.hbm.particle.SpentCasing.CasingType; import com.hbm.render.util.RenderScreenOverlay.Crosshair; +import com.hbm.util.TrackerUtil; + +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; public class GunGrenadeFactory { - + private static final CasingEjector EJECTOR_LAUNCHER; + private static final CasingEjector EJECTOR_CONGOLAKE; private static final SpentCasing CASING40MM; static { EJECTOR_LAUNCHER = new CasingEjector().setAngleRange(0.02F, 0.03F).setAfterReload(); + EJECTOR_CONGOLAKE = new CasingEjector().setMotion(0.3, 0.1, 0).setAngleRange(0.02F, 0.03F).setDelay(15); CASING40MM = new SpentCasing(CasingType.STRAIGHT).setScale(4F, 4F, 3F).setBounceMotion(0.02F, 0.03F).setColor(0x777777).setupSmoke(1F, 0.5D, 60, 40); } @@ -67,6 +74,47 @@ public class GunGrenadeFactory { return config; } + + public static GunConfiguration getCongoConfig() { + + GunConfiguration config = new GunConfiguration(); + + config.rateOfFire = 30; + config.roundsPerCycle = 1; + config.gunMode = GunConfiguration.MODE_NORMAL; + config.firingMode = GunConfiguration.FIRE_MANUAL; + config.reloadDuration = 20; + config.firingDuration = 0; + config.ammoCap = 4; + config.reloadType = GunConfiguration.RELOAD_SINGLE; + config.allowsInfinity = true; + config.crosshair = Crosshair.L_CIRCUMFLEX; + config.firingSound = "hbm:weapon.hkShoot"; + config.reloadSound = GunConfiguration.RSOUND_GRENADE; + config.reloadSoundEnd = false; + + config.name = "congoLake"; + config.manufacturer = EnumGunManufacturer.NAWS; + + config.config = new ArrayList(); + config.config.add(BulletConfigSyncingUtil.GRENADE_NORMAL); + config.config.add(BulletConfigSyncingUtil.GRENADE_HE); + config.config.add(BulletConfigSyncingUtil.GRENADE_INCENDIARY); + config.config.add(BulletConfigSyncingUtil.GRENADE_PHOSPHORUS); + config.config.add(BulletConfigSyncingUtil.GRENADE_CHEMICAL); + config.config.add(BulletConfigSyncingUtil.GRENADE_CONCUSSION); + config.config.add(BulletConfigSyncingUtil.GRENADE_FINNED); + config.config.add(BulletConfigSyncingUtil.GRENADE_SLEEK); + config.config.add(BulletConfigSyncingUtil.GRENADE_NUCLEAR); + config.config.add(BulletConfigSyncingUtil.GRENADE_TRACER); + config.config.add(BulletConfigSyncingUtil.GRENADE_KAMPF); + config.config.add(BulletConfigSyncingUtil.GRENADE_LEADBURSTER); + config.durability = 1500; + + config.ejector = EJECTOR_CONGOLAKE; + + return config; + } public static BulletConfiguration getGrenadeConfig() { @@ -265,7 +313,58 @@ public class GunGrenadeFactory { bullet.explosive = 0F; bullet.style = BulletConfiguration.STYLE_APDS; bullet.doesRicochet = false; - BulletConfigFactory.makeFlechette(bullet); + + bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> { + + Vec3 vec = Vec3.createVectorHelper(0, 0, 1); + vec.rotateAroundX((float) -Math.toRadians(bulletnt.rotationPitch)); + vec.rotateAroundY((float) Math.toRadians(bulletnt.rotationYaw)); + + bulletnt.posX -= vec.xCoord * 0.1; + bulletnt.posY -= vec.yCoord * 0.1; + bulletnt.posZ -= vec.zCoord * 0.1; + + bulletnt.getStuck(x, y, z, sideHit); + }; + + bullet.bntUpdate = (bulletnt) -> { + if(bulletnt.worldObj.isRemote) return; + + switch(bulletnt.getStuckIn()) { + case 0: bulletnt.rotationPitch = (float) (90); break; + case 1: bulletnt.rotationPitch = (float) (-90); break; + case 2: bulletnt.rotationPitch = 0; bulletnt.rotationYaw = 0; break; + case 3: bulletnt.rotationPitch = 0; bulletnt.rotationYaw = (float) 180; break; + case 4: bulletnt.rotationPitch = 0; bulletnt.rotationYaw = 90; break; + case 5: bulletnt.rotationPitch = 0; bulletnt.rotationYaw = (float) -90; break; + } + + if(bulletnt.ticksInGround < 20) return; + int timer = bulletnt.ticksInGround - 20; + if(timer > 60) return; + + for(int i = 0; i < 5; i++) { + Vec3 vec = Vec3.createVectorHelper(0, 1, 0); + vec.rotateAroundX((float) Math.toRadians(11.25 * i)); + vec.rotateAroundZ((float) -Math.toRadians(13 * timer)); + vec.rotateAroundX((float) (bulletnt.rotationPitch * Math.PI / 180D)); + vec.rotateAroundY((float) (bulletnt.rotationYaw * Math.PI / 180)); + + EntityBulletBaseNT pellet = new EntityBulletBaseNT(bulletnt.worldObj, BulletConfigSyncingUtil.R556_NORMAL); + double dist = 0.5; + pellet.setPosition(bulletnt.posX + vec.xCoord * dist, bulletnt.posY + vec.yCoord * dist, bulletnt.posZ + vec.zCoord * dist); + double vel = 0.5; + pellet.motionX = vec.xCoord * vel; + pellet.motionY = vec.yCoord * vel; + pellet.motionZ = vec.zCoord * vel; + + float hyp = MathHelper.sqrt_double(pellet.motionX * pellet.motionX + pellet.motionZ * pellet.motionZ); + pellet.prevRotationYaw = pellet.rotationYaw = (float) (Math.atan2(pellet.motionX, pellet.motionZ) * 180.0D / Math.PI); + pellet.prevRotationPitch = pellet.rotationPitch = (float) (Math.atan2(pellet.motionY, (double) hyp) * 180.0D / Math.PI); + + bulletnt.worldObj.spawnEntityInWorld(pellet); + } + }; return bullet; } diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 8ec82b805..f4be014fc 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -1522,6 +1522,7 @@ public class ModItems { public static Item gun_panzerschreck; public static Item gun_quadro; public static Item gun_hk69; + public static Item gun_congolake; public static Item gun_stinger; public static Item gun_skystinger; public static Item gun_revolver; @@ -4127,6 +4128,7 @@ public class ModItems { gun_panzerschreck = new ItemGunBase(GunRocketFactory.getPanzConfig()).setUnlocalizedName("gun_panzerschreck").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_panzerschreck"); gun_quadro = new ItemGunBase(GunRocketFactory.getQuadroConfig()).setUnlocalizedName("gun_quadro").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_quadro"); gun_hk69 = new ItemGunBase(GunGrenadeFactory.getHK69Config()).setUnlocalizedName("gun_hk69").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_hk69"); + gun_congolake = new ItemGunBase(GunGrenadeFactory.getHK69Config()).setUnlocalizedName("gun_congolake").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_congolake"); gun_stinger = new ItemGunBase(GunRocketHomingFactory.getStingerConfig()).setUnlocalizedName("gun_stinger").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_stinger"); gun_skystinger = new ItemGunBase(GunRocketHomingFactory.getSkyStingerConfig()).setUnlocalizedName("gun_skystinger").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_skystinger"); gun_revolver = new ItemGunBase(Gun357MagnumFactory.getRevolverConfig()).setUnlocalizedName("gun_revolver").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_revolver"); @@ -6992,6 +6994,7 @@ public class ModItems { GameRegistry.registerItem(gun_panzerschreck, gun_panzerschreck.getUnlocalizedName()); GameRegistry.registerItem(gun_quadro, gun_quadro.getUnlocalizedName()); GameRegistry.registerItem(gun_hk69, gun_hk69.getUnlocalizedName()); + GameRegistry.registerItem(gun_congolake, gun_congolake.getUnlocalizedName()); GameRegistry.registerItem(gun_stinger, gun_stinger.getUnlocalizedName()); GameRegistry.registerItem(gun_fatman, gun_fatman.getUnlocalizedName()); GameRegistry.registerItem(gun_proto, gun_proto.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/lib/HbmCollection.java b/src/main/java/com/hbm/lib/HbmCollection.java index dba947b9b..6472f8338 100644 --- a/src/main/java/com/hbm/lib/HbmCollection.java +++ b/src/main/java/com/hbm/lib/HbmCollection.java @@ -133,8 +133,10 @@ public class HbmCollection { METRO, /**MWT Prototype Labs**/ MWT, + /**Naval Air Weapons Station**/ + NAWS, /**Erfurter Maschinenfabrik Geipel**/ - NAZI, + ERFURT, /**No manufacturer, just puts "-" **/ NONE, /**OxfordEM Technologies**/ diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 9c2194b06..a6bd587a5 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -1103,7 +1103,7 @@ gun.make.MANN=Open Mann Co. gun.make.MAXIM=Hiram Maxim gun.make.METRO=Metro Gunsmiths gun.make.MWT=MWT Prototype Labs -gun.make.NAZI=Erfurter Maschinenfabrik Geipel +gun.make.ERFURT=Erfurter Maschinenfabrik Geipel gun.make.NONE=- gun.make.RAYTHEON=Raytheon Missile Systems gun.make.REMINGTON=Remington Arms diff --git a/src/main/resources/assets/hbm/textures/items/boltgun.png b/src/main/resources/assets/hbm/textures/items/boltgun.png new file mode 100644 index 0000000000000000000000000000000000000000..a45e128a7d3b6ff0fb8223ba17365eb136ef8893 GIT binary patch literal 324 zcmV-K0lWT*P)OX;v3`+(CiJ|P|O8zPdZDfNr!0h3EcVy zZr~27(oh%-G?CISMYNX9Vtyp@s?|#0?0Yk_@Jxw_ew1;{K`EsHJkKMJW2YXe$~A{H zO&x$N%N{jh%ec8mmQ@ka#>FV`*>7_ImebkASe45%{N@h<=)Lv<$g>^M`=?dJy#$+n z0IZ?}fW9{%n1@z0w+=q+^1{g~O3*b$Dq}3a3@{ESx;yxb@Rh6?1-=#M=Df>A!0w4# z2O2fMe~LH&`)!Vf!a?I2Y1UlY06G3VNqH4A*T0v0edHk&_i z%{nnbs^sWV)4y}mgpS=c{$5l3E`{x1_1^t5N0!tF>2ER-3+}io2Bdz!k!W~5yEMIC zB!O$@m(J6>dzW?zHE7(*I)3re;tXvu1&2v*s;jGo8Gghm*lVqSb=5&Am+3w?%Ykj@ zwcjqBnqt6s;PvgztP4W=7{bqOxxAS5isJOmm%Uc^8*?%2u+U@(aJ{*+`(k@hy>-4s zng4v=^Apd>=*>CxC-%>$A0JJt62u=_3GM2;$Zi}}?>f)za!c_%XQ00sJYD@<);T3K F0RRF~esll; literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/hbm/textures/items/gun_coilgun.png b/src/main/resources/assets/hbm/textures/items/gun_coilgun.png new file mode 100644 index 0000000000000000000000000000000000000000..5c130d10963b9331ac31134f9c52517161628143 GIT binary patch literal 341 zcmV-b0jmCqP)s^l9Igqb{UsPIb`HJH zbp(&=nC_UO;x(8VTJ&rk=MPtPuu3Q#JbHKe1P zLubzV%V50nxn8)mfmDEplUD!)kja$3HE0D9dhvW~sbO~mz}3Q~Zw<&~%G8NCp5&qq z(9w%wcSBN`0EAA|D#;GOp5)>;h~3L;A+@pAo}rS$q&!Cfb}whV3IKSC9z`Rdl>R1n zsYfQ$ZAY<;XJYS!pSpOGA}P#0^VFGFGe=DTfcwuIGWk)}Z|Ad}e&Y!v*H`-HaJ$*o nzO*qxXg5ByiO)?RDvw{lA0>0#3}YHdLT;GDxb7uakv04R#W z1Egs>H#zxx;Ze=ZB3ZO;tHkDEficDdeEnVsik1wfCS_TU`@ZjI+ErDJTu|V_100MY z%d#0LvDQ-8wHgZq1o+8w0M7gUsuBfo&GX=H-?y6rFvj?IC2!yRS&0}#3rvu%>#)`? z!T`Hhung2N48(Cvk|Y8AGV(X3Qz>(?I-h*5&G`c~~M_$0000+FmO9Jz~7s z(#0W;_B1I1UCH3->gTe~DWM4f0fAA1 literal 0 HcmV?d00001