Skip to content

Commit

Permalink
forge loading chunks with chunkloaders
Browse files Browse the repository at this point in the history
  • Loading branch information
Pilzinsel64 committed Apr 12, 2023
1 parent 5dda341 commit f0b5409
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/main/java/codechicken/chunkloader/BlockChunkLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ public IIcon getIcon(int side, int meta) {
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7,
float par8, float par9) {
if (!world.blockExists(x, y, z)) {
world.getChunkProvider().loadChunk(x >> 4, z >> 4);
}

int meta = world.getBlockMetadata(x, y, z);
if (meta != 0 || player.isSneaking()) return false;

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/codechicken/chunkloader/ChunkLoaderManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@ public void revive(World world) {

for (BlockCoord coord : verifyCoords) {
reviving = true;
if (!world.blockExists(coord.x, coord.y, coord.z)) {
world.getChunkProvider().loadChunk(coord.x >> 4, coord.z >> 4);
}
TileEntity tile = world.getTileEntity(coord.x, coord.y, coord.z);
reviving = false;
if (tile instanceof IChickenChunkLoader) {
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/codechicken/chunkloader/TileChunkLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
public class TileChunkLoader extends TileChunkLoaderBase {

public static void handleDescriptionPacket(PacketCustom packet, World world) {
TileEntity tile = world.getTileEntity(packet.readInt(), packet.readInt(), packet.readInt());
int x = packet.readInt();
int y = packet.readInt();
int z = packet.readInt();
if (!world.blockExists(x, y, z)) {
world.getChunkProvider().loadChunk(x >> 4, z >> 4);
}
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileChunkLoader) {
TileChunkLoader ctile = (TileChunkLoader) tile;
ctile.setShapeAndRadius(ChunkLoaderShape.values()[packet.readUByte()], packet.readUByte());
Expand Down

0 comments on commit f0b5409

Please sign in to comment.