mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Finished casing physics
added initial momentums as a test
This commit is contained in:
parent
747d0006b2
commit
c5c6beb453
@ -94,7 +94,7 @@ public class CasingEjector implements Cloneable {
|
|||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void spawnCasing(TextureManager textureManager, SpentCasing config, World world, double x, double y, double z, float pitch, float yaw, boolean crouched) {
|
public void spawnCasing(TextureManager textureManager, SpentCasing config, World world, double x, double y, double z, float pitch, float yaw, boolean crouched) {
|
||||||
Vec3 rotatedMotionVec = rotateVector(getMotion(), pitch + (float) rand.nextGaussian() * getPitchFactor(), yaw + (float) rand.nextGaussian() * getPitchFactor(), getPitchFactor(), getPitchFactor());
|
Vec3 rotatedMotionVec = rotateVector(getMotion(), pitch + (float) rand.nextGaussian() * getPitchFactor(), yaw + (float) rand.nextGaussian() * getPitchFactor(), getPitchFactor(), getPitchFactor());
|
||||||
ParticleSpentCasing casing = new ParticleSpentCasing(textureManager, world, x, y, z, rotatedMotionVec.xCoord, rotatedMotionVec.yCoord, rotatedMotionVec.zCoord, (float) (getPitchFactor() * rand.nextGaussian()), (float) (getYawFactor() * rand.nextGaussian()), config, false, 0, 0, 0);
|
ParticleSpentCasing casing = new ParticleSpentCasing(textureManager, world, x, y, z, rotatedMotionVec.xCoord, rotatedMotionVec.yCoord, rotatedMotionVec.zCoord, (float) (world.rand.nextGaussian() * 5F), (float) (world.rand.nextGaussian() * 10F), config, false, 0, 0, 0);
|
||||||
|
|
||||||
offsetCasing(casing, getOffset(), pitch, yaw, crouched);
|
offsetCasing(casing, getOffset(), pitch, yaw, crouched);
|
||||||
|
|
||||||
|
|||||||
@ -184,7 +184,7 @@ public class ItemAmmoArty extends Item {
|
|||||||
return "item." + itemTypes[Math.abs(stack.getItemDamage()) % itemTypes.length].name;
|
return "item." + itemTypes[Math.abs(stack.getItemDamage()) % itemTypes.length].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static SpentCasing SIXTEEN_INCH_CASE = new SpentCasing(CasingType.STRAIGHT).setScale(15F, 15F, 10F).setupSmoke(1F, 1D, 200, 60).setMaxAge(300);
|
protected static SpentCasing SIXTEEN_INCH_CASE = new SpentCasing(CasingType.STRAIGHT).setScale(15F, 15F, 10F).setupSmoke(1F, 1D, 200, 60).setMaxAge(300).setBounceMotion(1F, 0.5F);
|
||||||
|
|
||||||
public abstract class ArtilleryShell {
|
public abstract class ArtilleryShell {
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import org.lwjgl.opengl.GL11;
|
|||||||
import org.lwjgl.opengl.GL12;
|
import org.lwjgl.opengl.GL12;
|
||||||
|
|
||||||
import com.hbm.main.ResourceManager;
|
import com.hbm.main.ResourceManager;
|
||||||
|
import com.hbm.util.BobMathUtil;
|
||||||
import com.hbm.util.Tuple.Pair;
|
import com.hbm.util.Tuple.Pair;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
@ -103,7 +104,7 @@ public class ParticleSpentCasing extends EntityFX {
|
|||||||
this.motionX *= 0.7D;
|
this.motionX *= 0.7D;
|
||||||
this.motionZ *= 0.7D;
|
this.motionZ *= 0.7D;
|
||||||
|
|
||||||
this.rotationPitch = 0;
|
this.rotationPitch = (float) (Math.floor(this.rotationPitch / 180F + 0.5F)) * 180F;
|
||||||
this.momentumYaw *= 0.7F;
|
this.momentumYaw *= 0.7F;
|
||||||
this.onGround = false;
|
this.onGround = false;
|
||||||
}
|
}
|
||||||
@ -201,11 +202,15 @@ public class ParticleSpentCasing extends EntityFX {
|
|||||||
if (initMoY != motionY) {
|
if (initMoY != motionY) {
|
||||||
this.motionY *= -0.5D;
|
this.motionY *= -0.5D;
|
||||||
|
|
||||||
if(momentumPitch == 0 && this.motionY > 1e-7) {
|
boolean rotFromSpeed = Math.abs(this.motionY) > 0.04;
|
||||||
momentumPitch = (float) rand.nextGaussian() * 10F * this.config.getBouncePitch();
|
if(rotFromSpeed || Math.abs(momentumPitch) > 1e-7) {
|
||||||
momentumYaw = (float) rand.nextGaussian() * 10F * this.config.getBounceYaw();
|
|
||||||
} else if(Math.abs(momentumPitch) > 1e-7)
|
|
||||||
momentumPitch *= -0.75F;
|
momentumPitch *= -0.75F;
|
||||||
|
if(rotFromSpeed) {
|
||||||
|
float mult = (float) BobMathUtil.safeClamp(initMoY / 0.2F, -1F, 1F);
|
||||||
|
momentumPitch += rand.nextGaussian() * 10F * this.config.getBouncePitch() * mult;
|
||||||
|
momentumYaw += (float) rand.nextGaussian() * 10F * this.config.getBounceYaw() * mult;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initMoZ != motionZ) {
|
if (initMoZ != motionZ) {
|
||||||
|
|||||||
@ -86,6 +86,7 @@ public class SpentCasing implements Cloneable {
|
|||||||
return casingMap.get(name);
|
return casingMap.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Multiplier for default standard deviation of 10deg per tick, per bounce w/ full y speed */
|
||||||
public SpentCasing setBounceMotion(float yaw, float pitch) {
|
public SpentCasing setBounceMotion(float yaw, float pitch) {
|
||||||
this.bounceYaw = yaw;
|
this.bounceYaw = yaw;
|
||||||
this.bouncePitch = pitch;
|
this.bouncePitch = pitch;
|
||||||
|
|||||||
@ -75,7 +75,7 @@ public class CasingCreator implements IParticleCreator {
|
|||||||
int smokeLife = data.getInteger("smokeLife");
|
int smokeLife = data.getInteger("smokeLife");
|
||||||
double smokeLift = data.getDouble("smokeLift");
|
double smokeLift = data.getDouble("smokeLift");
|
||||||
int nodeLife = data.getInteger("nodeLife");
|
int nodeLife = data.getInteger("nodeLife");
|
||||||
ParticleSpentCasing casing = new ParticleSpentCasing(texman, world, x, y, z, mX, mY, mZ, 0, 0, casingConfig, smoking, smokeLife, smokeLift, nodeLife);
|
ParticleSpentCasing casing = new ParticleSpentCasing(texman, world, x, y, z, mX, mY, mZ, (float) (world.rand.nextGaussian() * 10F), (float) (world.rand.nextGaussian() * 5F), casingConfig, smoking, smokeLife, smokeLift, nodeLife);
|
||||||
casing.prevRotationYaw = casing.rotationYaw = yaw;
|
casing.prevRotationYaw = casing.rotationYaw = yaw;
|
||||||
casing.prevRotationPitch = casing.rotationPitch = pitch;
|
casing.prevRotationPitch = casing.rotationPitch = pitch;
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(casing);
|
Minecraft.getMinecraft().effectRenderer.addEffect(casing);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user