mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 12:32:23 +00:00
Fix colored fluid drip particles
This commit is contained in:
1 parent
04cb58dfa2
commit
85b71c785a
2 files changed
+20
-12
No files matched your search
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.entities;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -27,7 +26,9 @@ public class ParticleColoredDripParticle extends Particle {
|
||||
private int bobTimer;
|
||||
|
||||
public ParticleColoredDripParticle(World world, double x, double y, double z, float red, float green, float blue) {
|
||||
super(world, x, y, z);
|
||||
super(world, x, y, z, 0.0D, 0.0D, 0.0D);
|
||||
this.motionX = this.motionY = this.motionZ = 0.0D;
|
||||
|
||||
this.particleRed = red;
|
||||
this.particleGreen = green;
|
||||
this.particleBlue = blue;
|
||||
@@ -37,6 +38,7 @@ public class ParticleColoredDripParticle extends Particle {
|
||||
this.particleGravity = 0.06F;
|
||||
this.bobTimer = 40;
|
||||
this.particleMaxAge = (int) (64.0D / (Math.random() * 0.8D + 0.2D));
|
||||
this.motionX = this.motionY = this.motionZ = 0.0D;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,15 +76,21 @@ public class ParticleColoredDripParticle extends Particle {
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
}
|
||||
|
||||
IBlockState state = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)));
|
||||
Block block = state.getBlock();
|
||||
Material material = block.getMaterial(state);
|
||||
|
||||
|
||||
BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
|
||||
IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
|
||||
Material material = iblockstate.getMaterial();
|
||||
|
||||
if (material.isLiquid() || material.isSolid()) {
|
||||
double d0 = MathHelper.floor_double(this.posY) + 1 - BlockLiquid.getLiquidHeightPercent(block.getMetaFromState(state));
|
||||
|
||||
if (this.posY < d0) {
|
||||
double d0 = 0.0D;
|
||||
|
||||
if (iblockstate.getBlock() instanceof BlockLiquid) {
|
||||
d0 = BlockLiquid.getLiquidHeightPercent(iblockstate.getValue(BlockLiquid.LEVEL));
|
||||
}
|
||||
|
||||
double d1 = (double) (MathHelper.floor_double(this.posY) + 1) - d0;
|
||||
|
||||
if (this.posY < d1) {
|
||||
this.setExpired();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,8 +119,8 @@ public class BlockForestryFluid extends BlockFluidClassic implements IItemModelR
|
||||
double px = d0 + rand.nextFloat();
|
||||
double py = d1 - 1.05D;
|
||||
double pz = d2 + rand.nextFloat();
|
||||
|
||||
Particle fx = new ParticleColoredDripParticle(worldIn, px, py, pz, color.getRed(), color.getGreen(), color.getBlue());
|
||||
|
||||
Particle fx = new ParticleColoredDripParticle(worldIn, px, py, pz, color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f);
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user