mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
fixing mojank spaghetti episode 58304
This commit is contained in:
parent
afd75b26af
commit
30e2a13f62
@ -166,6 +166,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
//style
|
||||
this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
|
||||
//trail
|
||||
@ -251,11 +252,11 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
if(mop.typeOfHit == mop.typeOfHit.BLOCK) {
|
||||
|
||||
boolean hRic = rand.nextInt(100) < config.HBRC;
|
||||
boolean doesRic = config.doesRicochet || hRic;
|
||||
boolean doesRic = config.doesRicochet && hRic;
|
||||
|
||||
if(!config.isSpectral && !doesRic) {
|
||||
this.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||
this.onBlockImpact(mop.blockX, mop.blockY, mop.blockZ);
|
||||
this.onBlockImpact(mop.blockX, mop.blockY, mop.blockZ, mop.sideHit);
|
||||
}
|
||||
|
||||
if(doesRic) {
|
||||
@ -302,7 +303,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
} else {
|
||||
if(!worldObj.isRemote) {
|
||||
this.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||
onBlockImpact(mop.blockX, mop.blockY, mop.blockZ);
|
||||
onBlockImpact(mop.blockX, mop.blockY, mop.blockZ, mop.sideHit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -375,13 +376,13 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
}
|
||||
|
||||
//for when a bullet dies by hitting a block
|
||||
private void onBlockImpact(int bX, int bY, int bZ) {
|
||||
private void onBlockImpact(int bX, int bY, int bZ, int sideHit) {
|
||||
|
||||
if(config.bntImpact != null)
|
||||
config.bntImpact.behaveBlockHit(this, bX, bY, bZ);
|
||||
config.bntImpact.behaveBlockHit(this, bX, bY, bZ, sideHit);
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
if(!config.liveAfterImpact && !config.isSpectral && bY > -1) this.setDead();
|
||||
if(!config.liveAfterImpact && !config.isSpectral && bY > -1 && !this.inGround) this.setDead();
|
||||
if(!config.doesPenetrate && bY == -1) this.setDead();
|
||||
}
|
||||
|
||||
@ -472,7 +473,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
//for when a bullet dies by hitting an entity
|
||||
private void onEntityImpact(Entity e) {
|
||||
onEntityHurt(e);
|
||||
onBlockImpact(-1, -1, -1);
|
||||
onBlockImpact(-1, -1, -1, -1);
|
||||
|
||||
if(config.bntHit != null)
|
||||
config.bntHit.behaveEntityHit(this, e);
|
||||
@ -582,6 +583,6 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
public static interface IBulletHurtBehaviorNT { public void behaveEntityHurt(EntityBulletBaseNT bullet, Entity hit); }
|
||||
public static interface IBulletHitBehaviorNT { public void behaveEntityHit(EntityBulletBaseNT bullet, Entity hit); }
|
||||
public static interface IBulletRicochetBehaviorNT { public void behaveBlockRicochet(EntityBulletBaseNT bullet, int x, int y, int z); }
|
||||
public static interface IBulletImpactBehaviorNT { public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z); }
|
||||
public static interface IBulletImpactBehaviorNT { public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit); }
|
||||
public static interface IBulletUpdateBehaviorNT { public void behaveUpdate(EntityBulletBaseNT bullet); }
|
||||
}
|
||||
|
||||
@ -2,6 +2,8 @@ package com.hbm.entity.projectile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.util.TrackerUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
@ -32,7 +34,7 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile {
|
||||
public int throwableShake;
|
||||
protected EntityLivingBase thrower;
|
||||
private String throwerName;
|
||||
private int ticksInGround;
|
||||
public int ticksInGround;
|
||||
private int ticksInAir;
|
||||
|
||||
public EntityThrowableNT(World world) {
|
||||
@ -41,7 +43,17 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() { }
|
||||
protected void entityInit() {
|
||||
this.dataWatcher.addObject(2, Byte.valueOf((byte)0));
|
||||
}
|
||||
|
||||
public void setStuckIn(int side) {
|
||||
this.dataWatcher.updateObject(2, (byte) side);
|
||||
}
|
||||
|
||||
public int getStuckIn() {
|
||||
return this.dataWatcher.getWatchableObjectByte(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@ -214,10 +226,6 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile {
|
||||
}
|
||||
}
|
||||
|
||||
this.posX += this.motionX * motionMult();
|
||||
this.posY += this.motionY * motionMult();
|
||||
this.posZ += this.motionZ * motionMult();
|
||||
|
||||
if(mop != null) {
|
||||
if(mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && this.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ) == Blocks.portal) {
|
||||
this.setInPortal();
|
||||
@ -250,6 +258,10 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile {
|
||||
float drag = this.getAirDrag();
|
||||
double gravity = this.getGravityVelocity();
|
||||
|
||||
this.posX += this.motionX * motionMult();
|
||||
this.posY += this.motionY * motionMult();
|
||||
this.posZ += this.motionZ * motionMult();
|
||||
|
||||
if(this.isInWater()) {
|
||||
for(int i = 0; i < 4; ++i) {
|
||||
float f = 0.25F;
|
||||
@ -264,7 +276,6 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile {
|
||||
this.motionZ *= (double) drag;
|
||||
this.motionY -= gravity;
|
||||
this.setPosition(this.posX, this.posY, this.posZ);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,7 +291,7 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile {
|
||||
return 5;
|
||||
}
|
||||
|
||||
public void getStuck(int x, int y, int z) {
|
||||
public void getStuck(int x, int y, int z, int side) {
|
||||
this.stuckBlockX = x;
|
||||
this.stuckBlockY = y;
|
||||
this.stuckBlockZ = z;
|
||||
@ -289,6 +300,8 @@ public abstract class EntityThrowableNT extends Entity implements IProjectile {
|
||||
this.motionX = 0;
|
||||
this.motionY = 0;
|
||||
this.motionZ = 0;
|
||||
this.setStuckIn(side);
|
||||
TrackerUtil.sendTeleport(worldObj, this);
|
||||
}
|
||||
|
||||
public double getGravityVelocity() {
|
||||
|
||||
@ -68,6 +68,7 @@ public class BulletConfigSyncingUtil {
|
||||
public static int GRENADE_PHOSPHORUS = i++;
|
||||
public static int GRENADE_TRACER = i++;
|
||||
public static int GRENADE_KAMPF = i++;
|
||||
public static int GRENADE_LEADBURSTER = i++;
|
||||
|
||||
public static int G12_NORMAL = i++;
|
||||
public static int G12_INCENDIARY = i++;
|
||||
@ -365,6 +366,7 @@ public class BulletConfigSyncingUtil {
|
||||
configSet.put(GRENADE_NUCLEAR, GunGrenadeFactory.getGrenadeNuclearConfig());
|
||||
configSet.put(GRENADE_TRACER, GunGrenadeFactory.getGrenadeTracerConfig());
|
||||
configSet.put(GRENADE_KAMPF, GunGrenadeFactory.getGrenadeKampfConfig());
|
||||
configSet.put(GRENADE_LEADBURSTER, GunGrenadeFactory.getGrenadeLeadbursterConfig());
|
||||
|
||||
configSet.put(G12_NORMAL, Gun12GaugeFactory.get12GaugeConfig());
|
||||
configSet.put(G12_INCENDIARY, Gun12GaugeFactory.get12GaugeFireConfig());
|
||||
|
||||
@ -146,7 +146,7 @@ public class BulletConfigFactory {
|
||||
bullet.bntImpact = new IBulletImpactBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
|
||||
|
||||
if(bullet.worldObj.isRemote)
|
||||
return;
|
||||
@ -310,12 +310,19 @@ public class BulletConfigFactory {
|
||||
}
|
||||
}
|
||||
|
||||
public static void makeFlechette(BulletConfiguration bullet) {
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
bulletnt.getStuck(x, y, z, sideHit);
|
||||
};
|
||||
}
|
||||
|
||||
public static IBulletImpactBehaviorNT getPhosphorousEffect(final int radius, final int duration, final int count, final double motion, float hazeChance) {
|
||||
|
||||
IBulletImpactBehaviorNT impact = new IBulletImpactBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
|
||||
|
||||
List<Entity> hit = bullet.worldObj.getEntitiesWithinAABBExcludingEntity(bullet, AxisAlignedBB.getBoundingBox(bullet.posX - radius, bullet.posY - radius, bullet.posZ - radius, bullet.posX + radius, bullet.posY + radius, bullet.posZ + radius));
|
||||
|
||||
@ -357,7 +364,7 @@ public class BulletConfigFactory {
|
||||
IBulletImpactBehaviorNT impact = new IBulletImpactBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
|
||||
|
||||
List<Entity> hit = bullet.worldObj.getEntitiesWithinAABBExcludingEntity(bullet, AxisAlignedBB.getBoundingBox(bullet.posX - radius, bullet.posY - radius, bullet.posZ - radius, bullet.posX + radius, bullet.posY + radius, bullet.posZ + radius));
|
||||
|
||||
|
||||
@ -147,6 +147,7 @@ public class Gun20GaugeFactory {
|
||||
bullet.style = BulletConfiguration.STYLE_FLECHETTE;
|
||||
bullet.HBRC = 2;
|
||||
bullet.LBRC = 95;
|
||||
BulletConfigFactory.makeFlechette(bullet);
|
||||
|
||||
bullet.spentCasing = CASING20GAUGE.clone().register("20GaFlech").setColor(0x2847FF, SpentCasing.COLOR_CASE_BRASS);
|
||||
|
||||
|
||||
@ -223,7 +223,7 @@ public class Gun44MagnumFactory {
|
||||
bullet.effects = new ArrayList();
|
||||
bullet.effects.add(new PotionEffect(eff));
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z) -> {
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "vanillaburst");
|
||||
|
||||
@ -205,7 +205,7 @@ public class Gun4GaugeFactory {
|
||||
bullet.effects = new ArrayList();
|
||||
bullet.effects.add(new PotionEffect(eff));
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z) -> {
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "vanillaburst");
|
||||
@ -251,7 +251,7 @@ public class Gun4GaugeFactory {
|
||||
bullet.trail = 1;
|
||||
bullet.explosive = 0.0F;
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z) -> {
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
|
||||
if(bulletnt.worldObj.isRemote)
|
||||
return;
|
||||
@ -283,7 +283,7 @@ public class Gun4GaugeFactory {
|
||||
bullet.trail = 1;
|
||||
bullet.explosive = 0.0F;
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z) -> {
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
|
||||
if(bulletnt.worldObj.isRemote)
|
||||
return;
|
||||
|
||||
@ -62,7 +62,7 @@ public class Gun50BMGFactory {
|
||||
bullet.leadChance = 20;
|
||||
|
||||
bullet.blockDamage = false;
|
||||
bullet.bntImpact = (projectile, x, y, z) -> projectile.worldObj.newExplosion(projectile, x, y, z, 2.0F, false, false);
|
||||
bullet.bntImpact = (projectile, x, y, z, sideHit) -> projectile.worldObj.newExplosion(projectile, x, y, z, 2.0F, false, false);
|
||||
|
||||
bullet.spentCasing = CASINGLUNA.clone().register("LunaStock");
|
||||
|
||||
@ -76,7 +76,7 @@ public class Gun50BMGFactory {
|
||||
|
||||
bullet.ammo.meta = 1;
|
||||
bullet.incendiary = 10;
|
||||
bullet.bntImpact = (projectile, x, y, z) -> projectile.worldObj.newExplosion(projectile, x, y, z, 5.0F, true, false);
|
||||
bullet.bntImpact = (projectile, x, y, z, sideHit) -> projectile.worldObj.newExplosion(projectile, x, y, z, 5.0F, true, false);
|
||||
|
||||
bullet.spentCasing = CASINGLUNA.clone().register("LunaInc");
|
||||
|
||||
@ -91,7 +91,7 @@ public class Gun50BMGFactory {
|
||||
bullet.ammo.meta = 2;
|
||||
bullet.explosive = 25;
|
||||
bullet.destroysBlocks = true;
|
||||
bullet.bntImpact = (projectile, x, y, z) -> projectile.worldObj.newExplosion(projectile, x, y, z, 25.0F, true, false);
|
||||
bullet.bntImpact = (projectile, x, y, z, sideHit) -> projectile.worldObj.newExplosion(projectile, x, y, z, 25.0F, true, false);
|
||||
|
||||
bullet.spentCasing = CASINGLUNA.clone().register("LunaExp");
|
||||
|
||||
@ -264,7 +264,7 @@ public class Gun50BMGFactory {
|
||||
bullet.effects = new ArrayList();
|
||||
bullet.effects.add(new PotionEffect(eff));
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z) -> {
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "vanillaburst");
|
||||
@ -368,7 +368,7 @@ public class Gun50BMGFactory {
|
||||
bulletnt.worldObj.spawnEntityInWorld(meteor);
|
||||
};
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z) -> {
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
|
||||
if(bulletnt.worldObj.isRemote)
|
||||
return;
|
||||
@ -397,6 +397,7 @@ public class Gun50BMGFactory {
|
||||
bullet.dmgMin = 50;
|
||||
bullet.dmgMax = 54;
|
||||
bullet.style = bullet.STYLE_FLECHETTE;
|
||||
BulletConfigFactory.makeFlechette(bullet);
|
||||
|
||||
bullet.spentCasing = CASING50BMG.clone().register("50BMGFlech");
|
||||
|
||||
@ -412,6 +413,7 @@ public class Gun50BMGFactory {
|
||||
bullet.dmgMin = 60;
|
||||
bullet.dmgMax = 64;
|
||||
bullet.style = bullet.STYLE_FLECHETTE;
|
||||
BulletConfigFactory.makeFlechette(bullet);
|
||||
|
||||
bullet.bntHit = (bulletnt, hit) -> {
|
||||
|
||||
@ -437,6 +439,7 @@ public class Gun50BMGFactory {
|
||||
bullet.dmgMin = 60;
|
||||
bullet.dmgMax = 64;
|
||||
bullet.style = bullet.STYLE_FLECHETTE;
|
||||
BulletConfigFactory.makeFlechette(bullet);
|
||||
|
||||
bullet.bntHit = (bulletnt, hit) -> {
|
||||
|
||||
|
||||
@ -182,7 +182,7 @@ public class Gun556mmFactory {
|
||||
bullet.effects = new ArrayList();
|
||||
bullet.effects.add(new PotionEffect(eff));
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z) -> {
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "vanillaburst");
|
||||
@ -266,7 +266,7 @@ public class Gun556mmFactory {
|
||||
bulletnt.worldObj.spawnEntityInWorld(meteor);
|
||||
};
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z) -> {
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
|
||||
if(bulletnt.worldObj.isRemote)
|
||||
return;
|
||||
@ -322,6 +322,7 @@ public class Gun556mmFactory {
|
||||
|
||||
bullet.ammo = new ComparableStack(ModItems.ammo_556.stackFromEnum(Ammo556mm.FLECHETTE_INCENDIARY));
|
||||
bullet.incendiary = 5;
|
||||
BulletConfigFactory.makeFlechette(bullet);
|
||||
|
||||
bullet.spentCasing = CASING556.clone().register("556FlecInc");
|
||||
|
||||
@ -340,7 +341,7 @@ public class Gun556mmFactory {
|
||||
bullet.effects = new ArrayList();
|
||||
bullet.effects.add(new PotionEffect(eff));
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z) -> {
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "vanillaburst");
|
||||
@ -395,7 +396,7 @@ public class Gun556mmFactory {
|
||||
bulletnt.worldObj.spawnEntityInWorld(meteor);
|
||||
};
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z) -> {
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
|
||||
if(bulletnt.worldObj.isRemote)
|
||||
return;
|
||||
|
||||
@ -134,7 +134,7 @@ public class Gun75BoltFactory {
|
||||
bullet.effects = new ArrayList();
|
||||
bullet.effects.add(new PotionEffect(eff));
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z) -> {
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "vanillaburst");
|
||||
|
||||
@ -84,7 +84,7 @@ public class GunCannonFactory {
|
||||
bullet.dmgMin = 100;
|
||||
bullet.dmgMax = 150;
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z) -> {
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
BulletConfigFactory.nuclearExplosion(bulletnt, x, y, z, ExplosionNukeSmall.PARAMS_TOTS);
|
||||
};
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@ public class GunDetonatorFactory {
|
||||
bullet.doesRicochet = false;
|
||||
bullet.setToBolt(BulletConfiguration.BOLT_LASER);
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z) -> {
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
|
||||
World world = bulletnt.worldObj;
|
||||
if(!world.isRemote && y > 0) {
|
||||
|
||||
@ -431,7 +431,7 @@ public class GunEnergyFactory {
|
||||
bullet.bntImpact = new IBulletImpactBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
|
||||
|
||||
if(!bullet.worldObj.isRemote) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
@ -554,7 +554,7 @@ public class GunEnergyFactory {
|
||||
bullet.bntImpact = new IBulletImpactBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
|
||||
|
||||
if(!bullet.worldObj.isRemote) {
|
||||
|
||||
@ -632,7 +632,7 @@ public class GunEnergyFactory {
|
||||
bullet.bntImpact = new IBulletImpactBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
|
||||
|
||||
if(!bullet.worldObj.isRemote) {
|
||||
|
||||
@ -721,7 +721,7 @@ public class GunEnergyFactory {
|
||||
bullet.bntImpact = new IBulletImpactBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
|
||||
|
||||
if(!bullet.worldObj.isRemote) {
|
||||
|
||||
@ -812,7 +812,7 @@ public class GunEnergyFactory {
|
||||
bullet.bntImpact = new IBulletImpactBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
|
||||
|
||||
if(!bullet.worldObj.isRemote) {
|
||||
ExplosionChaos.explodeZOMG(bullet.worldObj, (int)Math.floor(bullet.posX), (int)Math.floor(bullet.posY), (int)Math.floor(bullet.posZ), 5);
|
||||
|
||||
@ -135,7 +135,7 @@ public class GunFatmanFactory {
|
||||
bullet.bntImpact = new IBulletImpactBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
|
||||
BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_MEDIUM);
|
||||
}
|
||||
};
|
||||
@ -151,7 +151,7 @@ public class GunFatmanFactory {
|
||||
bullet.bntImpact = new IBulletImpactBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
|
||||
BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_LOW);
|
||||
}
|
||||
};
|
||||
@ -167,7 +167,7 @@ public class GunFatmanFactory {
|
||||
bullet.bntImpact = new IBulletImpactBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
|
||||
BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_HIGH);
|
||||
}
|
||||
};
|
||||
@ -187,7 +187,7 @@ public class GunFatmanFactory {
|
||||
bullet.bntImpact = new IBulletImpactBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
|
||||
BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_TOTS);
|
||||
}
|
||||
};
|
||||
@ -203,7 +203,7 @@ public class GunFatmanFactory {
|
||||
bullet.bntImpact = new IBulletImpactBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
|
||||
BulletConfigFactory.nuclearExplosion(bullet, x, y, z, ExplosionNukeSmall.PARAMS_SAFE);
|
||||
}
|
||||
};
|
||||
@ -220,7 +220,7 @@ public class GunFatmanFactory {
|
||||
bullet.bntImpact = new IBulletImpactBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
|
||||
|
||||
if(!bullet.worldObj.isRemote) {
|
||||
|
||||
@ -252,7 +252,7 @@ public class GunFatmanFactory {
|
||||
bullet.bntImpact = new IBulletImpactBehaviorNT() {
|
||||
|
||||
@Override
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
|
||||
|
||||
if(!bullet.worldObj.isRemote) {
|
||||
|
||||
@ -503,7 +503,7 @@ public class GunFatmanFactory {
|
||||
bullet.style = BulletConfiguration.STYLE_BF;
|
||||
|
||||
bullet.bntImpact = new IBulletImpactBehaviorNT() {
|
||||
public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z) {
|
||||
@Override public void behaveBlockHit(EntityBulletBaseNT bullet, int x, int y, int z, int sideHit) {
|
||||
|
||||
if(!bullet.worldObj.isRemote) {
|
||||
|
||||
|
||||
@ -60,6 +60,7 @@ public class GunGrenadeFactory {
|
||||
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 = 300;
|
||||
|
||||
config.ejector = EJECTOR_LAUNCHER;
|
||||
@ -211,7 +212,7 @@ public class GunGrenadeFactory {
|
||||
bullet.velocity = 4;
|
||||
bullet.explosive = 0.0F;
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z) -> {
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
BulletConfigFactory.nuclearExplosion(bulletnt, x, y, z, ExplosionNukeSmall.PARAMS_TOTS);
|
||||
};
|
||||
|
||||
@ -253,4 +254,19 @@ public class GunGrenadeFactory {
|
||||
|
||||
return bullet;
|
||||
}
|
||||
|
||||
public static BulletConfiguration getGrenadeLeadbursterConfig() {
|
||||
|
||||
BulletConfiguration bullet = BulletConfigFactory.standardRocketConfig();
|
||||
|
||||
bullet.ammo = new ComparableStack(ModItems.ammo_grenade.stackFromEnum(AmmoGrenade.LEADBURSTER));
|
||||
bullet.spread = 0.0F;
|
||||
bullet.gravity = 0.01D;
|
||||
bullet.explosive = 0F;
|
||||
bullet.style = BulletConfiguration.STYLE_APDS;
|
||||
bullet.doesRicochet = false;
|
||||
BulletConfigFactory.makeFlechette(bullet);
|
||||
|
||||
return bullet;
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ public class GunNPCFactory {
|
||||
bullet.vPFX = "reddust";
|
||||
bullet.damageType = ModDamageSource.s_laser;
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z) -> {
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
|
||||
if(bulletnt.worldObj.isRemote)
|
||||
return;
|
||||
@ -252,7 +252,7 @@ public class GunNPCFactory {
|
||||
if(target != null) {
|
||||
|
||||
if(bullet.getDistanceSqToEntity(target) < 5) {
|
||||
bullet.getConfig().bntImpact.behaveBlockHit(bullet, -1, -1, -1);
|
||||
bullet.getConfig().bntImpact.behaveBlockHit(bullet, -1, -1, -1, -1);
|
||||
bullet.setDead();
|
||||
return;
|
||||
}
|
||||
@ -306,7 +306,7 @@ public class GunNPCFactory {
|
||||
}
|
||||
};
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z) -> {
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
|
||||
bulletnt.worldObj.playSoundEffect(bulletnt.posX, bulletnt.posY, bulletnt.posZ, "hbm:entity.ufoBlast", 5.0F, 0.9F + bulletnt.worldObj.rand.nextFloat() * 0.2F);
|
||||
bulletnt.worldObj.playSoundEffect(bulletnt.posX, bulletnt.posY, bulletnt.posZ, "fireworks.blast", 5.0F, 0.5F);
|
||||
|
||||
@ -127,7 +127,7 @@ public class GunOSIPRFactory {
|
||||
|
||||
};
|
||||
|
||||
bullet.bntImpact = (ball, x, y, z) -> {
|
||||
bullet.bntImpact = (ball, x, y, z, sideHit) -> {
|
||||
final Block block = ball.worldObj.getBlock(x, y, z);
|
||||
if(block instanceof RedBarrel)
|
||||
((RedBarrel) block).explode(ball.worldObj, x, y, z);
|
||||
|
||||
@ -284,7 +284,7 @@ public class GunRocketFactory {
|
||||
bullet.incendiary = 0;
|
||||
bullet.trail = 7;
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z) -> {
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
BulletConfigFactory.nuclearExplosion(bulletnt, x, y, z, ExplosionNukeSmall.PARAMS_MEDIUM);
|
||||
};
|
||||
|
||||
@ -395,7 +395,7 @@ public class GunRocketFactory {
|
||||
bullet.incendiary = 0;
|
||||
bullet.trail = 7;
|
||||
|
||||
bullet.bntImpact = (bulletnt, x, y, z) -> {
|
||||
bullet.bntImpact = (bulletnt, x, y, z, sideHit) -> {
|
||||
|
||||
if(bulletnt.worldObj.isRemote)
|
||||
return;
|
||||
|
||||
@ -186,7 +186,8 @@ public class ItemAmmoEnums {
|
||||
FINNED("ammo_grenade_finned", AmmoItemTrait.PRO_GRAVITY, AmmoItemTrait.CON_RADIUS),
|
||||
NUCLEAR("ammo_grenade_nuclear", AmmoItemTrait.PRO_NUCLEAR, AmmoItemTrait.PRO_RANGE, AmmoItemTrait.CON_HEAVY_WEAR),
|
||||
TRACER("ammo_grenade_tracer", AmmoItemTrait.NEU_BLANK),
|
||||
KAMPF("ammo_grenade_kampf", AmmoItemTrait.PRO_ROCKET_PROPELLED, AmmoItemTrait.PRO_RADIUS, AmmoItemTrait.PRO_ACCURATE1, AmmoItemTrait.CON_WEAR);
|
||||
KAMPF("ammo_grenade_kampf", AmmoItemTrait.PRO_ROCKET_PROPELLED, AmmoItemTrait.PRO_RADIUS, AmmoItemTrait.PRO_ACCURATE1, AmmoItemTrait.CON_WEAR),
|
||||
LEADBURSTER("ammo_grenade_leadburster", AmmoItemTrait.NEU_LEADBURSTER, AmmoItemTrait.CON_NO_EXPLODE1);
|
||||
|
||||
private final Set<AmmoItemTrait> traits;
|
||||
private final String unloc;
|
||||
|
||||
@ -65,6 +65,7 @@ public class ItemAmmo extends ItemEnumMulti {
|
||||
NEU_STARMETAL,
|
||||
NEU_TRACER,
|
||||
NEU_UHH,
|
||||
NEU_LEADBURSTER,
|
||||
NEU_WARCRIME1,
|
||||
NEU_WARCRIME2,
|
||||
PRO_ACCURATE1,
|
||||
|
||||
@ -305,7 +305,7 @@ public class ItemAmmoArty extends Item {
|
||||
this.itemTypes[CARGO] = new ArtilleryShell("ammo_arty_cargo", SpentCasing.COLOR_CASE_16INCH) { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) {
|
||||
if(mop.typeOfHit == MovingObjectType.BLOCK) {
|
||||
shell.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||
shell.getStuck(mop.blockX, mop.blockY, mop.blockZ);
|
||||
shell.getStuck(mop.blockX, mop.blockY, mop.blockZ, mop.sideHit);
|
||||
}
|
||||
}};
|
||||
|
||||
|
||||
44
src/main/java/com/hbm/util/TrackerUtil.java
Normal file
44
src/main/java/com/hbm/util/TrackerUtil.java
Normal file
@ -0,0 +1,44 @@
|
||||
package com.hbm.util;
|
||||
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityTracker;
|
||||
import net.minecraft.entity.EntityTrackerEntry;
|
||||
import net.minecraft.network.play.server.S18PacketEntityTeleport;
|
||||
import net.minecraft.util.IntHashMap;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
|
||||
/**
|
||||
* This absolute fucking mess of a class is the direct consequence of mojank's terrible entity tracker that allows for 0 flexibility with how entities are synced.
|
||||
*
|
||||
* @author hbm
|
||||
*/
|
||||
public class TrackerUtil {
|
||||
|
||||
/** Grabs the tracker entry from the given entity */
|
||||
public static EntityTrackerEntry getTrackerEntry(WorldServer world, int entityId) {
|
||||
EntityTracker entitytracker = world.getEntityTracker();
|
||||
IntHashMap map = ReflectionHelper.getPrivateValue(EntityTracker.class, entitytracker, "trackedEntityIDs", "field_72794_c");
|
||||
EntityTrackerEntry entry = (EntityTrackerEntry) map.lookup(entityId);
|
||||
return entry;
|
||||
}
|
||||
|
||||
/** Force-teleports the given entity using the tracker, resetting the tick count to 0 to prevent movement during this tick */
|
||||
public static void sendTeleport(World world, Entity e) {
|
||||
|
||||
if(world instanceof WorldServer) {
|
||||
WorldServer server = (WorldServer) world;
|
||||
EntityTrackerEntry entry = getTrackerEntry(server, e.getEntityId());
|
||||
int xScaled = e.myEntitySize.multiplyBy32AndRound(e.posX);
|
||||
int yScaled = MathHelper.floor_double(e.posY * 32.0D);
|
||||
int zScaled = e.myEntitySize.multiplyBy32AndRound(e.posZ);
|
||||
int yaw = MathHelper.floor_float(e.rotationYaw * 256.0F / 360.0F);
|
||||
int pitch = MathHelper.floor_float(e.rotationPitch * 256.0F / 360.0F);
|
||||
entry.func_151259_a(new S18PacketEntityTeleport(e.getEntityId(), xScaled, yScaled, zScaled, (byte)yaw, (byte)pitch));
|
||||
//this prevents the tracker from sending movement updates in the same tick
|
||||
entry.ticks = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 291 B |
Loading…
x
Reference in New Issue
Block a user