@Override public ISpatialDimension getSpatialDimension() { final int id = AppEng.instance().getStorageDimensionID(); World w = DimensionManager.getWorld( id ); if( w == null ) { DimensionManager.initDimension( id ); w = DimensionManager.getWorld( id ); } if( w != null && w.hasCapability( Capabilities.SPATIAL_DIMENSION, null ) ) { return w.getCapability( Capabilities.SPATIAL_DIMENSION, null ); } return null; }
@SubscribeEvent public void attachSpatialDimensionManager( AttachCapabilitiesEvent<World> event ) { if( AEConfig.instance() .isFeatureEnabled( AEFeature.SPATIAL_IO ) && event.getObject() == DimensionManager.getWorld( AEConfig.instance().getStorageDimensionID() ) ) { event.addCapability( new ResourceLocation( "appliedenergistics2:spatial_dimension_manager" ), new SpatialDimensionManager( event.getObject() ) ); } }
@Nullable public World getWorld() { return DimensionManager.getWorld(world); } }
private boolean canUseNode( final long qe ) { final QuantumCluster qc = (QuantumCluster) AEApi.instance().registries().locatable().getLocatableBy( qe ); if( qc != null ) { final World theWorld = qc.center.getWorld(); if( !qc.isDestroyed ) { final Chunk c = theWorld.getChunkFromBlockCoords( qc.center.getPos() ); if( c.isLoaded() ) { final int id = theWorld.provider.getDimension(); final World cur = DimensionManager.getWorld( id ); final TileEntity te = theWorld.getTileEntity( qc.center.getPos() ); return te != qc.center || theWorld != cur; } } } return true; }
private INetwork getNetwork() { World world = DimensionManager.getWorld(networkDimension); if (world != null) { TileEntity tile = world.getTileEntity(network); return tile instanceof INetwork ? (INetwork) tile : null; } return null; }
public boolean getBlockExist() { World w = DimensionManager.getWorld(dimention); if (w == null) return false; return w.blockExists(x, y, z); }
@Override @Nullable public INetwork getNetwork() { World world = DimensionManager.getWorld(networkDimension); if (world != null) { TileEntity tile = world.getTileEntity(network); return tile instanceof INetwork ? (INetwork) tile : null; } return null; }
@Override @Nullable public INetwork getNetwork() { World world = DimensionManager.getWorld(networkDimension); if (world != null) { TileEntity tile = world.getTileEntity(network); return tile instanceof INetwork ? (INetwork) tile : null; } return null; }
/** * Get save location for Minecolonies backup data, from the world/save * directory. * * @return Save file for minecolonies. */ @NotNull private static File getBackupSaveLocation(final Date date) { @NotNull final File saveDir = new File(DimensionManager.getWorld(0).getSaveHandler().getWorldDirectory(), FILENAME_MINECOLONIES_PATH); return new File(saveDir, String.format(FILENAME_MINECOLONIES_BACKUP, new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss").format(date))); }
/** * Get save location for Minecolonies data, from the world/save directory. * * @return Save file for minecolonies. */ @NotNull public static File getSaveLocation() { @NotNull final File saveDir = new File(DimensionManager.getWorld(0).getSaveHandler().getWorldDirectory(), FILENAME_MINECOLONIES_PATH); return new File(saveDir, FILENAME_MINECOLONIES); }
public static World getStoredWorld(ItemStack stack){ NBTTagCompound tag = stack.getTagCompound(); if(tag != null){ return DimensionManager.getWorld(tag.getInteger("WorldOfTileStored")); } return null; }
@Override public void fromBytes(ByteBuf buf){ int worldId = buf.readInt(); BlockPos pos = new PacketBuffer(buf).readBlockPos(); this.data = ByteBufUtils.readTag(buf); World world = DimensionManager.getWorld(worldId); if(world != null){ this.tileToSync = world.getTileEntity(pos); System.out.println(this.tileToSync.hashCode()); } }
public void onMessageFromClient() { World world = DimensionManager.getWorld(dimension); if (world != null) { if (!world.isBlockLoaded(pos)) return; TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileFilteredRoutingNode) { ((TileFilteredRoutingNode) tile).setGhostItemAmount(ghostItemSlot, amount); } } } }
private static void flushChanges(int chunkX, int chunkY, int dim, ChangeList list) { WorldServer world = DimensionManager.getWorld(dim); PlayerChunkMap manager = world.getPlayerChunkMap(); for (EntityPlayer player : world.playerEntities) { if (manager.isPlayerWatchingChunk((EntityPlayerMP) player, chunkX, chunkY)) { wrapper.sendTo(new PacketMultipartAction(list), (EntityPlayerMP) player); } } }
private void handle(PacketGetInfo message, MessageContext ctx) { WorldServer world = DimensionManager.getWorld(message.dim); if (world != null) { ProbeInfo probeInfo = getProbeInfo(ctx.getServerHandler().player, message.mode, world, message.pos, message.sideHit, message.hitVec, message.pickBlock); PacketHandler.INSTANCE.sendTo(new PacketReturnInfo(message.dim, message.pos, probeInfo), ctx.getServerHandler().player); } } }
@Override public void handleData(NBTTagCompound compound, MessageContext context){ World world = DimensionManager.getWorld(compound.getInteger("WorldID")); Entity entity = world.getEntityByID(compound.getInteger("PlayerID")); if(entity instanceof EntityPlayer){ Container container = ((EntityPlayer)entity).openContainer; if(container instanceof IButtonReactor){ ((IButtonReactor)container).onButtonPressed(compound.getInteger("ButtonID"), (EntityPlayer)entity); } } } };
private void handle(PacketGetEntityInfo message, MessageContext ctx) { WorldServer world = DimensionManager.getWorld(message.dim); if (world != null) { Entity entity = world.getEntityFromUuid(message.uuid); if (entity != null) { ProbeInfo probeInfo = getProbeInfo(ctx.getServerHandler().player, message.mode, world, entity, message.hitVec); PacketHandler.INSTANCE.sendTo(new PacketReturnEntityInfo(message.uuid, probeInfo), ctx.getServerHandler().player); } } } }
final int src_side = ish.getInteger( "side" ); final int dimid = ish.getInteger( "dimid" ); final World src_w = DimensionManager.getWorld( dimid );
@Override public void handleData(NBTTagCompound compound, MessageContext context){ World world = DimensionManager.getWorld(compound.getInteger("WorldID")); TileEntity tile = world.getTileEntity(new BlockPos(compound.getInteger("X"), compound.getInteger("Y"), compound.getInteger("Z"))); if(tile instanceof INumberReactor){ INumberReactor reactor = (INumberReactor)tile; reactor.onNumberReceived(compound.getDouble("Number"), compound.getInteger("NumberID"), (EntityPlayer)world.getEntityByID(compound.getInteger("PlayerID"))); } } };
@Override public void handleData(NBTTagCompound compound, MessageContext context){ World world = DimensionManager.getWorld(compound.getInteger("WorldID")); TileEntity tile = world.getTileEntity(new BlockPos(compound.getInteger("X"), compound.getInteger("Y"), compound.getInteger("Z"))); if(tile instanceof IStringReactor){ IStringReactor reactor = (IStringReactor)tile; reactor.onTextReceived(compound.getString("Text"), compound.getInteger("TextID"), (EntityPlayer)world.getEntityByID(compound.getInteger("PlayerID"))); } } };