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


Java ForgeChunkManager.forceChunk方法代码示例

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


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

示例1: forceChunk

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

示例2: addChunk

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

示例3: register

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
public ForgeChunkManager.Ticket register(Set<Chunk> chunkSet) {
    ForgeChunkManager.Ticket ticket = ForgeChunkManager.requestTicket(Hammer.instance, DeltaChunk.getServerShadowWorld(), ForgeChunkManager.Type.NORMAL);
    if (ticket == null) {
        Hammer.logSevere("Failed to acquire chunk ticket. You may need to adjust config/forgeChunkLoading.cfg");
        return null;
    }
    final int maxSize = ticket.getMaxChunkListDepth();
    final int size = chunkSet.size();
    if (size > maxSize) {
        Hammer.logSevere("Registering %s chunks for loading, but ticket only has room for %s. You may need to adjust config/forgeChunkLoading.cfg", size, maxSize);
    }
    for (Chunk chunk : chunkSet) {
        ForgeChunkManager.forceChunk(ticket, chunk.getChunkCoordIntPair());
    }
    return ticket;
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:17,代码来源:PPPChunkLoader.java

示例4: forceChunk

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

示例5: loadChunks

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
private void loadChunks(List<ChunkCoordIntPair> chunks)
{
//	ChunkyPeripherals.infoLog("loadChunks, radius="+radiusInChunks+"  mode="+mode);
	if(ticket==null)
	{
	/*	Ticket t = ChunkLoadingCallback.starterTicketsList.remove(this);//prova a cercarlo nella lista
		if(t==null)//se non era nella lista
		{*/
			ChunkyPeripherals.infoLog("creating new ticket at " + xCoord + ", "+ yCoord + ", "+ zCoord+", "+getWorldObj());
			ticket = TicketManager.getNewTicket(getWorldObj());
			if(ticket.isPlayerTicket())
				ChunkyPeripherals.infoLog("the ticket is a player ticket: player="+ticket.getPlayerName());
			ticket.getModData().setInteger("posX", xCoord);
			ticket.getModData().setInteger("posY", yCoord);
			ticket.getModData().setInteger("posZ", zCoord);
	//	}
	}
	for(ChunkCoordIntPair chunk : chunks)
	{
		ChunkyPeripherals.infoLog("forcing chunk "+chunk);
		ForgeChunkManager.forceChunk(ticket, chunk);
	}
}
 
开发者ID:c-rizz,项目名称:ChunkyPeripherals,代码行数:24,代码来源:ChunkLoaderPeripheralTileEntity.java

示例6: updatePos

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
private void updatePos(int x, int y, int z) {
	if (ticket != null) {
		NBTTagCompound modData = ticket.getModData();
		modData.setInteger("turtleX", x);
		modData.setInteger("turtleY", y);
		modData.setInteger("turtleZ", z);
		
		int chunkX = x >> 4;
		int chunkZ = z >> 4;
		
		if (oldChunkX != chunkX || oldChunkZ != chunkZ) {
			int radius = MiscPeripherals.instance.chunkLoaderRadius;
			for (int cx = chunkX - radius; cx <= chunkX + radius; cx++) {
				for (int cz = chunkZ - radius; cz <= chunkZ + radius; cz++) {
					ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(cx, cz));
				}
			}
			
			oldChunkX = chunkX;
			oldChunkZ = chunkZ;
		}
	}
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:24,代码来源:PeripheralChunkLoader.java

示例7: ticketsLoaded

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

示例8: 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

示例9: ticketsLoaded

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

示例10: loadChunkForcedWithTicket

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

示例11: revalidateTicket

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

示例12: ticketLoad

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
private static boolean ticketLoad(ForgeChunkManager.Ticket ticket, World world) {
    final NBTTagCompound tag = ticket.getModData();
    int x = tag.getInteger("targetX");
    int y = tag.getInteger("targetY");
    int z = tag.getInteger("targetZ");

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

    if (tile == null) {
        LogUtil.debug(String.format("No TileEntity at %d %d %d", x, y, z));
        return false;
    }

    if (!(tile instanceof IChunkLoader)) {
        LogUtil.warn(String.format("Served ticket for TileEntity at %d %d %d that is not one of mine", x, y, z));
        return false;
    }

    ForgeChunkManager.forceChunk(ticket, ((IChunkLoader) tile).getChunkCoord());

    TICKET_LIST.put((IChunkLoader) tile, ticket);

    return true;
}
 
开发者ID:theoriginalbit,项目名称:MoarPeripherals,代码行数:25,代码来源:ChunkLoadingCallback.java

示例13: loadChunks

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
public void loadChunks()
{
	if(!worldObj.isRemote)
	{
		 while(chunkTicket == null)
		 {
			 chunkTicket = ForgeChunkManager.requestTicket(AdvancedUtilities.instance, worldObj, Type.NORMAL);
		 }
		 if(chunkTicket==null)
		 {
			 System.out.println("FuckingHell");
		 }
		 chunkTicket.getModData().setInteger("type", AdvancedUtilitiesChunkLoadCallback.ChunkLoaderBlockID);
		 chunkTicket.getModData().setInteger("blockX", xCoord);
		 chunkTicket.getModData().setInteger("blockY", yCoord);
		 chunkTicket.getModData().setInteger("blockZ", zCoord);
		
		 ForgeChunkManager.forceChunk(chunkTicket, new ChunkCoordIntPair(xCoord>>4, zCoord >>4));
	}
}
 
开发者ID:Sudwood,项目名称:AdvancedUtilities,代码行数:21,代码来源:TileEntityChunkLoader.java

示例14: init

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
public void init(Block oldBlock, int oldMeta, Vector3 linkedPos, int dimension)
{
    this.oldBlock = oldBlock;
    this.oldMeta = oldMeta;
    this.linkedPos = linkedPos;
    this.dimension = dimension;
    if (FMLCommonHandler.instance().getEffectiveSide().isServer())
    {
        World linkedWorld = MinecraftServer.getServer().worldServerForDimension(dimension);
        if (linkedWorld != null && linkedWorld != worldObj)
        {
            Chunk chunk = linkedWorld.getChunkFromBlockCoords(linkedPos.getX(), linkedPos.getZ());
            ForgeChunkManager.forceChunk(ForgeChunkManager.requestTicket(RefinedRelocation.instance, linkedWorld, ForgeChunkManager.Type.NORMAL), new ChunkCoordIntPair(chunk.xPosition, chunk.zPosition));
            LogHelper.info("Force-loaded: " + linkedWorld.provider.getDimensionName());
        }
    }
}
 
开发者ID:Dynious,项目名称:RefinedRelocation,代码行数:18,代码来源:TileRelocationPortal.java

示例15: forceChunks

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

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


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