mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
casing smoke is no longer bound to the casing config
This commit is contained in:
parent
060a21a949
commit
5819711586
@ -94,7 +94,7 @@ public class CasingEjector implements Cloneable {
|
||||
@SideOnly(Side.CLIENT)
|
||||
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());
|
||||
ParticleSpentCasing casing = new ParticleSpentCasing(textureManager, world, x, y, z, rotatedMotionVec.xCoord, rotatedMotionVec.yCoord, rotatedMotionVec.zCoord, (float) (getPitchFactor() * rand.nextGaussian()), (float) (getYawFactor() * rand.nextGaussian()), config);
|
||||
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);
|
||||
|
||||
offsetCasing(casing, getOffset(), pitch, yaw, crouched);
|
||||
|
||||
|
||||
@ -15,7 +15,6 @@ import com.hbm.items.ItemEnums.EnumAshType;
|
||||
import com.hbm.items.machine.ItemFELCrystal.EnumWavelengths;
|
||||
import com.hbm.items.special.ItemWasteLong;
|
||||
import com.hbm.items.special.ItemWasteShort;
|
||||
import com.hbm.util.ItemStackUtil;
|
||||
import com.hbm.util.WeightedRandomObject;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
@ -130,8 +130,7 @@ public class Orchestras {
|
||||
if(type == AnimType.CYCLE) {
|
||||
if(timer == 14) {
|
||||
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack);
|
||||
casing.setupSmoke(1F, 0.5D, 60, 20);
|
||||
CasingCreator.composeEffect(player.worldObj, player, 0.5, -0.125, aiming ? -0.125 : -0.375D, 0, 0.12, -0.12, casing.getName());
|
||||
CasingCreator.composeEffect(player.worldObj, player, 0.5, -0.125, aiming ? -0.125 : -0.375D, 0, 0.12, -0.12, 0.1, casing.getName(), true, 60, 0.5D, 20);
|
||||
}
|
||||
if(timer == 12) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.leverCock", 1F, 1F);
|
||||
}
|
||||
@ -153,7 +152,7 @@ public class Orchestras {
|
||||
if(type == AnimType.CYCLE) {
|
||||
if(timer == 2) {
|
||||
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack);
|
||||
CasingCreator.composeEffect(player.worldObj, player, 0.55, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.12, casing.getName());
|
||||
CasingCreator.composeEffect(player.worldObj, player, 0.55, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.12, 0.1, casing.getName());
|
||||
}
|
||||
}
|
||||
if(type == AnimType.CYCLE_DRY) {
|
||||
@ -200,8 +199,7 @@ public class Orchestras {
|
||||
if(type == AnimType.CYCLE) {
|
||||
if(timer == 14) {
|
||||
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack);
|
||||
casing.setupSmoke(1F, 0.5D, 60, 20);
|
||||
CasingCreator.composeEffect(player.worldObj, player, 0.3125, -0.125, aiming ? -0.125 : -0.375D, 0, 0.18, -0.12, casing.getName());
|
||||
CasingCreator.composeEffect(player.worldObj, player, 0.3125, -0.125, aiming ? -0.125 : -0.375D, 0, 0.18, -0.12, 0.1, casing.getName(), true, 60, 0.5D, 20);
|
||||
}
|
||||
if(timer == 8) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.leverCock", 1F, 0.8F);
|
||||
}
|
||||
@ -221,8 +219,7 @@ public class Orchestras {
|
||||
if(timer == 0) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallRemove", 1F, 0.8F);
|
||||
if(timer == 4) {
|
||||
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack);
|
||||
casing.setupSmoke(1F, 0.5D, 60, 20);
|
||||
CasingCreator.composeEffect(player.worldObj, player, 0.625, -0.125, aiming ? -0.125 : -0.375D, -0.12, 0.18, 0, casing.getName());
|
||||
CasingCreator.composeEffect(player.worldObj, player, 0.625, -0.125, aiming ? -0.125 : -0.375D, -0.12, 0.18, 0, 0.1, casing.getName(), true, 60, 0.5D, 20);
|
||||
}
|
||||
if(timer == 16) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.insertCanister", 1F, 1F);
|
||||
if(timer == 24) player.worldObj.playSoundAtEntity(player, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
|
||||
@ -255,7 +252,7 @@ public class Orchestras {
|
||||
Receiver rec = ctx.config.getReceivers(stack)[0];
|
||||
IMagazine mag = rec.getMagazine(stack);
|
||||
SpentCasing casing = mag.getCasing(stack);
|
||||
for(int i = 0; i < mag.getCapacity(stack); i++) CasingCreator.composeEffect(player.worldObj, player, 0.25, -0.125, -0.125, player.getRNG().nextGaussian() * 0.01 - 0.05, player.getRNG().nextGaussian() * 0.01, player.getRNG().nextGaussian() * 0.01, casing.getName());
|
||||
for(int i = 0; i < mag.getCapacity(stack); i++) CasingCreator.composeEffect(player.worldObj, player, 0.25, -0.125, -0.125, 0.05, 0, 0, 0.1, casing.getName());
|
||||
}
|
||||
}
|
||||
if(type == AnimType.CYCLE) {
|
||||
@ -280,7 +277,7 @@ public class Orchestras {
|
||||
if(type == AnimType.CYCLE) {
|
||||
if(timer == 2) {
|
||||
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack);
|
||||
CasingCreator.composeEffect(player.worldObj, player, 0.3125, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.06, casing.getName());
|
||||
CasingCreator.composeEffect(player.worldObj, player, 0.3125, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.06, 0.1, casing.getName(), true, 60, 0.5D, 20);
|
||||
}
|
||||
}
|
||||
if(type == AnimType.CYCLE_DRY) {
|
||||
|
||||
@ -43,7 +43,7 @@ public class ParticleSpentCasing extends EntityFX {
|
||||
|
||||
private float momentumPitch, momentumYaw;
|
||||
|
||||
public ParticleSpentCasing(TextureManager textureManager, World world, double x, double y, double z, double mx, double my, double mz, float momentumPitch, float momentumYaw, SpentCasing config) {
|
||||
public ParticleSpentCasing(TextureManager textureManager, World world, double x, double y, double z, double mx, double my, double mz, float momentumPitch, float momentumYaw, SpentCasing config, boolean smoking, int smokeLife, double smokeLift, int nodeLife) {
|
||||
super(world, x, y, z, 0, 0, 0);
|
||||
this.textureManager = textureManager;
|
||||
this.momentumPitch = momentumPitch;
|
||||
@ -51,10 +51,11 @@ public class ParticleSpentCasing extends EntityFX {
|
||||
this.config = config;
|
||||
|
||||
this.particleMaxAge = config.getMaxAge();
|
||||
this.isSmoking = rand.nextFloat() < config.getSmokeChance();
|
||||
this.maxSmokeGen = config.getSmokeDuration();
|
||||
this.smokeLift = config.getSmokeLift();
|
||||
this.nodeLife = config.getSmokeNodeLife();
|
||||
|
||||
this.isSmoking = smoking;
|
||||
this.maxSmokeGen = smokeLife;
|
||||
this.smokeLift = smokeLift;
|
||||
this.nodeLife = nodeLife;
|
||||
|
||||
this.prevPosX = x;
|
||||
this.prevPosY = y;
|
||||
@ -286,13 +287,4 @@ public class ParticleSpentCasing extends EntityFX {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void tryPlayBounceSound() {
|
||||
|
||||
String sound = config.getSound();
|
||||
|
||||
if(sound != null && !sound.isEmpty()) {
|
||||
worldObj.playSoundAtEntity(this, sound, 2, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -39,10 +39,6 @@ public class SpentCasing implements Cloneable {
|
||||
private int[] colors;
|
||||
private CasingType type;
|
||||
private String bounceSound;
|
||||
private float smokeChance;
|
||||
private int smokeDuration;
|
||||
private double smokeLift;
|
||||
private int smokeNodeLife;
|
||||
private float bounceYaw = 0F;
|
||||
private float bouncePitch = 0F;
|
||||
private int maxAge = 240;
|
||||
@ -83,13 +79,7 @@ public class SpentCasing implements Cloneable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public SpentCasing setupSmoke(float chance, double lift, int duration, int nodeLife) {
|
||||
this.smokeChance = chance;
|
||||
this.smokeDuration = duration;
|
||||
this.smokeLift = lift;
|
||||
this.smokeNodeLife = nodeLife;
|
||||
return this;
|
||||
}
|
||||
@Deprecated public SpentCasing setupSmoke(float chance, double lift, int duration, int nodeLife) { return this; }
|
||||
|
||||
public static SpentCasing fromName(String name) {
|
||||
return casingMap.get(name);
|
||||
@ -113,13 +103,9 @@ public class SpentCasing implements Cloneable {
|
||||
public int[] getColors() { return this.colors; }
|
||||
public CasingType getType() { return this.type; }
|
||||
public String getSound() { return this.bounceSound; }
|
||||
public float getSmokeChance() { return this.smokeChance; }
|
||||
public float getBounceYaw() { return this.bounceYaw; }
|
||||
public float getBouncePitch() { return this.bouncePitch; }
|
||||
public int getMaxAge() { return this.maxAge; }
|
||||
public int getSmokeDuration() { return this.smokeDuration; }
|
||||
public double getSmokeLift() { return this.smokeLift; }
|
||||
public int getSmokeNodeLife() { return this.smokeNodeLife; }
|
||||
|
||||
@Override
|
||||
public SpentCasing clone() {
|
||||
|
||||
@ -14,7 +14,12 @@ import net.minecraft.world.World;
|
||||
|
||||
public class CasingCreator implements IParticleCreator {
|
||||
|
||||
public static void composeEffect(World world, EntityPlayer player, double frontOffset, double heightOffset, double sideOffset, double frontMotion, double heightMotion, double sideMotion, String casing) {
|
||||
/** Casing without smoke */
|
||||
public static void composeEffect(World world, EntityPlayer player, double frontOffset, double heightOffset, double sideOffset, double frontMotion, double heightMotion, double sideMotion, double motionVariance, String casing) {
|
||||
composeEffect(world, player, frontOffset, heightOffset, sideOffset, frontMotion, heightMotion, sideMotion, motionVariance, casing, false, 0, 0, 0);
|
||||
}
|
||||
|
||||
public static void composeEffect(World world, EntityPlayer player, double frontOffset, double heightOffset, double sideOffset, double frontMotion, double heightMotion, double sideMotion, double motionVariance, String casing, boolean smoking, int smokeLife, double smokeLift, int nodeLife) {
|
||||
|
||||
if(player.isSneaking()) heightOffset -= 0.075F;
|
||||
|
||||
@ -30,9 +35,9 @@ public class CasingCreator implements IParticleCreator {
|
||||
motion.rotateAroundX(-player.rotationPitch / 180F * (float) Math.PI);
|
||||
motion.rotateAroundY(-player.rotationYaw / 180F * (float) Math.PI);
|
||||
|
||||
double mX = player.motionX + motion.xCoord;
|
||||
double mY = player.motionY + motion.yCoord;
|
||||
double mZ = player.motionZ + motion.zCoord;
|
||||
double mX = player.motionX + motion.xCoord + player.getRNG().nextGaussian() * motionVariance;
|
||||
double mY = player.motionY + motion.yCoord + player.getRNG().nextGaussian() * motionVariance;
|
||||
double mZ = player.motionZ + motion.zCoord + player.getRNG().nextGaussian() * motionVariance;
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "casingNT");
|
||||
@ -42,6 +47,10 @@ public class CasingCreator implements IParticleCreator {
|
||||
data.setFloat("yaw", player.rotationYaw);
|
||||
data.setFloat("pitch", player.rotationPitch);
|
||||
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);
|
||||
}
|
||||
@ -56,7 +65,11 @@ public class CasingCreator implements IParticleCreator {
|
||||
double mZ = data.getDouble("mZ");
|
||||
float yaw = data.getFloat("yaw");
|
||||
float pitch = data.getFloat("pitch");
|
||||
ParticleSpentCasing casing = new ParticleSpentCasing(texman, world, x, y, z, mX, mY, mZ, 0, 0, casingConfig);
|
||||
boolean smoking = data.getBoolean("smoking");
|
||||
int smokeLife = data.getInteger("smokeLife");
|
||||
double smokeLift = data.getDouble("smokeLift");
|
||||
int nodeLife = data.getInteger("nodeLife");
|
||||
ParticleSpentCasing casing = new ParticleSpentCasing(texman, world, x, y, z, mX, mY, mZ, 0, 0, casingConfig, smoking, smokeLife, smokeLift, nodeLife);
|
||||
casing.prevRotationYaw = casing.rotationYaw = yaw;
|
||||
casing.prevRotationPitch = casing.rotationPitch = pitch;
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(casing);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user