@Nullable private static Integer findFreeDimensionID() { for (int i=2; i<Integer.MAX_VALUE; i++) { if (!DimensionManager.isDimensionRegistered(i)) { // DEBUG System.out.println("Found free dimension ID = "+i); return i; } } // DEBUG System.out.println("ERROR: Could not find free dimension ID"); return null; }
@Nullable public World getWorld(MinecraftServer server) { World world = this.world.get(); if (world == null && DimensionManager.isDimensionRegistered(dimension)) { this.world = new WeakReference<>(world = server.getWorld(dimension)); } return world; }
public static @Nonnull String getDimenionName(int dim) { if (!DimensionManager.isDimensionRegistered(dim)) { return Integer.toString(dim); } DimensionType type = DimensionManager.getProviderType(dim); if (type == null) { return Integer.toString(dim); } String name = type.getName(); int[] dims = DimensionManager.getDimensions(type); if (dims != null && dims.length > 1) { name += " " + dim; } return name; }
@Nullable public ForgeChunkManager.Ticket requestTicket(MinecraftServer server, TicketKey key) { ForgeChunkManager.Ticket ticket = ticketMap.get(key); if (ticket == null && DimensionManager.isDimensionRegistered(key.dimension)) { WorldServer worldServer = server.getWorld(key.dimension); ticket = ForgeChunkManager.requestTicket(FTBUtilities.INST, worldServer, ForgeChunkManager.Type.NORMAL); if (ticket != null) { ticketMap.put(key, ticket); ticket.getModData().setString("Team", key.teamId); } } return ticket; }
@Override public void fromNBT(NBTTagCompound tag) { NBTTagList list = tag.getTagList("list", MinecraftHelpers.NBTTag_Types.NBTTagCompound.ordinal()); for(int i = 0; i < list.tagCount(); i++) { NBTTagCompound elementTag = list.getCompoundTagAt(i); int dimensionId = elementTag.getInteger("dimension"); BlockPos pos = BlockPos.fromLong(elementTag.getLong("pos")); EnumFacing side = null; if (elementTag.hasKey("side", Constants.NBT.TAG_INT)) { side = EnumFacing.VALUES[elementTag.getInteger("side")]; } if(!net.minecraftforge.common.DimensionManager.isDimensionRegistered(dimensionId)) { IntegratedDynamics.clog(Level.WARN, String.format("Skipped loading part from a network at the " + "invalid dimension id %s.", dimensionId)); } else { World world = FMLCommonHandler.instance().getMinecraftServerInstance().getWorld(dimensionId); IPathElement pathElement = TileHelpers.getCapability(world, pos, side, PathElementConfig.CAPABILITY); if(pathElement == null) { IntegratedDynamics.clog(Level.WARN, String.format("Skipped loading part from a network at " + "position %s in world %s because it has no valid path element.", pos, dimensionId)); } else { elements.add(SidedPathElement.of(pathElement, side)); } } } } }
if (!DimensionManager.isDimensionRegistered(chunk.getPos().dim))
throw t; if (!DimensionManager.isDimensionRegistered(dimension)) { throw new CommandException("chat.cofh.command.world.notFound"); throw t; if (!DimensionManager.isDimensionRegistered(dimension)) { throw new CommandException("chat.cofh.command.world.notFound"); if (!DimensionManager.isDimensionRegistered(dimension)) { throw new CommandException("chat.cofh.command.world.notFound"); int dimension = CommandBase.parseInt(arguments[5]); if (!DimensionManager.isDimensionRegistered(dimension)) { throw new CommandException("chat.cofh.command.world.notFound");