Particle packets are only sent to players in the particle's world now.

This commit is contained in:
Luis C.M committed 2022-07-02 13:07:23 -05:00
1 parent 9ceec111ba
commit c8a3b7825d
5 files changed
+19 -25

No files matched your search

@@ -315,8 +315,13 @@ public class NoppesUtilServer {
Server.sendAssociatedData(entity, EnumPacketClient.PARTICLE, entity.posX, entity.posY, entity.posZ, entity.height, entity.width, entity.yOffset, particle);
}
public static void spawnScriptedParticle(NBTTagCompound compound){
Server.sendToAll(EnumPacketClient.SCRIPTED_PARTICLE, compound);
public static void spawnScriptedParticle(NBTTagCompound compound, int dimensionId){
List<EntityPlayer> list = MinecraftServer.getServer().getConfigurationManager().playerEntityList;
for (EntityPlayer player : list) {
if (player.worldObj.provider.dimensionId == dimensionId) {
Server.sendData((EntityPlayerMP) player, EnumPacketClient.SCRIPTED_PARTICLE, compound);
}
}
}
public static void deleteNpc(EntityNPCInterface npc,EntityPlayer player) {
@@ -85,7 +85,7 @@ public class NoppesUtil {
Client.skinOverlays.put(player.getUniqueID(), skinOverlays);
}
public static void spawnScriptedParticle(ByteBuf buffer){
public static void spawnScriptedParticle(EntityPlayer player, ByteBuf buffer){
Minecraft minecraft = Minecraft.getMinecraft();
NBTTagCompound compound;
@@ -97,7 +97,7 @@ public class NoppesUtil {
return;
}
World worldObj = DimensionManager.getWorld(compound.getInteger("DimensionID"));
World worldObj = player.worldObj;
if (worldObj == null) {
return;
}
@@ -154,7 +154,7 @@ public class PacketHandlerClient extends PacketHandlerServer{
CustomNpcs.proxy.openGui(NoppesUtil.getLastNpc(), gui, buffer.readInt(), buffer.readInt(), buffer.readInt());
}
else if(type == EnumPacketClient.SCRIPTED_PARTICLE){
NoppesUtil.spawnScriptedParticle(buffer);
NoppesUtil.spawnScriptedParticle(player, buffer);
}
else if(type == EnumPacketClient.PARTICLE){
NoppesUtil.spawnParticle(buffer);
@@ -133,23 +133,18 @@ public class ScriptParticle implements IParticle {
NBTTagCompound compound = this.writeToNBT();
compound.setInteger("EntityID", entityID);
compound.setInteger("DimensionID", entity.getWorld().getDimensionID());
NoppesUtilServer.spawnScriptedParticle(compound);
NoppesUtilServer.spawnScriptedParticle(compound, entity.getWorld().getDimensionID());
}
public void spawnInWorld(ScriptWorld world){
NBTTagCompound compound = this.writeToNBT();
compound.setInteger("DimensionID", world.getDimensionID());
NoppesUtilServer.spawnScriptedParticle(compound);
NoppesUtilServer.spawnScriptedParticle(compound, world.getDimensionID());
}
public void spawnInWorld(ScriptWorld world, double x, double y, double z){
NBTTagCompound compound = this.writeToNBT();
compound.setInteger("DimensionID", world.getDimensionID());
NoppesUtilServer.spawnScriptedParticle(compound);
NoppesUtilServer.spawnScriptedParticle(compound, world.getDimensionID());
}
public void setGlows(boolean glows) { this.glows = glows; }
@@ -97,8 +97,7 @@ public class ScriptEntity<T extends Entity> implements IEntity {
NBTTagCompound compound = particle.writeToNBT();
compound.setInteger("EntityID", entityID);
compound.setInteger("DimensionID", this.getWorld().getDimensionID());
NoppesUtilServer.spawnScriptedParticle(compound);
NoppesUtilServer.spawnScriptedParticle(compound, this.getWorld().getDimensionID());
}
@Deprecated
@@ -139,8 +138,7 @@ public class ScriptEntity<T extends Entity> implements IEntity {
NBTTagCompound compound = particle.writeToNBT();
compound.setInteger("EntityID", entityID);
compound.setInteger("DimensionID", this.getWorld().getDimensionID());
NoppesUtilServer.spawnScriptedParticle(compound);
NoppesUtilServer.spawnScriptedParticle(compound, this.getWorld().getDimensionID());
}
@Deprecated
@@ -175,8 +173,7 @@ public class ScriptEntity<T extends Entity> implements IEntity {
NBTTagCompound compound = particle.writeToNBT();
compound.setInteger("EntityID", entityID);
compound.setInteger("DimensionID", this.getWorld().getDimensionID());
NoppesUtilServer.spawnScriptedParticle(compound);
NoppesUtilServer.spawnScriptedParticle(compound, this.getWorld().getDimensionID());
}
@Deprecated
@@ -205,8 +202,7 @@ public class ScriptEntity<T extends Entity> implements IEntity {
NBTTagCompound compound = particle.writeToNBT();
compound.setInteger("EntityID", entityID);
compound.setInteger("DimensionID", this.getWorld().getDimensionID());
NoppesUtilServer.spawnScriptedParticle(compound);
NoppesUtilServer.spawnScriptedParticle(compound, this.getWorld().getDimensionID());
}
@Deprecated
@@ -230,8 +226,7 @@ public class ScriptEntity<T extends Entity> implements IEntity {
NBTTagCompound compound = particle.writeToNBT();
compound.setInteger("EntityID", entityID);
compound.setInteger("DimensionID", this.getWorld().getDimensionID());
NoppesUtilServer.spawnScriptedParticle(compound);
NoppesUtilServer.spawnScriptedParticle(compound, this.getWorld().getDimensionID());
}
@Deprecated
@@ -250,8 +245,7 @@ public class ScriptEntity<T extends Entity> implements IEntity {
NBTTagCompound compound = particle.writeToNBT();
compound.setInteger("EntityID", entityID);
compound.setInteger("DimensionID", this.getWorld().getDimensionID());
NoppesUtilServer.spawnScriptedParticle(compound);
NoppesUtilServer.spawnScriptedParticle(compound, this.getWorld().getDimensionID());
}
public void spawnParticle(IParticle entityParticle) { entityParticle.spawnOnEntity(this); }