当前位置: 首页>>代码示例>>Java>>正文


Java ForgeChunkManager.unforceChunk方法代码示例

本文整理汇总了Java中net.minecraftforge.common.ForgeChunkManager.unforceChunk方法的典型用法代码示例。如果您正苦于以下问题:Java ForgeChunkManager.unforceChunk方法的具体用法?Java ForgeChunkManager.unforceChunk怎么用?Java ForgeChunkManager.unforceChunk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.common.ForgeChunkManager的用法示例。


在下文中一共展示了ForgeChunkManager.unforceChunk方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: unforceChunkLoading

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
public void unforceChunkLoading()
{
    int size = ConfigurationHandler.chunkLoaderSize;
    if(size % 2 != 0 && size > 1)
    {
        size--;
    }
    int dist = size / 2;

    ChunkPos centerPos = new ChunkPos(pos.getX() / 16, pos.getZ() / 16);
    for(int x = centerPos.chunkXPos - dist; x <= centerPos.chunkXPos + dist; x++) {
        for (int z = centerPos.chunkZPos - dist; z <= centerPos.chunkZPos + dist; z++) {
            ChunkPos chunkPos = new ChunkPos(x, z);
            ForgeChunkManager.unforceChunk(ticket, chunkPos);
            FMLLog.log(Level.INFO, "Unchunkloading at chunk pos: " + chunkPos);
        }
    }
}
 
开发者ID:CorwinJV,项目名称:AChunkLoader,代码行数:19,代码来源:ChunkLoaderTileEntity.java

示例2: onEnterChunk

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
@SubscribeEvent
public void onEnterChunk(EntityEvent.EnteringChunk event)
{
    if(FMLCommonHandler.instance().getEffectiveSide().isServer() && (event.entity instanceof EntityMeteorite || event.entity instanceof EntityPigzilla) && !event.entity.isDead)
    {
        ForgeChunkManager.Ticket ticket = ChunkLoadHandler.tickets.get(event.entity);
        if(ticket == null)
        {
            ticket = ForgeChunkManager.requestTicket(ItFellFromTheSky.instance, event.entity.worldObj, ForgeChunkManager.Type.ENTITY);
            if(ticket != null)
            {
                ticket.bindEntity(event.entity);
                ChunkLoadHandler.addTicket(event.entity, ticket);
            }
        }
        if(ticket != null)
        {
            if(event.oldChunkX != 0 && event.oldChunkZ != 0)
            {
                ForgeChunkManager.unforceChunk(ticket, new ChunkCoordIntPair(event.oldChunkX, event.oldChunkZ));
            }
            ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(event.newChunkX, event.newChunkZ));
        }
    }
}
 
开发者ID:iChun,项目名称:ItFellFromTheSky,代码行数:26,代码来源:EventHandler.java

示例3: chunkUnload

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
public void chunkUnload(TownBlock block) {
    ForgeChunkManager.Ticket ticket = get(block.getDim());
    ForgeChunkManager.unforceChunk(ticket, block.toChunkCoords());

    NBTTagList list = ticket.getModData().getTagList("chunkCoords", Constants.NBT.TAG_COMPOUND);
    for (int i = 0; i < list.tagCount(); i++) {
        NBTTagCompound chunkNBT = list.getCompoundTagAt(i);
        int x = chunkNBT.getInteger("x");
        int z = chunkNBT.getInteger("z");

        if (x == block.getX() && z == block.getZ()) {
            list.removeTag(i);
            break;
        }
    }
}
 
开发者ID:MyEssentials,项目名称:MyTown2,代码行数:17,代码来源:TicketMap.java

示例4: unregisterTower

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
private void unregisterTower() {
    if (!worldObj.isRemote) {
        if (network != null) {
            network.removeRelay(this);
        }
        // if there was a chunk loading ticket and the server isn't just stopping
        if (ConfigData.antennaKeepsChunkLoaded && chunkTicket != null && !MoarPeripherals.isServerStopping) {
            LogUtil.info(String.format("Releasing Ticket for the BitNet Communications Tower at %d %d %d",
                    xCoord, yCoord, zCoord));
            ForgeChunkManager.unforceChunk(chunkTicket, getChunkCoord());
            TicketManager.releaseTicket(chunkTicket);
            chunkTicket = null;
        }
    }
    registered = false;
}
 
