Use sendToAllTracking for update packets (#5496)

* Don't check Y height for sending update packets. Seems to fix compat with cubic chunks #5262

* First pass transitioning from using sendToReceivers to using built in forge stuff

* Make code cleaner to read with helper methods

* Fix accidental extra code from a local branch issue I had

* Further improve readability

* Rename method

* shortcut if player not in same dimension & use EMP.server for the reference
This commit is contained in:
Richard Freimer authored and Xander committed 2019-06-08 16:51:37 +08:00
1 parent 55e8980b4a
commit 4dd1e81c27
74 files changed
+196 -289

No files matched your search

@@ -9,7 +9,6 @@ import java.util.UUID;
import javax.annotation.Nonnull;
import mekanism.api.Chunk3D;
import mekanism.api.Coord4D;
import mekanism.api.Range4D;
import mekanism.api.TileNetworkList;
import mekanism.common.Mekanism;
import mekanism.common.MekanismBlocks;
@@ -163,8 +162,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
shouldRender = status == 1 || status > 4;
if (shouldRender != prevShouldRender) {
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new TileNetworkList())),
Coord4D.get(this).getTargetPoint(40D));
Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(this), Coord4D.get(this).getTargetPoint(40D));
//This also means the comparator output changed so notify the neighbors we have a change
MekanismUtils.notifyLoadedNeighborsOfTileChange(world, Coord4D.get(this));
}
@@ -334,7 +332,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo
entity.changeDimension(coord.dimensionId, (world, entity2, yaw) -> entity2.setPositionAndUpdate(coord.x + 0.5, coord.y + 1, coord.z + 0.5));
} else {
entity.setPositionAndUpdate(coord.x + 0.5, coord.y + 1, coord.z + 0.5);
Mekanism.packetHandler.sendToReceivers(new EntityMoveMessage(entity), new Range4D(new Coord4D(entity)));
Mekanism.packetHandler.sendToAllTracking(new EntityMoveMessage(entity), new Coord4D(entity));
}
}