added initial rotational momentums to casingCreator

remind me tomorrow to set the rest of the constants n add a lil randomess
This commit is contained in:
Vaern 2025-02-26 00:21:06 -08:00
parent ec311a6d54
commit b3e8fad079
2 changed files with 29 additions and 14 deletions

View File

@ -173,7 +173,7 @@ public class Orchestras {
if(type == AnimType.CYCLE) {
if(timer == 14) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.5, -0.125, aiming ? -0.125 : -0.375D, 0, 0.12, -0.12, 0.01, casing.getName(), true, 60, 0.5D, 20);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.5, -0.125, aiming ? -0.125 : -0.375D, 0, 0.12, -0.12, 0.01, 12.5F, 1.5F, casing.getName(), true, 60, 0.5D, 20);
}
if(timer == 12) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.leverCock", 1F, 1F);
}
@ -244,7 +244,7 @@ public class Orchestras {
if(type == AnimType.CYCLE) {
if(timer == 14) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.3125, -0.125, aiming ? -0.125 : -0.375D, 0, 0.18, -0.12, 0.01, casing.getName(), true, 60, 0.5D, 20);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.3125, -0.125, aiming ? -0.125 : -0.375D, 0, 0.18, -0.12, 0.01, 12.5F, 2.5F, casing.getName(), true, 60, 0.5D, 20);
}
if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.leverCock", 1F, 0.8F);
}
@ -279,7 +279,7 @@ public class Orchestras {
if(type == AnimType.CYCLE) {
if(timer == 14) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.3125, -0.125, aiming ? -0.125 : -0.375D, 0, -0.08, 0, 0.01, casing.getName(), true, 60, 0.5D, 20);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.3125, -0.125, aiming ? -0.125 : -0.375D, 0, -0.08, 0, 0.01, 17.5F, 2.5F, casing.getName(), true, 60, 0.5D, 20);
}
if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.leverCock", 1F, 0.8F);
}
@ -300,7 +300,7 @@ public class Orchestras {
if(timer == 14) {
int offset = ctx.configIndex == 0 ? -1 : 1;
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.3125, -0.125, aiming ? -0.125 * offset : -0.375D * offset, 0, -0.08, 0, 0.01, casing.getName(), true, 60, 0.5D, 20);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.3125, -0.125, aiming ? -0.125 * offset : -0.375D * offset, 0, -0.08, 0, 0.01, 17.5F, 2.5F, casing.getName(), true, 60, 0.5D, 20);
}
if(timer == 8) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.leverCock", 1F, 0.8F);
return;
@ -358,7 +358,7 @@ public class Orchestras {
Receiver rec = ctx.config.getReceivers(stack)[0];
IMagazine mag = rec.getMagazine(stack);
SpentCasing casing = mag.getCasing(stack, ctx.inventory);
if(casing != null) for(int i = 0; i < mag.getCapacity(stack); i++) CasingCreator.composeEffect(entity.worldObj, entity, 0.25, -0.125, -0.125, -0.05, 0, 0, 0.01, casing.getName());
if(casing != null) for(int i = 0; i < mag.getCapacity(stack); i++) CasingCreator.composeEffect(entity.worldObj, entity, 0.25, -0.125, -0.125, -0.05, 0, 0, 0.01, 2.5F, 5F, casing.getName());
}
}
if(type == AnimType.CYCLE) {
@ -384,7 +384,7 @@ public class Orchestras {
if(type == AnimType.CYCLE) {
if(timer == 2) {
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.3125, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.06, 0.01, casing.getName(), true, 60, 0.5D, 20);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.3125, aiming ? 0 : -0.125, aiming ? 0 : -0.25D, 0, 0.18, -0.06, 0.01, -10F, 2F, casing.getName(), true, 60, 0.5D, 20);
}
}
if(type == AnimType.CYCLE_DRY) {
@ -479,7 +479,7 @@ public class Orchestras {
IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack);
int toEject = mag.getAmountAfterReload(stack) - mag.getAmount(stack, ctx.inventory);
SpentCasing casing = mag.getCasing(stack, ctx.inventory);
if(casing != null) for(int i = 0; i < toEject; i++) CasingCreator.composeEffect(entity.worldObj, entity, 0.625, -0.1875, -0.375D, -0.12, 0.18, 0, 0.01, casing.getName(), true, 60, 0.5D, 20);
if(casing != null) for(int i = 0; i < toEject; i++) CasingCreator.composeEffect(entity.worldObj, entity, 0.625, -0.1875, -0.375D, -0.12, 0.18, 0, 0.01, 15F, 2.5F, casing.getName(), true, 60, 0.5D, 20);
}
if(timer == 15) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
}
@ -503,7 +503,7 @@ public class Orchestras {
int toEject = mag.getAmountAfterReload(stack) - mag.getAmount(stack, ctx.inventory);
if(timer == 4 && toEject > 0) {
SpentCasing casing = mag.getCasing(stack, ctx.inventory);
if(casing != null) for(int i = 0; i < toEject; i++) CasingCreator.composeEffect(entity.worldObj, entity, 0.625, -0.1875, -0.375D, -0.12, 0.18, 0, 0.01, casing.getName(), true, 60, 0.5D, 20);
if(casing != null) for(int i = 0; i < toEject; i++) CasingCreator.composeEffect(entity.worldObj, entity, 0.625, -0.1875, -0.375D, -0.12, 0.18, 0, 0.01, 10F, 5F, casing.getName(), true, 60, 0.5D, 20);
mag.setAmountAfterReload(stack, 0);
}
if(timer == 20) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 0.9F);
@ -1266,7 +1266,7 @@ public class Orchestras {
IMagazine mag = ctx.config.getReceivers(stack)[0].getMagazine(stack);
int toEject = mag.getAmountAfterReload(stack) - mag.getAmount(stack, ctx.inventory);
SpentCasing casing = mag.getCasing(stack, ctx.inventory);
if(casing != null) for(int i = 0; i < toEject; i++) CasingCreator.composeEffect(entity.worldObj, entity, 0, -0.1875, -0.375D, -0.12, 0.18, 0, 0.01, casing.getName(), true, 60, 0.5D, 20);
if(casing != null) for(int i = 0; i < toEject; i++) CasingCreator.composeEffect(entity.worldObj, entity, 0, -0.1875, -0.375D, -0.12, 0.18, 0, 0.01, 20F, 2.5F, casing.getName(), true, 60, 0.5D, 20);
}
}
@ -1297,7 +1297,7 @@ public class Orchestras {
if(timer == 1) {
int cba = (stack.getItem() == ModItems.gun_aberrator_eott && ctx.configIndex == 0) ? -1 : 1;
SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory);
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.375, aiming ? 0 : -0.125, aiming ? -0.0625 : -0.25D * cba, -0.075, 0.25, 0, 0.01, casing.getName());
if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.375, aiming ? 0 : -0.125, aiming ? -0.0625 : -0.25D * cba, -0.075, 0.25, 0, 0.01, -12.5F, 2.5F, casing.getName());
}
}

