use of com.qouteall.immersive_portals.ducks.IEEntityTracker in project ImmersivePortalsMod by qouteall.
the class MixinThreadedAnvilChunkStorage method sendChunkDataPackets.
/**
* @author qouteall
*/
@Overwrite
private void sendChunkDataPackets(ServerPlayerEntity player, Packet<?>[] packets_1, WorldChunk worldChunk_1) {
// vanilla will not manage interdimensional chunk loading
if (player.dimension != world.dimension.getType()) {
return;
}
DimensionalChunkPos chunkPos = new DimensionalChunkPos(world.dimension.getType(), worldChunk_1.getPos());
boolean isChunkDataSent = SGlobal.chunkTrackingGraph.isChunkDataSent(player, chunkPos);
if (isChunkDataSent) {
return;
}
ModMain.serverTaskList.addTask(() -> {
SGlobal.chunkTrackingGraph.onChunkDataSent(player, chunkPos);
return true;
});
if (packets_1[0] == null) {
packets_1[0] = MyNetwork.createRedirectedMessage(world.dimension.getType(), new ChunkDataS2CPacket(worldChunk_1, 65535));
packets_1[1] = MyNetwork.createRedirectedMessage(world.dimension.getType(), new LightUpdateS2CPacket(worldChunk_1.getPos(), this.serverLightingProvider));
}
player.sendInitialChunkPackets(worldChunk_1.getPos(), packets_1[0], packets_1[1]);
DebugRendererInfoManager.method_19775(this.world, worldChunk_1.getPos());
List<Entity> list_1 = Lists.newArrayList();
List<Entity> list_2 = Lists.newArrayList();
ObjectIterator var6 = this.entityTrackers.values().iterator();
while (var6.hasNext()) {
IEEntityTracker threadedAnvilChunkStorage$EntityTracker_1 = (IEEntityTracker) var6.next();
Entity entity_1 = threadedAnvilChunkStorage$EntityTracker_1.getEntity_();
if (entity_1 != player && entity_1.chunkX == worldChunk_1.getPos().x && entity_1.chunkZ == worldChunk_1.getPos().z) {
threadedAnvilChunkStorage$EntityTracker_1.updateCameraPosition_(player);
if (entity_1 instanceof MobEntity && ((MobEntity) entity_1).getHoldingEntity() != null) {
list_1.add(entity_1);
}
if (!entity_1.getPassengerList().isEmpty()) {
list_2.add(entity_1);
}
}
}
Iterator var9;
Entity entity_3;
if (!list_1.isEmpty()) {
var9 = list_1.iterator();
while (var9.hasNext()) {
entity_3 = (Entity) var9.next();
player.networkHandler.sendPacket(MyNetwork.createRedirectedMessage(world.getDimension().getType(), new EntityAttachS2CPacket(entity_3, ((MobEntity) entity_3).getHoldingEntity())));
}
}
if (!list_2.isEmpty()) {
var9 = list_2.iterator();
while (var9.hasNext()) {
entity_3 = (Entity) var9.next();
player.networkHandler.sendPacket(MyNetwork.createRedirectedMessage(world.getDimension().getType(), new EntityPassengersSetS2CPacket(entity_3)));
}
}
}
Aggregations