Jump to content

Recommended Posts

Posted

Hey guys!

 

I want to create a chunk loader which keeps all the chunks in an adjustable radius round the block loaded. How can I do this?

I tried the following, but this didn't work:

In a tileEntity I overrode onChunkUnloading and added the method worldObj.getChunkProvider().loadChunk(...);

 

This only caused that the server fails to shut down. The commandBlock i placed there didn't write anything in the chat as it should.

 

So, how can I create a working chunk loader block?

Posted

Basically it works fine, thanks for that!

 

But I got two problems:

First, I don't understand how to use the LoadingCallback.

Second, if I reload a world and remove the chunkloader, I get this error:

 

[11:40:12] [server thread/ERROR]: Encountered an unexpected exception
net.minecraft.util.ReportedException: Ticking memory connection
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:206) ~[NetworkSystem.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:762) ~[MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:650) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120) ~[integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:528) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:787) [MinecraftServer$2.class:?]
Caused by: java.lang.NullPointerException
at com.google.common.collect.LinkedHashMultimap.create(LinkedHashMultimap.java:119) ~[guava-15.0.jar:?]
at net.minecraftforge.common.ForgeChunkManager.unforceChunk(ForgeChunkManager.java:767) ~[ForgeChunkManager.class:?]
at com.bedrockminer.statuemod.blocks.BlockStatueBase.breakBlock(BlockStatueBase.java:70) ~[blockStatueBase.class:?]
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:690) ~[Chunk.class:?]
at net.minecraft.world.World.setBlock(World.java:549) ~[World.class:?]
at net.minecraft.world.World.setBlockToAir(World.java:667) ~[World.class:?]
at net.minecraft.block.Block.removedByPlayer(Block.java:1686) ~[block.class:?]
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:272) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:306) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:174) ~[itemInWorldManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:528) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:61) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:94) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:242) ~[NetworkManager.class:?]
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:190) ~[NetworkSystem.class:?]
... 5 more
[11:40:12] [server thread/ERROR]: This crash report has been saved to: C:\Users\Julian\Desktop\Modding\StatueMod\StatueMod\.\crash-reports\crash-2014-04-08_11.40.12-server.txt
[11:40:12] [server thread/INFO]: Stopping server
[11:40:12] [server thread/INFO]: Saving players
[11:40:12] [server thread/INFO]: Saving worlds
[11:40:12] [server thread/INFO]: Saving chunks for level 'New World'/Overworld
---- Minecraft Crash Report ----
// I let you down. Sorry 

Time: 08.04.14 11:40
Description: Ticking memory connection

java.lang.NullPointerException: Ticking memory connection
at com.google.common.collect.LinkedHashMultimap.create(LinkedHashMultimap.java:119)
at net.minecraftforge.common.ForgeChunkManager.unforceChunk(ForgeChunkManager.java:767)
at com.bedrockminer.statuemod.blocks.BlockStatueBase.breakBlock(BlockStatueBase.java:70)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:690)
at net.minecraft.world.World.setBlock(World.java:549)
at net.minecraft.world.World.setBlockToAir(World.java:667)
at net.minecraft.block.Block.removedByPlayer(Block.java:1686)
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:272)
at net.minecraft.server.management.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:306)
at net.minecraft.server.management.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:174)
at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:528)
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:61)
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:94)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:242)
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:190)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:762)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:650)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:528)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:787)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at com.google.common.collect.LinkedHashMultimap.create(LinkedHashMultimap.java:119)
at net.minecraftforge.common.ForgeChunkManager.unforceChunk(ForgeChunkManager.java:767)
at com.bedrockminer.statuemod.blocks.BlockStatueBase.breakBlock(BlockStatueBase.java:70)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:690)
at net.minecraft.world.World.setBlock(World.java:549)
at net.minecraft.world.World.setBlockToAir(World.java:667)
at net.minecraft.block.Block.removedByPlayer(Block.java:1686)
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:272)
at net.minecraft.server.management.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:306)
at net.minecraft.server.management.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:174)
at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:528)
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:61)
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:94)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:242)

-- Ticking connection --
Details:
Connection: net.minecraft.network.NetworkManager@cd56091
Stacktrace:
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:190)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:762)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:650)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:528)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:787)

