diff --git a/changelog b/changelog index eb8fac849..e00fab8cc 100644 --- a/changelog +++ b/changelog @@ -32,3 +32,5 @@ * Fixed audio problems with guns * Fixed third person muzzleflash on the miniguns clipping the barrel * Fixed arc furnace IO slots stacking items with incompatible NBT +* Fixed a bounding box issue with casing particles, causing them to slide sideways on the first tick, making trajectories weird +* Fixed some turrets not using the more modern casing spawner system which allows casings to have a smoke trail diff --git a/src/main/java/com/hbm/particle/ParticleSpentCasing.java b/src/main/java/com/hbm/particle/ParticleSpentCasing.java index ff443f550..30ed0782f 100644 --- a/src/main/java/com/hbm/particle/ParticleSpentCasing.java +++ b/src/main/java/com/hbm/particle/ParticleSpentCasing.java @@ -69,6 +69,9 @@ public class ParticleSpentCasing extends EntityFX { this.motionX = mx; this.motionY = my; this.motionZ = mz; + + // i am at a loss for words as to what the fuck is going on here, but this is needed, stop asking, fuck you + this.setPosition(x, y, z); particleGravity = 1F; } @@ -129,16 +132,26 @@ public class ParticleSpentCasing extends EntityFX { rotationPitch += momentumPitch; rotationYaw += momentumYaw; + + if(Math.abs(prevRotationPitch - rotationPitch) > 180) { + if(prevRotationPitch < rotationPitch) prevRotationPitch += 360; + if(prevRotationPitch > rotationPitch) prevRotationPitch -= 360; + } + + if(Math.abs(prevRotationYaw - rotationYaw) > 180) { + if(prevRotationYaw < rotationYaw) prevRotationYaw += 360; + if(prevRotationYaw > rotationYaw) prevRotationYaw -= 360; + } } public void moveEntity(double motionX, double motionY, double motionZ) { this.worldObj.theProfiler.startSection("move"); this.ySize *= 0.4F; - if (this.isInWeb) { + if(this.isInWeb) { this.isInWeb = false; motionX *= 0.25D; - motionY *= 0.05000000074505806D; + motionY *= 0.05D; motionZ *= 0.25D; this.motionX = 0.0D; this.motionY = 0.0D; @@ -152,7 +165,7 @@ public class ParticleSpentCasing extends EntityFX { List list = this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox.addCoord(motionX, motionY, motionZ)); - for (int i = 0; i < list.size(); ++i) { + for(int i = 0; i < list.size(); ++i) { motionY = ((AxisAlignedBB)list.get(i)).calculateYOffset(this.boundingBox, motionY); } @@ -160,13 +173,13 @@ public class ParticleSpentCasing extends EntityFX { int j; - for (j = 0; j < list.size(); ++j) { + for(j = 0; j < list.size(); ++j) { motionX = ((AxisAlignedBB)list.get(j)).calculateXOffset(this.boundingBox, motionX); } this.boundingBox.offset(motionX, 0.0D, 0.0D); - for (j = 0; j < list.size(); ++j) { + for(j = 0; j < list.size(); ++j) { motionZ = ((AxisAlignedBB)list.get(j)).calculateZOffset(this.boundingBox, motionZ); } @@ -217,7 +230,7 @@ public class ParticleSpentCasing extends EntityFX { } if(this.config.getSound() != null && isCollidedVertically && Math.abs(initMoY) >= 0.2) { - MainRegistry.proxy.playSoundClient(posX, posY, posZ, this.config.getSound(), 0.5F, 1F + this.rand.nextFloat() * 0.2F); + MainRegistry.proxy.playSoundClient(posX, posY, posZ, this.config.getSound(), this.config.PLINK_LARGE.equals(this.config.getSound()) ? 1F : 0.5F, 1F + this.rand.nextFloat() * 0.2F); } this.worldObj.theProfiler.endSection(); @@ -267,8 +280,8 @@ public class ParticleSpentCasing extends EntityFX { GL11.glScalef(dScale, dScale, dScale); - GL11.glRotatef(180 - rotationYaw, 0, 1, 0); - GL11.glRotatef(-rotationPitch, 1, 0, 0); + GL11.glRotatef(180 - (float) BobMathUtil.interp(prevRotationYaw, rotationYaw, interp), 0, 1, 0); + GL11.glRotatef((float) -BobMathUtil.interp(prevRotationPitch, rotationPitch, interp), 1, 0, 0); GL11.glScalef(config.getScaleX(), config.getScaleY(), config.getScaleZ()); diff --git a/src/main/java/com/hbm/particle/SpentCasing.java b/src/main/java/com/hbm/particle/SpentCasing.java index 19302119c..b8b57dba7 100644 --- a/src/main/java/com/hbm/particle/SpentCasing.java +++ b/src/main/java/com/hbm/particle/SpentCasing.java @@ -46,6 +46,7 @@ public class SpentCasing implements Cloneable { public static final String PLINK_SHELL = "hbm:weapon.casing.shell"; public static final String PLINK_SMALL = "hbm:weapon.casing.small"; public static final String PLINK_MEDIUM = "hbm:weapon.casing.medium"; + public static final String PLINK_LARGE = "hbm:weapon.casing.large"; public SpentCasing(CasingType type) { this.type = type; @@ -73,6 +74,7 @@ public class SpentCasing implements Cloneable { this.scaleY = y; this.scaleZ = z; if(x * y * z >= 3 && this.type != CasingType.SHOTGUN) this.setSound(PLINK_MEDIUM); + if(x * y * z >= 100 && this.type != CasingType.SHOTGUN) this.setSound(PLINK_LARGE); return this; } diff --git a/src/main/java/com/hbm/particle/helper/CasingCreator.java b/src/main/java/com/hbm/particle/helper/CasingCreator.java index 51b8f3520..c2a89666f 100644 --- a/src/main/java/com/hbm/particle/helper/CasingCreator.java +++ b/src/main/java/com/hbm/particle/helper/CasingCreator.java @@ -32,6 +32,34 @@ public class CasingCreator implements IParticleCreator { composeEffect(world, player, frontOffset, heightOffset, sideOffset, frontMotion, heightMotion, sideMotion, motionVariance, 5F, 10F, casing, false, 0, 0, 0); } + public static void composeEffect(World world, double x, double y, double z, float yaw, float pitch, double frontMotion, double heightMotion, double sideMotion, double motionVariance, float mPitch, float mYaw, String casing, boolean smoking, int smokeLife, double smokeLift, int nodeLife) { + + Vec3 motion = Vec3.createVectorHelper(sideMotion, heightMotion, frontMotion); + motion.rotateAroundX(-pitch / 180F * (float) Math.PI); + motion.rotateAroundY(-yaw / 180F * (float) Math.PI); + + double mX = motion.xCoord + world.rand.nextGaussian() * motionVariance; + double mY = motion.yCoord + world.rand.nextGaussian() * motionVariance; + double mZ = motion.zCoord + world.rand.nextGaussian() * motionVariance; + + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "casingNT"); + data.setDouble("mX", mX); + data.setDouble("mY", mY); + data.setDouble("mZ", mZ); + data.setFloat("yaw", yaw); + data.setFloat("pitch", pitch); + data.setFloat("mPitch", mPitch); + data.setFloat("mYaw", mYaw); + data.setString("name", casing); + data.setBoolean("smoking", smoking); + data.setInteger("smokeLife", smokeLife); + data.setDouble("smokeLift", smokeLift); + data.setInteger("nodeLife", nodeLife); + + IParticleCreator.sendPacket(world, x, y, z, 50, data); + } + public static void composeEffect(World world, EntityLivingBase player, double frontOffset, double heightOffset, double sideOffset, double frontMotion, double heightMotion, double sideMotion, double motionVariance, float mPitch, float mYaw, String casing, boolean smoking, int smokeLife, double smokeLift, int nodeLife) { if(player.isSneaking()) heightOffset -= 0.075F; diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java index c3cd4e131..1e9c91701 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretArty.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.List; import com.hbm.entity.projectile.EntityArtilleryShell; -import com.hbm.handler.CasingEjector; import com.hbm.handler.threading.PacketThreading; import com.hbm.inventory.container.ContainerTurretBase; import com.hbm.inventory.gui.GUITurretArty; @@ -13,6 +12,7 @@ import com.hbm.items.weapon.ItemAmmoArty; import com.hbm.lib.Library; import com.hbm.main.MainRegistry; import com.hbm.packet.toclient.AuxParticlePacketNT; +import com.hbm.particle.helper.CasingCreator; import com.hbm.tileentity.IGUIProvider; import cpw.mods.fml.common.Optional; @@ -380,13 +380,6 @@ public class TileEntityTurretArty extends TileEntityTurretBaseArtillery implemen } } - protected static CasingEjector ejector = new CasingEjector().setMotion(0, 0.6, -1).setAngleRange(0.1F, 0.1F); - - @Override - protected CasingEjector getEjector() { - return ejector; - } - @Override protected Vec3 getCasingSpawnPos() { return this.getTurretPos(); @@ -439,18 +432,19 @@ public class TileEntityTurretArty extends TileEntityTurretBaseArtillery implemen protected void spawnCasing() { if(cachedCasingConfig == null) return; - CasingEjector ej = getEjector(); Vec3 spawn = this.getCasingSpawnPos(); - NBTTagCompound data = new NBTTagCompound(); - data.setString("type", "casing"); - data.setFloat("pitch", (float) 0); - data.setFloat("yaw", (float) rotationYaw); - data.setBoolean("crouched", false); - data.setString("name", cachedCasingConfig.getName()); - if(ej != null) data.setInteger("ej", ej.getId()); - PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, spawn.xCoord, spawn.yCoord, spawn.zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50)); - + float yaw = (float) Math.toDegrees(rotationYaw); + float pitch = (float) -Math.toDegrees(this.rotationPitch); + + CasingCreator.composeEffect(worldObj, + spawn.xCoord, spawn.yCoord, spawn.zCoord, + yaw, pitch, + -0.6, 0.3, 0, + 0.01, worldObj.rand.nextFloat() * 20F - 10F, 0, + cachedCasingConfig.getName(), + true, 200, 1, 20); + cachedCasingConfig = null; } diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretJeremy.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretJeremy.java index 48504f6e8..39fe4148f 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretJeremy.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretJeremy.java @@ -3,12 +3,12 @@ package com.hbm.tileentity.turret; import java.util.ArrayList; import java.util.List; -import com.hbm.handler.CasingEjector; import com.hbm.handler.threading.PacketThreading; import com.hbm.inventory.gui.GUITurretJeremy; import com.hbm.items.weapon.sedna.BulletConfig; import com.hbm.items.weapon.sedna.factory.XFactoryTurret; import com.hbm.packet.toclient.AuxParticlePacketNT; +import com.hbm.particle.helper.CasingCreator; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; @@ -111,6 +111,26 @@ public class TileEntityTurretJeremy extends TileEntityTurretBaseNT { } } + @Override + protected void spawnCasing() { + + if(cachedCasingConfig == null) return; + + Vec3 spawn = this.getCasingSpawnPos(); + float yaw = (float) Math.toDegrees(rotationYaw); + float pitch = (float) -Math.toDegrees(this.rotationPitch); + + CasingCreator.composeEffect(worldObj, + spawn.xCoord, spawn.yCoord, spawn.zCoord, + yaw, pitch, + -0.2, -0.2, 0, + 0.01, -5, 0, + cachedCasingConfig.getName(), + true, 100, 0.5, 20); + + cachedCasingConfig = null; + } + @Override protected Vec3 getCasingSpawnPos() { @@ -122,13 +142,6 @@ public class TileEntityTurretJeremy extends TileEntityTurretBaseNT { return Vec3.createVectorHelper(pos.xCoord + vec.xCoord, pos.yCoord + vec.yCoord, pos.zCoord + vec.zCoord); } - protected static CasingEjector ejector = new CasingEjector().setAngleRange(0.01F, 0.01F).setMotion(0, 0, -0.2); - - @Override - protected CasingEjector getEjector() { - return ejector; - } - @Override public boolean usesCasings() { return true; diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretSentry.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretSentry.java index 90e7f326b..5af1640ec 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretSentry.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretSentry.java @@ -209,7 +209,7 @@ public class TileEntityTurretSentry extends TileEntityTurretBaseNT implements IG @Override protected CasingEjector getEjector() { - return ejector.setMotion(0.3, 0.6, 0); + return ejector.setMotion(0.2, 0.2, 0); } @Override diff --git a/src/main/resources/assets/hbm/manual/weapon/express.json b/src/main/resources/assets/hbm/manual/weapon/express.json index cc9cf2f9e..7c3547126 100644 --- a/src/main/resources/assets/hbm/manual/weapon/express.json +++ b/src/main/resources/assets/hbm/manual/weapon/express.json @@ -9,6 +9,6 @@ "en_US": "FMJ Express Bullet" }, "content": { - "en_US": "FMJ Express is a special type of full metal jacket ammo for revolver calibers. Express ammo has the same armor-pericing effects in addition to increased damage. Express projectiles can penetrate their targets, but unlike AP rounds, Express projectiles become weaker on every penetration. Due to the higher powder load in combination with the basic gunmetal casing, Express ammo causes the gun to wear faster." + "en_US": "FMJ Express is a special type of full metal jacket ammo for revolver calibers. Express ammo has the same armor-piercing effects in addition to increased damage. Express projectiles can penetrate their targets, but unlike AP rounds, Express projectiles become weaker on every penetration. Due to the higher powder load in combination with the basic gunmetal casing, Express ammo causes the gun to wear faster." } } diff --git a/src/main/resources/assets/hbm/manual/weapon/slug.json b/src/main/resources/assets/hbm/manual/weapon/slug.json index b5c848b2f..b736c7ae2 100644 --- a/src/main/resources/assets/hbm/manual/weapon/slug.json +++ b/src/main/resources/assets/hbm/manual/weapon/slug.json @@ -10,6 +10,6 @@ "en_US": "Slug" }, "content": { - "en_US": "A shell type that only holds a single large projectile. Unlike shot, slugs do not have inherent spread, deall the gun's full damage on hit, and have some armor-piercing properties." + "en_US": "A shell type that only holds a single large projectile. Unlike shot, slugs do not have inherent spread, deal the gun's full damage on hit, and have some armor-piercing properties." } } diff --git a/src/main/resources/assets/hbm/sounds.json b/src/main/resources/assets/hbm/sounds.json index e1e971d14..9b2f9d8a7 100644 --- a/src/main/resources/assets/hbm/sounds.json +++ b/src/main/resources/assets/hbm/sounds.json @@ -297,6 +297,7 @@ "weapon.casing.small": {"category": "player", "sounds": ["weapon/casing/small1", "weapon/casing/small2", "weapon/casing/small3"]}, "weapon.casing.medium": {"category": "player", "sounds": ["weapon/casing/medium1", "weapon/casing/medium2", "weapon/casing/medium3"]}, + "weapon.casing.large": {"category": "player", "sounds": ["weapon/casing/large1", "weapon/casing/large2", "weapon/casing/large3"]}, "weapon.casing.shell": {"category": "player", "sounds": ["weapon/casing/shell1", "weapon/casing/shell2", "weapon/casing/shell3"]}, "turret.chekhov_fire": {"category": "block", "sounds": [{"name": "turret/chekhov_fire", "stream": false}]}, diff --git a/src/main/resources/assets/hbm/sounds/weapon/casing/large1.ogg b/src/main/resources/assets/hbm/sounds/weapon/casing/large1.ogg new file mode 100644 index 000000000..843da3b82 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/casing/large1.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/casing/large2.ogg b/src/main/resources/assets/hbm/sounds/weapon/casing/large2.ogg new file mode 100644 index 000000000..9285f5ed5 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/casing/large2.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/weapon/casing/large3.ogg b/src/main/resources/assets/hbm/sounds/weapon/casing/large3.ogg new file mode 100644 index 000000000..3bb8ce109 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/weapon/casing/large3.ogg differ