Java 类net.minecraftforge.common.ForgeChunkManager.Ticket 实例源码

项目:4Space-5    文件:ChunkLoadingCallback.java   
@Override
public void ticketsLoaded(List<Ticket> tickets, World world)
{
    for (Ticket ticket : tickets)
    {
        NBTTagCompound nbt = ticket.getModData();

        if (nbt != null)
        {
            int tileX = nbt.getInteger("ChunkLoaderTileX");
            int tileY = nbt.getInteger("ChunkLoaderTileY");
            int tileZ = nbt.getInteger("ChunkLoaderTileZ");
            TileEntity tile = world.getTileEntity(tileX, tileY, tileZ);

            if (tile instanceof IChunkLoader)
            {
                ((IChunkLoader) tile).onTicketLoaded(ticket, false);
            }
        }
    }
}
项目:4Space-5    文件:ChunkLoadingCallback.java   
public static void forceChunk(Ticket ticket, World world, int x, int y, int z, String playerName)
{
    ChunkLoadingCallback.addToList(world, x, y, z, playerName);
    ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(x >> 4, z >> 4);
    ForgeChunkManager.forceChunk(ticket, chunkPos);
    //
    // TileEntity tile = world.getTileEntity(x, y, z);
    //
    // if (tile instanceof IChunkLoader)
    // {
    // IChunkLoader chunkLoader = (IChunkLoader) tile;
    // int dimID = world.provider.dimensionId;
    //
    // HashSet<IChunkLoader> chunkList = loadedChunks.get(dimID);
    //
    // if (chunkList == null)
    // {
    // chunkList = new HashSet<IChunkLoader>();
    // }
    //
    // ForgeChunkManager.forceChunk(ticket, chunkPos);
    // chunkList.add(chunkLoader);
    // loadedChunks.put(dimID, chunkList);
    // }
}
项目:CrystalMod    文件:WorksiteChunkLoader.java   
@Override
public void ticketsLoaded(List<Ticket> tickets, World world)
{
    for(Ticket tk : tickets)
    {
        if(tk.getModData().hasKey("tilePosition"))
        {
            NBTTagCompound posTag = tk.getModData().getCompoundTag("tilePosition");
            int x = posTag.getInteger("x");
            int y = posTag.getInteger("y");
            int z = posTag.getInteger("z");
            TileEntity te = world.getTileEntity(new BlockPos(x, y, z));
            if(te instanceof IChunkLoaderTile) 
            {
                ((IChunkLoaderTile)te).setTicket(tk);
            }
        }
    }
}
项目:AChunkLoader    文件:ChunkLoadingCallback.java   
@Override
public void ticketsLoaded(List<Ticket> tickets, World world)
{
    for (ForgeChunkManager.Ticket ticket : tickets)
    {
        int xPos = ticket.getModData().getInteger("xPos");
        int yPos = ticket.getModData().getInteger("yPos");
        int zPos = ticket.getModData().getInteger("zPos");

        BlockPos pos = new BlockPos(xPos, yPos, zPos);

        Block block = world.getBlockState(pos).getBlock();
        if (block == ModBlocks.getBlock(ModBlocks.CHUNK_LOADER)) {
            ChunkLoaderTileEntity chunkLoaderTile = (ChunkLoaderTileEntity) world.getTileEntity(pos);
            if(chunkLoaderTile != null)
            {
                chunkLoaderTile.forceChunkLoading(ticket);
            }
        }
    }
}
项目:ChickenChunks    文件:PlayerChunkViewerTracker.java   
public void writeTicketToPacket(PacketCustom packet, Ticket ticket, Collection<ChunkPos> chunkSet) {
    packet.writeInt(manager.ticketIDs.get(ticket));
    packet.writeString(ticket.getModId());
    String player = ticket.getPlayerName();
    packet.writeBoolean(player != null);
    if (player != null) {
        packet.writeString(player);
    }
    packet.writeByte(ticket.getType().ordinal());
    Entity entity = ticket.getEntity();
    if (entity != null) {
        packet.writeInt(entity.getEntityId());
    }
    packet.writeShort(chunkSet.size());
    for (ChunkPos chunk : chunkSet) {
        packet.writeInt(chunk.x);
        packet.writeInt(chunk.z);
    }

    knownTickets.add(manager.ticketIDs.get(ticket));
}
项目:ChickenChunks    文件:PlayerChunkViewerTracker.java   
@SuppressWarnings ("unchecked")
public void loadDimension(WorldServer world) {
    PacketCustom packet = new PacketCustom(channel, 2).compress();
    int dim = CommonUtils.getDimension(world);
    packet.writeInt(dim);

    Collection<Chunk> allchunks = world.getChunkProvider().getLoadedChunks();
    packet.writeInt(allchunks.size());
    for (Chunk chunk : allchunks) {
        packet.writeInt(chunk.x);
        packet.writeInt(chunk.z);
    }

    Map<Ticket, Collection<ChunkPos>> tickets = ForgeChunkManager.getPersistentChunksFor(world).inverse().asMap();
    packet.writeInt(tickets.size());
    for (Entry<Ticket, Collection<ChunkPos>> entry : tickets.entrySet()) {
        writeTicketToPacket(packet, entry.getKey(), entry.getValue());
    }

    packet.sendToPlayer(owner);
}
项目:ChickenChunks    文件:ChunkLoaderManager.java   
protected void addChunk(DimChunkCoord coord) {
    if (heldChunks.containsKey(coord)) {
        return;
    }

    Stack<Ticket> freeTickets = ticketsWithSpace.computeIfAbsent(coord.dimension, k -> new Stack<>());

    Ticket ticket;
    if (freeTickets.isEmpty()) {
        freeTickets.push(ticket = createTicket(coord.dimension));
    } else {
        ticket = freeTickets.peek();
    }

    ForgeChunkManager.forceChunk(ticket, coord.getChunkCoord());
    heldChunks.put(coord, ticket);
    if (ticket.getChunkList().size() == ticket.getChunkListDepth() && !freeTickets.isEmpty()) {
        freeTickets.pop();
    }
}
项目:enhancedportals    文件:TileController.java   
public void forceChunk(Ticket ticket) {
    if (ticket != null) {
        ticket.getModData().setInteger("controllerX", xCoord);
        ticket.getModData().setInteger("controllerY", yCoord);
        ticket.getModData().setInteger("controllerZ", zCoord);

        ArrayList<ChunkCoordIntPair> loadedChunks = new ArrayList<ChunkCoordIntPair>();

        ForgeChunkManager.forceChunk(ticket, getBlockPos().getChunk());
        loadedChunks.add(getBlockPos().getChunk());

        for (BlockPos pos : portalFrames) {
            if (!loadedChunks.contains(pos.getChunk())) {
                ForgeChunkManager.forceChunk(ticket, pos.getChunk());
                loadedChunks.add(pos.getChunk());
            }
        }

        EnhancedPortals.instance.getLogger().debug("Keeping " + loadedChunks.size() + " chunks loaded at " + getWorldPos());
    } else {
        EnhancedPortals.instance.getLogger().warn("Could not get a ChunkLoading ticket for Portal at " + getWorldPos() + " Things may not work as expected!"); 
    }

    chunkLoadTicket = ticket;
}
项目:enhancedportals    文件:EnhancedPortals.java   
/**
 * Make sure the tickets are valid
 */