-- System Details --
Details:
Minecraft Version: 1.7.2
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_60-ea, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 141752336 bytes (135 MB) / 482344960 bytes (460 MB) up to 943194112 bytes (899 MB)
JVM Flags: 0 total; 
AABB Pool Size: 6751 (378056 bytes; 0 MB) allocated, 6134 (343504 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94
FML: MCP v9.01-pre FML v7.2.116.1024 Minecraft Forge 10.12.0.1024 4 mods loaded, 4 mods active
mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
FML{7.2.116.1024} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1024.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
Forge{10.12.0.1024} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1024.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
modid{1.0.0} [ModName] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 2840 (159040 bytes; 0 MB) allocated, 2570 (143920 bytes; 0 MB) used
Player Count: 1 / 8; [EntityPlayerMP['_Bedrock_Miner_'/4160, l='New World', x=1000,99, y=79,00, z=-2,99]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'
#@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2014-04-08_11.40.12-server.txt
[11:40:12] [Client Shutdown Thread/INFO]: Stopping server
Exception in thread "Client Shutdown Thread" java.util.ConcurrentModificationException
at java.util.Hashtable$Enumerator.next(Unknown Source)
at net.minecraftforge.common.DimensionManager.setWorld(DimensionManager.java:213)
at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:461)
at net.minecraft.server.integrated.IntegratedServer.stopServer(IntegratedServer.java:257)
at net.minecraft.client.Minecraft.stopIntegratedServer(Minecraft.java:2706)
at net.minecraft.client.main.Main$2.run(Main.java:102)
AL lib: (EE) alc_cleanup: 1 device not closed

 

 

The code of my chunkloader is this:

 

package com.bedrockminer.statuemod.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.ForgeChunkManager.Type;

import com.bedrockminer.statuemod.Main;
import com.bedrockminer.statuemod.tileentities.TileEntityStatueBase;

import cpw.mods.fml.common.registry.GameRegistry;

public class BlockStatueBase extends Block {

private IIcon topIcon;
private IIcon botIcon;
private Ticket ticket;

protected BlockStatueBase(String unlocalizedName) {
	super(Material.iron);
	this.setBlockName(unlocalizedName);
	this.setBlockTextureName(Main.tex(unlocalizedName));
	this.setHardness(5.0F);
	this.setResistance(2000.0F);
	this.setHarvestLevel("pickaxe", 2);
	this.setStepSound(soundTypeMetal);
	this.setCreativeTab(Main.MAINTAB);
	this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F);
        this.setLightOpacity(0);

	GameRegistry.registerBlock(this, unlocalizedName);
}

@Override
public IIcon getIcon(int side, int meta) {
	switch (side) {
	case 0: return topIcon;
	case 1: return botIcon;
	default: return blockIcon;
	}
}

@Override
public void registerBlockIcons(IIconRegister reg) {
	this.blockIcon = reg.registerIcon(textureName + "_side");
	this.topIcon = reg.registerIcon(textureName + "_top");
	this.botIcon = reg.registerIcon(textureName + "_bottom");
}

@Override
public void onBlockAdded(World world, int x, int y, int z) {
	super.onBlockAdded(world, x, y, z);
	this.ticket = ForgeChunkManager.requestTicket(Main.instance, world, Type.NORMAL);
	if (this.ticket != null) {
		ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(x / 16, z / 16));
	}
}

@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
	super.breakBlock(world, x, y, z, block, meta);
	if (this.ticket != null) {
		ForgeChunkManager.unforceChunk(ticket, new ChunkCoordIntPair(x / 16, z / 16));
	}
}
}

 

Posted

Changed, but still get an error

(I think its the same, but I post it anyway)

[12:08:52] [server thread/ERROR]: Encountered an unexpected exception
net.minecraft.util.ReportedException: Ticking memory connection
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:206) ~[NetworkSystem.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:762) ~[MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:650) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120) ~[integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:528) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:787) [MinecraftServer$2.class:?]
Caused by: java.lang.NullPointerException
at com.google.common.collect.LinkedHashMultimap.create(LinkedHashMultimap.java:119) ~[guava-15.0.jar:?]
at net.minecraftforge.common.ForgeChunkManager.unforceChunk(ForgeChunkManager.java:767) ~[ForgeChunkManager.class:?]
at com.bedrockminer.statuemod.blocks.BlockStatueBase.breakBlock(BlockStatueBase.java:70) ~[blockStatueBase.class:?]
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:690) ~[Chunk.class:?]
at net.minecraft.world.World.setBlock(World.java:549) ~[World.class:?]
at net.minecraft.world.World.setBlockToAir(World.java:667) ~[World.class:?]
at net.minecraft.block.Block.removedByPlayer(Block.java:1686) ~[block.class:?]
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:272) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:306) ~[itemInWorldManager.class:?]
at net.minecraft.server.management.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:174) ~[itemInWorldManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:528) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:61) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:94) ~[C07PacketPlayerDigging.class:?]
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:242) ~[NetworkManager.class:?]
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:190) ~[NetworkSystem.class:?]
... 5 more
[12:08:52] [server thread/ERROR]: This crash report has been saved to: C:\Users\Julian\Desktop\Modding\StatueMod\StatueMod\.\crash-reports\crash-2014-04-08_12.08.52-server.txt
[12:08:52] [server thread/INFO]: Stopping server
[12:08:52] [server thread/INFO]: Saving players
[12:08:52] [server thread/INFO]: Saving worlds
[12:08:52] [server thread/INFO]: Saving chunks for level 'New World'/Overworld
---- Minecraft Crash Report ----
// I let you down. Sorry 