View File

@ -17,12 +17,23 @@ import net.minecraft.world.World;
public class CasingCreator implements IParticleCreator {
/** Casing without smoke */
//TODO give these + orchestra hardcoding a little bit of randomness cuz it looks off otherwise
/** Default casing without smoke */
public static void composeEffect(World world, EntityLivingBase 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);
composeEffect(world, player, frontOffset, heightOffset, sideOffset, frontMotion, heightMotion, sideMotion, motionVariance, 5F, 10F, casing, false, 0, 0, 0);
}
/** Casing without smoke */
public static void composeEffect(World world, EntityLivingBase player, double frontOffset, double heightOffset, double sideOffset, double frontMotion, double heightMotion, double sideMotion, double motionVariance, float multPitch, float multYaw, String casing) {
composeEffect(world, player, frontOffset, heightOffset, sideOffset, frontMotion, heightMotion, sideMotion, motionVariance, 5F, 10F, casing, false, 0, 0, 0);
}
/** Default casing, but with smoke*/
public static void composeEffect(World world, EntityLivingBase 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) {
composeEffect(world, player, frontOffset, heightOffset, sideOffset, frontMotion, heightMotion, sideMotion, motionVariance, 5F, 10F, casing, false, 0, 0, 0);
}
public static void composeEffect(World world, EntityLivingBase 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) {
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;
@ -51,6 +62,8 @@ public class CasingCreator implements IParticleCreator {
data.setDouble("mZ", mZ);
data.setFloat("yaw", player.rotationYaw);
data.setFloat("pitch", player.rotationPitch);
data.setFloat("mPitch", mPitch);
data.setFloat("mYaw", mYaw);
data.setString("name", casing);
data.setBoolean("smoking", smoking);
data.setInteger("smokeLife", smokeLife);
@ -71,11 +84,13 @@ public class CasingCreator implements IParticleCreator {
double mZ = data.getDouble("mZ");
float yaw = data.getFloat("yaw");
float pitch = data.getFloat("pitch");
float mPitch = data.getFloat("mPitch");
float mYaw = data.getFloat("mYaw");
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, (float) (world.rand.nextGaussian() * 10F), (float) (world.rand.nextGaussian() * 5F), casingConfig, smoking, smokeLife, smokeLift, nodeLife);
ParticleSpentCasing casing = new ParticleSpentCasing(texman, world, x, y, z, mX, mY, mZ, mPitch, mYaw, casingConfig, smoking, smokeLife, smokeLift, nodeLife);
casing.prevRotationYaw = casing.rotationYaw = yaw;
casing.prevRotationPitch = casing.rotationPitch = pitch;
Minecraft.getMinecraft().effectRenderer.addEffect(casing);