Bassebombecraft

Bassebombecraft

18.5k Downloads

1.14.3 build fails with error: cannot find symbol import net.minecraft.util.EnumParticleTypes

Closed this issue ยท 2 comments

commented

DefaultParticleRenderingInfo.java:3: error: cannot find symbol
import net.minecraft.util.EnumParticleTypes;

ParticleRenderingInfo.java:3: error: cannot find symbol
import net.minecraft.util.EnumParticleTypes;

commented

Observations:

In 1.12 particles are rendered using:

@Mod.EventBusSubscriber
public class ParticleRenderingEventHandler {

	static void renderParticle(World world, ParticleRendering particle) {
		double speed = particle.getSpeed();
		double d0 = calculateRandomSpeed(speed);
		double d1 = calculateRandomSpeed(speed);
		double d2 = calculateRandomSpeed(speed);

		double x = particle.getPosition().getX() + 0.5D;
		double y = particle.getPosition().getY() + 1;
		double z = particle.getPosition().getZ() + 0.5D;
		world.spawnParticle(particle.getParticleType(), x, y, z, d0, d1, d2);

And the ParticleRendering. particle.getParticleType() returns a net.minecraft.util.EnumParticleTypes which doesn't exist in 1.14.3.

The method world.spawnParticle(..) is made private i 1.14.3.
The method is only implemented in:

@OnlyIn(Dist.CLIENT)
public class ClientWorld extends World {
...

The method world.spawnParticle(..) replaced with two new public methods:

public class ClientWorld extends World {

   public void addParticle(IParticleData particleData, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
      this.worldRenderer.addParticle(particleData, particleData.getType().getAlwaysShow(), x, y, z, xSpeed, ySpeed, zSpeed);
   }

   public void addParticle(IParticleData particleData, boolean forceAlwaysRender, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
      this.worldRenderer.addParticle(particleData, particleData.getType().getAlwaysShow() || forceAlwaysRender, x, y, z, xSpeed, ySpeed, zSpeed);
   }

Solution:

  1. The class ParticleRenderingEventHandler is refactored to use addParticle(..).

  2. Usage of net.minecraft.util.EnumParticleTypes is replace with usage of net.minecraft.particles.ParticleTypes and net.minecraft.particles.BasicParticleType.

commented

Closed with commit cf36036.