本文整理汇总了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);
// }
}
示例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();
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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));
}
}
}
示例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);
}
}
}
}
示例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);
}
示例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));
}
示例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;
}
示例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));
}
}
示例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());
}
}
}
示例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);
}
}