开发者ID:theoriginalbit,项目名称:MoarPeripherals,代码行数:17,代码来源:TileAntennaController.java

示例5: returnToOldBlock

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
public void returnToOldBlock()
{
    if (dimension != Integer.MAX_VALUE)
    {
        World linkedWorld = MinecraftServer.getServer().worldServerForDimension(dimension);
        if (linkedWorld != null && linkedWorld != worldObj)
        {
            Chunk chunk = linkedWorld.getChunkFromBlockCoords(linkedPos.getX(), linkedPos.getZ());
            ForgeChunkManager.unforceChunk(ForgeChunkManager.requestTicket(RefinedRelocation.instance, linkedWorld, ForgeChunkManager.Type.NORMAL), new ChunkCoordIntPair(chunk.xPosition, chunk.zPosition));
            LogHelper.info("Stopped force-load for: " + linkedWorld.provider.getDimensionName());
        }
    }
    if (oldBlock == ModBlocks.relocationPortal || oldBlock == null)
    {
        oldBlock = Blocks.air;
        oldMeta = 0;
    }
    worldObj.setBlock(xCoord, yCoord, zCoord, oldBlock, oldMeta, 3);
}
 
开发者ID:Dynious,项目名称:RefinedRelocation,代码行数:20,代码来源:TileRelocationPortal.java

示例6: clearTicketChunks

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
public void clearTicketChunks()
{
	if (chunkTicket == null)
	{
		return;
	}

	for (ChunkPos chunk : chunkTicket.getChunkList())
	{
		SimpleChunks.logger.info("Unforcing chunkload at " + chunk);
		ForgeChunkManager.unforceChunk(chunkTicket, chunk);
	}
}
 
开发者ID:DarkMorford,项目名称:Simple-Chunks,代码行数:14,代码来源:TileEntityChunkLoader.java

示例7: releaseChunkLoad

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
public static void releaseChunkLoad(World w, ChunkPos pos) {
	if (!ticketList.containsKey(pos) || chunkLoaderTicket == null) {
		return;
	} else {
		int num = ticketList.get(pos) - 1;
		if (num > 0)
			ticketList.put(pos, num);
		else
			ForgeChunkManager.unforceChunk(chunkLoaderTicket, pos);
	}
}
 
开发者ID:Zundrel,项目名称:Never-Enough-Currency,代码行数:12,代码来源:Currency.java

示例8: updatePosition

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
/**
 * Updates the ChunkManager by pasing in the entity's current position
 */
public void updatePosition() {
  if (chunkLoaderTicket != null) {
    BlockPos pos = entity.getPosition();
    if (!isInside(chunkPos, pos)) {
      ForgeChunkManager.unforceChunk(chunkLoaderTicket, chunkPos);
      chunkPos = new ChunkPos(pos);
      loadChunkProximity(chunkPos);
      ForgeChunkManager.forceChunk(chunkLoaderTicket, chunkPos);
    }
  }
}
 
开发者ID:wizards-of-lua,项目名称:wizards-of-lua,代码行数:15,代码来源:ChunkLoaderTicketSupport.java

示例9: unforceChunkLoading

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
public void unforceChunkLoading() 
{
	for (Object obj : this.chunkTicket.getChunkList()) 
	{
		ChunkCoordIntPair coord = (ChunkCoordIntPair) obj;
		ForgeChunkManager.unforceChunk(this.chunkTicket, coord);
	}
}
 
开发者ID:gigabit101,项目名称:SimpleChunkLoader,代码行数:9,代码来源:TileChunkLoader.java

示例10: remChunk

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:TheCBProject,项目名称:ChickenChunks,代码行数:14,代码来源:ChunkLoaderManager.java

示例11: unLoadChunks

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
private void unLoadChunks()
{
	if(ticket!=null)
	{
		List<ChunkCoordIntPair> chunkList = listChunksToLoad(0,x,z,dir);
		
		Iterator<ChunkCoordIntPair> iter = chunkList.iterator();
		while(iter.hasNext())
			ForgeChunkManager.unforceChunk(ticket,iter.next());
	}
}
 
