@@ -200,36 +200,43 @@ public int getTreeFoliageColor(DynamicTree tree, World world, IBlockState blockS
200200 ///////////////////////////////////////////
201201
202202 @ Override
203- public void addDustParticle (double fx , double fy , double fz , double mx , double my , double mz , IBlockState blockState , float r , float g , float b ) {
204- Particle particle = Minecraft .getMinecraft ().effectRenderer .spawnEffectParticle (EnumParticleTypes .BLOCK_DUST .getParticleID (), fx , fy , fz , mx , my , mz , new int []{Block .getStateId (blockState )});
205- particle .setRBGColorF (r , g , b );
203+ public void addDustParticle (World world , double fx , double fy , double fz , double mx , double my , double mz , IBlockState blockState , float r , float g , float b ) {
204+ if (world .isRemote ) {
205+ Particle particle = Minecraft .getMinecraft ().effectRenderer .spawnEffectParticle (EnumParticleTypes .BLOCK_DUST .getParticleID (), fx , fy , fz , mx , my , mz , new int []{Block .getStateId (blockState )});
206+ particle .setRBGColorF (r , g , b );
207+ }
206208 }
207209
208210 /** Not strictly necessary. But adds a little more isolation to the server for particle effects */
209211 @ Override
210212 public void spawnParticle (World world , EnumParticleTypes particleType , double x , double y , double z , double mx , double my , double mz ) {
211- world .spawnParticle (particleType , x , y , z , mx , my , mz );
213+ if (world .isRemote ) {
214+ world .spawnParticle (particleType , x , y , z , mx , my , mz );
215+ }
212216 }
213217
218+ @ Override
214219 public void crushLeavesBlock (World world , BlockPos pos , IBlockState blockState , Entity entity ) {
215- Random random = world .rand ;
216- ITreePart treePart = TreeHelper .getTreePart (blockState );
217- if (treePart instanceof BlockDynamicLeaves ) {
218- BlockDynamicLeaves leaves = (BlockDynamicLeaves ) treePart ;
219- DynamicTree tree = leaves .getTree (blockState );
220- if (tree != null ) {
221- int color = getTreeFoliageColor (tree , world , blockState , pos );
222- float r = (color >> 16 & 255 ) / 255.0F ;
223- float g = (color >> 8 & 255 ) / 255.0F ;
224- float b = (color & 255 ) / 255.0F ;
225- for (int dz = 0 ; dz < 8 ; dz ++) {
226- for (int dy = 0 ; dy < 8 ; dy ++) {
227- for (int dx = 0 ; dx < 8 ; dx ++) {
228- if (random .nextInt (8 ) == 0 ) {
229- double fx = pos .getX () + dx / 8.0 ;
230- double fy = pos .getY () + dy / 8.0 ;
231- double fz = pos .getZ () + dz / 8.0 ;
232- addDustParticle (fx , fy , fz , 0 , random .nextFloat () * entity .motionY , 0 , blockState , r , g , b );
220+ if (world .isRemote ) {
221+ Random random = world .rand ;
222+ ITreePart treePart = TreeHelper .getTreePart (blockState );
223+ if (treePart instanceof BlockDynamicLeaves ) {
224+ BlockDynamicLeaves leaves = (BlockDynamicLeaves ) treePart ;
225+ DynamicTree tree = leaves .getTree (blockState );
226+ if (tree != null ) {
227+ int color = getTreeFoliageColor (tree , world , blockState , pos );
228+ float r = (color >> 16 & 255 ) / 255.0F ;
229+ float g = (color >> 8 & 255 ) / 255.0F ;
230+ float b = (color & 255 ) / 255.0F ;
231+ for (int dz = 0 ; dz < 8 ; dz ++) {
232+ for (int dy = 0 ; dy < 8 ; dy ++) {
233+ for (int dx = 0 ; dx < 8 ; dx ++) {
234+ if (random .nextInt (8 ) == 0 ) {
235+ double fx = pos .getX () + dx / 8.0 ;
236+ double fy = pos .getY () + dy / 8.0 ;
237+ double fz = pos .getZ () + dz / 8.0 ;
238+ addDustParticle (world , fx , fy , fz , 0 , random .nextFloat () * entity .motionY , 0 , blockState , r , g , b );
239+ }
233240 }
234241 }
235242 }
0 commit comments