@Override
public List<Ticket> ticketsLoaded(List<Ticket> tickets, World world, int maxTicketCount) {
    List<Ticket> valid = new ArrayList<Ticket>();

    for (Ticket ticket : tickets) {
        int x = ticket.getModData().getInteger("controllerX");
        int y = ticket.getModData().getInteger("controllerY");
        int z = ticket.getModData().getInteger("controllerZ");
        TileEntity tile = world.getTileEntity(x, y, z);

        if (tile instanceof TileController)
            valid.add(ticket);
    }

    return valid;
}
项目:ChunkyPeripherals    文件:CRModListLoadedChunks.java   
@Override
public void processCommand(ICommandSender icommandsender, String[] astring)
{
    ChunkyPeripherals.logger.info("CRMod's chunk list:");
    Collection<Ticket> c =TicketManager.myChunkList;
    Iterator<Ticket> i = c.iterator();
    int count=0;
    while (i.hasNext())
    {
        Ticket t = i.next();
        ChunkyPeripherals.logger.info("ticket #"+(count++)+" ="+t /*+ "world= " + t.world.getWorldInfo().getWorldName()*/);
        ImmutableSet<ChunkCoordIntPair> sc = t.getChunkList();
        ImmutableList<ChunkCoordIntPair> lc = sc.asList();
        Iterator<ChunkCoordIntPair> ic = lc.iterator();
        while(ic.hasNext())
        {
            ChunkCoordIntPair ccoord = ic.next();
            ChunkyPeripherals.logger.info("chunk " + ccoord.toString() + "("+ ccoord.chunkXPos*16+" ; "+ ccoord.chunkZPos*16 + ")");
        }
    }
}
项目:ChunkyPeripherals    文件:CRModListForgePersistentChunks.java   
@Override
public void processCommand(ICommandSender icommandsender, String[] astring)
{
    ChunkyPeripherals.logger.info("World: " + icommandsender.getEntityWorld().getWorldInfo().getWorldName());
    ImmutableSetMultimap<ChunkCoordIntPair, Ticket> l = ForgeChunkManager.getPersistentChunksFor(icommandsender.getEntityWorld());
    Collection<Ticket> c =l.values();
    Iterator<Ticket> i = c.iterator();
    int count=0;
    while (i.hasNext())
    {
        Ticket t = i.next();
        ChunkyPeripherals.logger.info("ticket #"+(count++)+" ="+t);
        ImmutableSet<ChunkCoordIntPair> sc = t.getChunkList();
        ImmutableList<ChunkCoordIntPair> lc = sc.asList();
        Iterator<ChunkCoordIntPair> ic = lc.iterator();
        while(ic.hasNext())
        {
            ChunkCoordIntPair ccoord = ic.next();
            ChunkyPeripherals.logger.info("chunk " + ccoord.toString() + "("+ ccoord.chunkXPos*16+" ; "+ ccoord.chunkZPos*16 + ")");
        }
    }
}
项目:vsminecraft    文件:ChunkManager.java   
@Override
public void ticketsLoaded(List<Ticket> tickets, World world)
{
    for(Ticket ticket : tickets)
    {
        int x = ticket.getModData().getInteger("xCoord");
        int y = ticket.getModData().getInteger("yCoord");
        int z = ticket.getModData().getInteger("zCoord");

        TileEntity tileEntity = world.getTileEntity(x, y, z);

        if(tileEntity instanceof IChunkLoader)
        {
            ((IChunkLoader)tileEntity).forceChunks(ticket);
        }
    }
}
项目:PeripheralsPlusPlus    文件:ChunkLoadingCallback.java   
@Override
public void ticketsLoaded(List<Ticket> tickets, World world) {
    for (Ticket ticket : tickets) {
        int x = ticket.getModData().getInteger("turtleX");
        int y = ticket.getModData().getInteger("turtleY");
        int z = ticket.getModData().getInteger("turtleZ");

        TileEntity te = world.getBlockTileEntity(x, y, z);
        if (te instanceof ITurtleAccess) {
            ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(x >> 4, z >> 4));

            PeripheralChunkLoader loader = Util.getPeripheral((ITurtleAccess)te, PeripheralChunkLoader.class);
            if (loader != null) loader.ticketCreated = true;
        }
    }
}
项目:PeripheralsPlusPlus    文件:ChunkLoadingCallback.java   
@Override
public List<Ticket> ticketsLoaded(List<Ticket> tickets, World world, int maxTicketCount) {
    List<Ticket> ret = new LinkedList<Ticket>();
    List<ChunkCoordinates> known = new LinkedList<ChunkCoordinates>();

    for (Ticket ticket : tickets) {
        int x = ticket.getModData().getInteger("turtleX");
        int y = ticket.getModData().getInteger("turtleY");
        int z = ticket.getModData().getInteger("turtleZ");

        ChunkCoordinates coords = new ChunkCoordinates(x, y, z);
        if (known.contains(coords)) continue;
        else known.add(coords);

        TileEntity te = world.getBlockTileEntity(x, y, z);
        if (te instanceof ITurtleAccess && Util.getPeripheral((ITurtleAccess)te, PeripheralChunkLoader.class) != null) {
            ret.add(ticket);
        }
    }

    int removed = tickets.size() - known.size();
    if (removed > 0) MiscPeripherals.log.info("Removed "+removed+" bugged duplicate chunk loading tickets from world "+world.provider.dimensionId);

    return ret;
}
项目:enderutilities    文件:ChunkLoading.java   
@Override
public void ticketsLoaded(List<Ticket> tickets, World world)
{
    for (Ticket ticket : tickets)
    {
        //System.out.println("void ticketsLoaded(): looping tickets");
        if (ticket != null)
        {
            for (ChunkPos chunk : ticket.getChunkList())
            {
                //System.out.println("void ticketsLoaded(): forcing chunk: " + chunk + " in dimension: " + ticket.world.provider.getDimensionId());
                ForgeChunkManager.forceChunk(ticket, chunk);
            }
        }
    }
}
项目:enderutilities    文件:ChunkLoading.java   
public void removeTicket(Ticket ticket)
{
    if (ticket == null || ticket.world == null)
    {
        return;
    }

    if (ticket.isPlayerTicket())
    {
        UUID uuid = this.getPlayerUUIDFromTicket(ticket);
        if (ticket.world.provider != null && uuid != null)
        {
            this.playerTickets.get(uuid.toString() + "-" + ticket.world.provider.getDimension()).remove(ticket);
        }
    }
    else
    {
        this.modTickets.get(ticket.world).remove(ticket);
    }
}
项目:enderutilities    文件:ChunkLoading.java   
public boolean loadChunkForcedWithPlayerTicket(EntityPlayer player, int dimension, int chunkX, int chunkZ, int unloadDelay)
{
    // If the target chunk is already being loaded by something, we don't need another ticket/forced load for it
    // We just refresh the timeout, if the previous one is shorter that the new request
    if (this.hasChunkTimeout(dimension, chunkX, chunkZ))
    {
        if (this.refreshChunkTimeout(dimension, chunkX, chunkZ, unloadDelay, true))
        {
            return true;
        }
    }

    Ticket ticket = this.requestPlayerTicket(player, dimension, unloadDelay != 0);

    return this.loadChunkForcedWithTicket(ticket, dimension, chunkX, chunkZ, unloadDelay);
}
项目:enderutilities    文件:ChunkLoading.java   
public boolean loadChunkForcedWithModTicket(int dimension, int chunkX, int chunkZ, int unloadDelay)
{
    // If the target chunk is already being loaded by something, we don't need another ticket/forced load for it
    // We just refresh the timeout, if the previous one is shorter that the new request
    if (this.hasChunkTimeout(dimension, chunkX, chunkZ))
    {
        if (this.refreshChunkTimeout(dimension, chunkX, chunkZ, unloadDelay, true))
        {
            return true;
        }
    }

    Ticket ticket = this.requestModTicket(dimension, unloadDelay != 0);

    return this.loadChunkForcedWithTicket(ticket, dimension, chunkX, chunkZ, unloadDelay);
}
项目:enderutilities    文件:ChunkLoading.java   
public boolean loadChunkForcedWithTicket(Ticket ticket, int dimension, int chunkX, int chunkZ, int unloadDelay)
{
    if (ticket == null)
    {
        EnderUtilities.logger.warn("loadChunkForcedWithTicket(): ticket == null");
        return false;
    }

    ForgeChunkManager.forceChunk(ticket, new ChunkPos(chunkX, chunkZ));
    if (unloadDelay > 0)
    {
        //System.out.println("loadChunkForcedWithTicket() adding timeout: " + unloadDelay);
        this.addChunkTimeout(ticket, dimension, chunkX, chunkZ, unloadDelay);
    }

    return this.loadChunkWithoutForce(dimension, chunkX, chunkZ);
}
项目:enderutilities    文件:ChunkLoading.java   
public void addChunkTimeout(Ticket ticket, int dimension, int chunkX, int chunkZ, int timeout)
{
    String s = dimChunkCoordsToString(dimension, chunkX, chunkZ);

    DimChunkCoordTimeout dcct = this.timeOuts.get(s);
    if (dcct != null)
    {
        //System.out.println("addChunkTimeout(): re-setting");
        dcct.setTimeout(timeout);
    }
    else if (ticket != null)
    {
        //System.out.println("addChunkTimeout(): adding");
        this.timeOuts.put(s, new DimChunkCoordTimeout(ticket, dimension, new ChunkPos(chunkX, chunkZ), timeout));
    }
}
项目:Dimensional-Pockets    文件:ChunkLoaderHandler.java   
private static void revalidateTicket(CoordSet chunkXZSet, Ticket currentTicket) {
    TicketWrapper wrapper = ticketMap.get(chunkXZSet);

    if (wrapper == null) {
        DPLogger.severe("Can't revalidate ticket! No TicketWrapper in ticketMap for chunkSet: " + chunkXZSet.toString());
        return;
    }

    if (wrapper.ticket != null) {
        ForgeChunkManager.releaseTicket(wrapper.ticket);
    }

    wrapper.ticket = currentTicket;

    ForgeChunkManager.forceChunk(wrapper.ticket, new ChunkCoordIntPair(chunkXZSet.x, chunkXZSet.z));
}
项目:RuneCraftery    文件:ForgeChunkManager.java   
public static Ticket requestPlayerTicket(Object mod, String player, World world, Type type)
{
    ModContainer mc = getContainer(mod);
    if (mc == null)
    {
        FMLLog.log(Level.SEVERE, "Failed to locate the container for mod instance %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod));
        return null;
    }
    if (playerTickets.get(player).size()>playerTicketLength)
    {
        FMLLog.warning("Unable to assign further chunkloading tickets to player %s (on behalf of mod %s)", player, mc.getModId());
        return null;
    }
    Ticket ticket = new Ticket(mc.getModId(),type,world,player);
    playerTickets.put(player, ticket);
    tickets.get(world).put("Forge", ticket);
    return ticket;
}
项目:RuneCraftery    文件:ForgeChunkManager.java   
public static Ticket requestPlayerTicket(Object mod, String player, World world, Type type)
{
    ModContainer mc = getContainer(mod);
    if (mc == null)
    {
        FMLLog.log(Level.SEVERE, "Failed to locate the container for mod instance %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod));
        return null;
    }
    if (playerTickets.get(player).size()>playerTicketLength)
    {
        FMLLog.warning("Unable to assign further chunkloading tickets to player %s (on behalf of mod %s)", player, mc.getModId());
        return null;
    }
    Ticket ticket = new Ticket(mc.getModId(),type,world,player);
    playerTickets.put(player, ticket);
    tickets.get(world).put("Forge", ticket);
    return ticket;
}
项目:BetterNutritionMod    文件:ForgeChunkManager.java   
public static Ticket requestPlayerTicket(Object mod, String player, World world, Type type)
{
    ModContainer mc = getContainer(mod);
    if (mc == null)
    {
        FMLLog.log(Level.SEVERE, "Failed to locate the container for mod instance %s (%s : %x)", mod, mod.getClass().getName(), System.identityHashCode(mod));
        return null;
    }
    if (playerTickets.get(player).size()>playerTicketLength)
    {
        FMLLog.warning("Unable to assign further chunkloading tickets to player %s (on behalf of mod %s)", player, mc.getModId());
        return null;
    }
    Ticket ticket = new Ticket(mc.getModId(),type,world,player);
    playerTickets.put(player, ticket);
    tickets.get(world).put("Forge", ticket);
    return ticket;
}
项目:Never-Enough-Currency    文件:Currency.java   
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
    proxy.postInit(event);

    ticketList = new HashMap<ChunkPos, Integer>();
    ForgeChunkManager.setForcedChunkLoadingCallback(this, new LoadingCallback() {
        @Override
        public void ticketsLoaded(List<Ticket> tickets, World world) {

        }
    });
}
项目:UniversalRemote    文件:WorldServerProxy.java   
@Override
public ImmutableSetMultimap<ChunkPos, Ticket> getPersistentChunks() {
    if (m_proxyWorld != null && Util.isPrefixInCallStack(m_modPrefix)) {
        return m_proxyWorld.getPersistentChunks();
    } else if (m_realWorld != null) {
        return m_realWorld.getPersistentChunks();
    } else {
        return super.getPersistentChunks();
    }
}
项目:wizards-of-lua    文件:ChunkLoaderTicketSupport.java   
public static void enableTicketSupport(Object mod) {
  ForgeChunkManager.setForcedChunkLoadingCallback(mod,
      new net.minecraftforge.common.ForgeChunkManager.LoadingCallback() {
        @Override
        public void ticketsLoaded(List<Ticket> tickets, World world) {
          // This is called when the server is restarted and if there are tickets that we
          // have registered before.
          // Since we do not support to restore interrupted Lua programs, we do not need
          // to do here anything.
        }
      });
}
项目:CrystalMod    文件:TileWorksiteBase.java   
@Override
public void setTicket(Ticket tk)
{
    if(chunkTicket!=null)
    {
        ForgeChunkManager.releaseTicket(chunkTicket);
        chunkTicket=null;
    }
    this.chunkTicket = tk;  
    if(this.chunkTicket==null){return;}
    writeDataToTicket(chunkTicket);
    ChunkPos ccip = new ChunkPos(getPos().getX()>>4, getPos().getZ()>>4);
    ForgeChunkManager.forceChunk(chunkTicket, ccip);  
    if(this.hasWorkBounds())
    {
        int minX = getWorkBoundsMin().getX()>>4;
        int minZ = getWorkBoundsMin().getZ()>>4;
        int maxX = getWorkBoundsMax().getX()>>4;
        int maxZ = getWorkBoundsMax().getZ()>>4;
        for(int x = minX; x<=maxX; x++)
        {
            for(int z = minZ; z<=maxZ; z++)
            {
                ccip = new ChunkPos(x, z);
                ForgeChunkManager.forceChunk(chunkTicket, ccip);
            }
        }
    }  
    }
项目:CrystalMod    文件:WorksiteChunkLoader.java   
public static void writeDataToTicket(Ticket tk, BlockPos pos)
{
    NBTTagCompound posTag = new NBTTagCompound();
    posTag.setInteger("x", pos.getX());
    posTag.setInteger("y", pos.getY());
    posTag.setInteger("z", pos.getZ());
    tk.getModData().setTag("tilePosition", posTag);
}
项目:SimpleChunkLoader    文件:ChunkLoadingHandler.java   
@Override
public void ticketsLoaded(List<Ticket> tickets, World world) 
{
    for (Ticket ticket : tickets) 
    {
        int x = ticket.getModData().getInteger("xCoord");
        int y = ticket.getModData().getInteger("yCoord");
        int z = ticket.getModData().getInteger("zCoord");
        TileEntity te = world.getTileEntity(new BlockPos(x, y, z));
        if ((te instanceof TileChunkLoader)) 
        {
            ((TileChunkLoader) te).forceChunkLoading(ticket);
        }
    }
}
项目:ChickenChunks    文件:PlayerChunkViewerTracker.java   
public void addTicket(int dimension, Ticket ticket) {
    PacketCustom packet = new PacketCustom(channel, 8);
    packet.writeInt(dimension);
    writeTicketToPacket(packet, ticket, ticket.getChunkList());

    packet.sendToPlayer(owner);
}
项目:ChickenChunks    文件:ChunkLoaderManager.java   
protected void remChunk(DimChunkCoord coord) {
    Ticket ticket = heldChunks.remove(coord);
    if (ticket == null) {
        return;
    }

    ForgeChunkManager.unforceChunk(ticket, coord.getChunkCoord());

    if (ticket.getChunkList().size() == ticket.getChunkListDepth() - 1) {
        Stack<Ticket> freeTickets = ticketsWithSpace.computeIfAbsent(coord.dimension, k -> new Stack<>());
        freeTickets.push(ticket);
    }
}
项目:enhancedportals    文件:EnhancedPortals.java   
/**
 * Tell the controller that we want the chunk to be forced
 */
@Override
public void ticketsLoaded(List<Ticket> tickets, World world) {
    for (Ticket ticket : tickets) {
        int x = ticket.getModData().getInteger("controllerX");
        int y = ticket.getModData().getInteger("controllerY");
        int z = ticket.getModData().getInteger("controllerZ");
        TileEntity tile = world.getTileEntity(x, y, z);

        if (tile instanceof TileController)
            ((TileController) tile).forceChunk(ticket);
    }
}
项目:ChunkyPeripherals    文件:ChunkyPeripheral.java   
public void callback(Ticket t,int x, int y, int z)
{
    ChunkyPeripherals.infoLog("loading turtle at "+x+";"+y+";"+z);
    ticket=t;
    getOlds();
    initialized=true;
    update();
}
项目:ChunkyPeripherals    文件:ChunkLoadingCallback.java   
private boolean ChunkloaderPeripheralBlockLoadingCallBack(Ticket ticket, World world) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException
{
    int x = ticket.getModData().getInteger("posX");
    int y = ticket.getModData().getInteger("posY");
    int z = ticket.getModData().getInteger("posZ");

    ChunkyPeripherals.infoLog("searching chunk loader peripheral block for ticket at "+x+","+y+","+z);

    //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::       
    //Find Tile Entity
    //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::



    TileEntity t = world.getTileEntity(x, y, z);

    if(t==null)
    {
        ChunkyPeripherals.logger.warn("no tile entity at ("+x+";"+y+";"+z+")");
        return false;
    }

    if(t instanceof ChunkLoaderPeripheralTileEntity)
    {
        ChunkyPeripherals.infoLog("    loading chunk loader peripheral at "+x+","+y+","+z);
        ((ChunkLoaderPeripheralTileEntity)t).callback(ticket);
        return true;
    }
    else
    {
        return false;
    }
}
项目:ChunkyPeripherals    文件:TicketManager.java   
public static Ticket getNewTicket(World w)
{
    if(w==null)
        throw new IllegalArgumentException();
    Ticket t= ForgeChunkManager.requestTicket(ChunkyPeripherals.instance, w, ForgeChunkManager.Type.NORMAL);
    myChunkList.add(t);
    return t;
}
项目:ChunkyPeripherals    文件:TicketManager.java   
public static boolean checkBlockIsKeptLoaded(int x, int z)
{
    int cx = x>=0? x/16 : x/16 -1;
    int cz = z>=0? z/16 : z/16 -1;
    for(Ticket t : myChunkList)
    {
        for(ChunkCoordIntPair chunk: t.getChunkList())
        {
            if(cx==chunk.chunkXPos && cz==chunk.chunkZPos)
                return true;
        }
    }
    return false;
}
项目:vsminecraft    文件:TileEntityTeleporter.java   
@Override
public void forceChunks(Ticket ticket)
{
    releaseChunks();
    chunkTicket = ticket;

    ForgeChunkManager.forceChunk(chunkTicket, new Chunk3D(Coord4D.get(this)).toPair());
}
项目:Hard-Science    文件:Simulator.java   
@Override
public void ticketsLoaded(List<Ticket> tickets, World world)
{
    // For volcanos we re-force chunks when simulation loaded
    // or when activation changes. Should get no tickets.
    ;
}
项目:Hard-Science    文件:Simulator.java   
@Override
public List<Ticket> ticketsLoaded(List<Ticket> tickets, World world, int maxTicketCount)
{
    // For volcanos we re-force chunks when simulation loaded
    // or when activation changes. Dispose of all tickets.
    List<ForgeChunkManager.Ticket> validTickets = Lists.newArrayList();
    return validTickets;
}