Remove some more unneeded syncs

This commit is contained in:
Vincent Lee committed 2020-06-12 09:02:44 -05:00
1 parent 6da5699efb
commit 4d7defad63
8 files changed
+13 -20

No files matched your search

@@ -19,13 +19,14 @@ import net.minecraft.world.server.ServerWorld;
public final class VanillaPacketDispatcher {
public static void dispatchTEToNearbyPlayers(TileEntity tile) {
SUpdateTileEntityPacket packet = tile.getUpdatePacket();
BlockPos pos = tile.getPos();
if (packet != null && tile.getWorld() instanceof ServerWorld) {
((ServerChunkProvider) tile.getWorld().getChunkProvider()).chunkManager
.getTrackingPlayers(new ChunkPos(pos), false)
.forEach(e -> e.connection.sendPacket(packet));
if (tile.getWorld() instanceof ServerWorld) {
SUpdateTileEntityPacket packet = tile.getUpdatePacket();
if (packet != null) {
BlockPos pos = tile.getPos();
((ServerChunkProvider) tile.getWorld().getChunkProvider()).chunkManager
.getTrackingPlayers(new ChunkPos(pos), false)
.forEach(e -> e.connection.sendPacket(packet));
}
}
}
@@ -125,7 +125,7 @@ public class BlockPool extends BlockModWaterloggable implements IWandHUD, IWanda
@Override
public boolean onUsedByWand(PlayerEntity player, ItemStack stack, World world, BlockPos pos, Direction side) {
((TilePool) world.getTileEntity(pos)).onWanded(player, stack);
((TilePool) world.getTileEntity(pos)).onWanded(player);
return true;
}
}
@@ -70,8 +70,6 @@ public class TileDistributor extends TileMod implements IManaReceiver, ITickable
int manaForEach = mana / tiles;
for (IManaReceiver pool : validPools) {
pool.receiveMana(manaForEach);
TileEntity tile = (TileEntity) pool;
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, tile.getPos());
}
}
}
@@ -392,12 +392,11 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
}
public void onWanded(PlayerEntity player, ItemStack wand) {
public void onWanded(PlayerEntity player) {
if (player == null || player.isSneaking()) {
outputting = !outputting;
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, pos);
}
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, pos);
}
@OnlyIn(Dist.CLIENT)
@@ -25,7 +25,7 @@ public class TilePump extends TileMod implements ITickableTileEntity {
private static final String TAG_ACTIVE = "active";
public float innerRingPos;
public boolean active = false;
private boolean active = false;
public boolean hasCart = false;
public boolean hasCartOnTop = false;
public float moving = 0F;
@@ -180,11 +180,8 @@ public class EntityPoolMinecart extends AbstractMinecartEntity {
}
if (did) {
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, posP_);
pump.hasCart = true;
if (!pump.active) {
pump.setActive(true);
}
pump.setActive(true);
}
if (can) {
@@ -55,7 +55,6 @@ public class ItemBlackLotus extends Item implements IManaDissolvable {
if (!item.world.isRemote) {
pool.receiveMana(t2 ? MANA_PER_T2 : MANA_PER);
stack.shrink(1);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(item.world, tile.getPos());
PacketHandler.sendToNearby(item.world, item, new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.BLACK_LOTUS_DISSOLVE, item.getPosX(), tile.getPos().getY() + 0.5, item.getPosZ()));
}
@@ -45,7 +45,6 @@ public class ItemSpark extends Item implements IManaGivingItem {
spark.setPosition(pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5);
world.addEntity(spark);
attach.attachSpark(spark);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, pos);
}
return ActionResultType.SUCCESS;
}