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