40mm leadburster

This commit is contained in:
Boblet 2023-08-11 12:02:18 +02:00
parent e3d77e54e3
commit 3b94f3dafd
12 changed files with 132 additions and 25 deletions

View File

@ -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();

View File

@ -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<Integer>();
config.config.add(BulletConfigSyncingUtil.P9_NORMAL);

View File

@ -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<Integer>();
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;
}

View File

@ -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());

View File

@ -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**/

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B