Fix use of client only method

This commit is contained in:
Vincent Lee committed 2019-09-14 20:07:26 -05:00
1 parent b4e0a076e7
commit 2f5d163427
4 files changed
+13 -5

No files matched your search

@@ -22,6 +22,7 @@ import net.minecraft.client.util.InputMappings;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.particles.IParticleData;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -283,5 +284,10 @@ public class ClientProxy implements IProxy {
public BipedModel getEmptyModelBiped() {
return EMPTY_MODEL;
}
@Override
public void addParticleForce(World world, IParticleData particleData, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
world.addParticle(particleData, true, x, y, z, xSpeed, ySpeed, zSpeed);
}
}
@@ -4,6 +4,7 @@ import net.minecraft.block.Block;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.particles.IParticleData;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.World;
import vazkii.botania.api.boss.IBotaniaBoss;
@@ -49,4 +50,7 @@ public interface IProxy {
int getClientRenderDistance();
Object getEmptyModelBiped();
// Side-safe version of world.addParticle with noDistanceLimit flag set to true
default void addParticleForce(World world, IParticleData particleData, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {}
}
@@ -445,8 +445,7 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
if(!noParticles && shouldDoFakeParticles()) {
SparkleParticleData data = SparkleParticleData.fake(0.4F * size, r, g, b, 1);
// todo 1.14 usage of client-only method
world.addParticle(data, true, posX, posY, posZ, 0, 0, 0);
Botania.proxy.addParticleForce(world, data, posX, posY, posZ, 0, 0, 0);
}
} else {
boolean depth = !Botania.proxy.isClientPlayerWearingMonocle();
@@ -67,15 +67,14 @@ public class EntitySignalFlare extends Entity {
int g = (hex & 0xFF00) >> 8;
int b = hex & 0xFF;
// todo 1.14 use of client only addParticle version
for(int i = 0; i < 3; i++) {
WispParticleData data = WispParticleData.wisp((float) Math.random() * 5 + 1F, r / 255F, g / 255F, b / 255F);
world.addParticle(data, true, posX, posY, posZ + 0.5, (float) (Math.random() - 0.5F), 10F * (float) Math.sqrt(256F / (256F - (float) posY)), (float) (Math.random() - 0.5F));
Botania.proxy.addParticleForce(world, data, posX, posY, posZ + 0.5, (float) (Math.random() - 0.5F), 10F * (float) Math.sqrt(256F / (256F - (float) posY)), (float) (Math.random() - 0.5F));
}
for(int i = 0; i < 4; i++) {
WispParticleData data = WispParticleData.wisp((float) Math.random() * 15 + 8F, r / 255F, g / 255F, b / 255F);
world.addParticle(data, true, posX + 0.5, Math.min(256, getFiredAt() + Botania.proxy.getClientRenderDistance() * 16), posZ + 0.5, (float) (Math.random() - 0.5F) * 8F, 0F, (float) (Math.random() - 0.5F) * 8F);
Botania.proxy.addParticleForce(world, data, posX + 0.5, Math.min(256, getFiredAt() + Botania.proxy.getClientRenderDistance() * 16), posZ + 0.5, (float) (Math.random() - 0.5F) * 8F, 0F, (float) (Math.random() - 0.5F) * 8F);
}
}
}