use of com.qouteall.immersive_portals.portal.global_portals.GlobalTrackedPortal in project ImmersivePortalsMod by qouteall.
the class MyNetworkClient method processGlobalPortalUpdate.
private static void processGlobalPortalUpdate(PacketContext context, PacketByteBuf buf) {
DimensionType dimensionType = DimensionType.byRawId(buf.readInt());
CompoundTag compoundTag = buf.readCompoundTag();
MinecraftClient.getInstance().execute(() -> {
ClientWorld world = CGlobal.clientWorldLoader.getOrCreateFakedWorld(dimensionType);
List<GlobalTrackedPortal> portals = GlobalPortalStorage.getPortalsFromTag(compoundTag, world);
((IEClientWorld) world).setGlobalPortals(portals);
});
}
use of com.qouteall.immersive_portals.portal.global_portals.GlobalTrackedPortal in project ImmersivePortalsMod by qouteall.
the class CHelper method getClientNearbyPortals.
public static Stream<Portal> getClientNearbyPortals(double range) {
ClientPlayerEntity player = MinecraftClient.getInstance().player;
List<GlobalTrackedPortal> globalPortals = ((IEClientWorld) player.world).getGlobalPortals();
Stream<Portal> nearbyPortals = McHelper.getEntitiesNearby(player, Portal.class, range);
if (globalPortals == null) {
return nearbyPortals;
} else {
return Streams.concat(globalPortals.stream().filter(p -> p.getDistanceToNearestPointInPortal(player.getPos()) < range * 2), nearbyPortals);
}
}
Aggregations