Time: 08.04.14 12:08
Description: Ticking memory connection

java.lang.NullPointerException: Ticking memory connection
at com.google.common.collect.LinkedHashMultimap.create(LinkedHashMultimap.java:119)
at net.minecraftforge.common.ForgeChunkManager.unforceChunk(ForgeChunkManager.java:767)
at com.bedrockminer.statuemod.blocks.BlockStatueBase.breakBlock(BlockStatueBase.java:70)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:690)
at net.minecraft.world.World.setBlock(World.java:549)
at net.minecraft.world.World.setBlockToAir(World.java:667)
at net.minecraft.block.Block.removedByPlayer(Block.java:1686)
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:272)
at net.minecraft.server.management.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:306)
at net.minecraft.server.management.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:174)
at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:528)
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:61)
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:94)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:242)
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:190)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:762)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:650)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:528)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:787)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at com.google.common.collect.LinkedHashMultimap.create(LinkedHashMultimap.java:119)
at net.minecraftforge.common.ForgeChunkManager.unforceChunk(ForgeChunkManager.java:767)
at com.bedrockminer.statuemod.blocks.BlockStatueBase.breakBlock(BlockStatueBase.java:70)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:690)
at net.minecraft.world.World.setBlock(World.java:549)
at net.minecraft.world.World.setBlockToAir(World.java:667)
at net.minecraft.block.Block.removedByPlayer(Block.java:1686)
at net.minecraft.server.management.ItemInWorldManager.removeBlock(ItemInWorldManager.java:272)
at net.minecraft.server.management.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:306)
at net.minecraft.server.management.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:174)
at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:528)
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:61)
at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:94)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:242)

-- Ticking connection --
Details:
Connection: net.minecraft.network.NetworkManager@4efc646f
Stacktrace:
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:190)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:762)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:650)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:528)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:787)

-- System Details --
Details:
Minecraft Version: 1.7.2
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_60-ea, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 242244712 bytes (231 MB) / 463470592 bytes (442 MB) up to 943194112 bytes (899 MB)
JVM Flags: 0 total; 
AABB Pool Size: 5127 (287112 bytes; 0 MB) allocated, 4514 (252784 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94
FML: MCP v9.01-pre FML v7.2.116.1024 Minecraft Forge 10.12.0.1024 4 mods loaded, 4 mods active
mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
FML{7.2.116.1024} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1024.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
Forge{10.12.0.1024} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1024.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
modid{1.0.0} [ModName] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 1724 (96544 bytes; 0 MB) allocated, 1678 (93968 bytes; 0 MB) used
Player Count: 1 / 8; [EntityPlayerMP['_Bedrock_Miner_'/3844, l='New World', x=1000,50, y=84,00, z=0,50]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'
#@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2014-04-08_12.08.52-server.txt
AL lib: (EE) alc_cleanup: 1 device not closed

 

Posted

OK. I did this now, but actually it doesn't work any more.

 

I did it like this:

 

public class WorldEventHandler {

@SubscribeEvent
public void worldUnloadEvent(WorldEvent.Unload e) {
	BlockStatueBase.ticket = null;
}

@SubscribeEvent
public void worldLoadEvent(WorldEvent.Load e) {
	BlockStatueBase.ticket = ForgeChunkManager.requestTicket(Main.instance, e.world, Type.NORMAL);
}
}

 

In the block class:

@Override
public void onBlockAdded(World world, int x, int y, int z) {
	if (!world.isRemote && this.ticket != null) {
		ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(x / 16, z / 16));
	}
}

@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
	if (!world.isRemote && this.ticket != null) {
		ForgeChunkManager.unforceChunk(ticket, new ChunkCoordIntPair(x / 16, z / 16));
	}
}

 

The ticket is not null, i tested it with debugging outputs

 

 

Posted

Well, I now copied some if the code, but it is from 1.6 and I get some problems.

 

For example, this line of code is used very often:

world.theChunkProviderServer.loadedChunks

The problem is, that this is declared private in the class ChunkProviderServer.

 

How can I get acces to this field? Or do you know another way to get the actual loaded chunks?

  • 4 weeks later...
Posted

When I created a chunkloader for 1.6.4, I created a class and had it implement 'net.minecraftforge.common.ForgeChunkManager.LoadingCallback'.

 

WorldEvents:

public class WorldEvents implements LoadingCallback {

@Override
public void ticketsLoaded(List<Ticket> tickets, World world) {
		//TODO: somthing when the tickets are loaded

}
}

 

Immobile Entity (Loading a block should be the same.  Note: this only loads on chunk):

...
if(!worldObj.isRemote) {
Ticket ticket = ForgeChunkManager.requestTicket(AdvancedRocketry.instance, this.worldObj, Type.NORMAL);
        if(ticket != null)
      ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair((int)this.posX / 16, (int)this.posZ / 16));
}
...

 

 

Hope this helps...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.