Stop Object3D.getTileEntity() from loading unloaded chunks.

This commit is contained in:
Ben Spiers 2013-08-19 02:57:57 +01:00
parent 896daa10e8
commit 18868398b4

View file

@ -4,6 +4,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
public class Object3D public class Object3D
@ -44,6 +45,8 @@ public class Object3D
public TileEntity getTileEntity(IBlockAccess world) public TileEntity getTileEntity(IBlockAccess world)
{ {
if(!(world instanceof World && ((World)world).blockExists(xCoord, yCoord, yCoord)))
return null;
return world.getBlockTileEntity(xCoord, yCoord, zCoord); return world.getBlockTileEntity(xCoord, yCoord, zCoord);
} }