开发者ID:c-rizz,项目名称:ChunkyPeripherals,代码行数:12,代码来源:ChunkyPeripheral.java

示例12: unloadChunks

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
private void unloadChunks(List<ChunkCoordIntPair> chunks)
{
	if(ticket!=null)
	{
		for(ChunkCoordIntPair chunk : chunks)
		{
			ChunkyPeripherals.infoLog("unforcing chunk "+chunk);
			ForgeChunkManager.unforceChunk(ticket, chunk);
		}
	}
}
 
开发者ID:c-rizz,项目名称:ChunkyPeripherals,代码行数:12,代码来源:ChunkLoaderPeripheralTileEntity.java

示例13: tickChunkTimeouts

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
public void tickChunkTimeouts()
{
    DimChunkCoordTimeout dcct;
    Iterator<Map.Entry<String, DimChunkCoordTimeout>> iterator = this.timeOuts.entrySet().iterator();

    //int j = 0; // FIXME debug
    while (iterator.hasNext())
    {
        dcct = iterator.next().getValue();
        //System.out.printf("tickChunkTimeouts(): loop %d, timeout: %d\n", j++, dcct.timeout);

        if (dcct != null && (this.playerTickets.containsValue(dcct.ticket) || this.modTickets.containsValue(dcct.ticket)))
        {
            if (dcct.tick() == 0)
            {
                //System.out.printf("tickChunkTimeouts(): unforcing, dim: %d, %s\n", dcct.dimension, dcct.chunkCoords.toString());
                ForgeChunkManager.unforceChunk(dcct.ticket, dcct.chunkCoords);

                if (dcct.ticket != null && dcct.ticket.getChunkList().size() == 0)
                {
                    this.removeTicket(dcct.ticket);
                    ForgeChunkManager.releaseTicket(dcct.ticket);
                }

                iterator.remove();
            }
        }
        // If this chunk doesn't have a valid ticket anymore, just remove the entry
        else
        {
            //System.out.println("tickChunkTimeouts(): invalid ticket, removing timeout entry");
            iterator.remove();
        }
    }
}
 
开发者ID:maruohon,项目名称:enderutilities,代码行数:36,代码来源:ChunkLoading.java

示例14: unloadChunk

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
private void unloadChunk() {
    if (this.xCoord >> 4 != this.chunk_x || this.zCoord >> 4 != this.chunk_z) {
        ForgeChunkManager.unforceChunk(this.chunkTicket, new ChunkCoordIntPair(this.chunk_x, this.chunk_z));
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:6,代码来源:TileEntityEnderQuarry.java

示例15: updateEntity

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
@Override
public void updateEntity()
{
    super.updateEntity();

    if (!this.worldObj.isRemote)
    {
        if (this.frequencyCheckNeeded)
        {
            this.checkDestFrequencyValid();
            this.frequencyCheckNeeded = false;
        }

        if (this.requiresClientUpdate)
        {
            // PacketDispatcher.sendPacketToAllPlayers(this.getPacket());
            // TODO
            this.requiresClientUpdate = false;
        }

        if (this.ticks % 40 == 0)
        {
            this.setFrequency(this.frequency);
            this.setDestinationFrequency(this.destFrequency);
        }

        if (this.ticks % 20 == 0)
        {
            if (this.chunkLoadTicket != null)
            {
                for (int i = 0; i < this.connectedPads.size(); i++)
                {
                    ChunkCoordinates coords = this.connectedPads.get(i);
                    Block block = this.worldObj.getBlock(coords.posX, coords.posY, coords.posZ);

                    if (block != GCBlocks.landingPadFull)
                    {
                        this.connectedPads.remove(i);
                        ForgeChunkManager.unforceChunk(this.chunkLoadTicket, new ChunkCoordIntPair(coords.posX >> 4, coords.posZ >> 4));
                    }
                }
            }
        }
    }
    else
    {
        if (this.frequency == -1 && this.destFrequency == -1)
        {
            GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_ADVANCED_GUI, new Object[] { 5, this.xCoord, this.yCoord, this.zCoord, 0 }));
        }
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:53,代码来源:TileEntityLaunchController.java


注:本文中的net.minecraftforge.common.ForgeChunkManager.unforceChunk方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。