friendlyhj/ZenUtils

[Feature Request] fix CT error `"this.access" is null` when calling `IWorld.getFromID().getBlockState()`

Closed this issue · 0 comments

Getting world for the unloaded dimension and trying to access blocks from it causing CT fatal error:

// Calling from being in Overworld
print(IWorld.getFromID(1).getBlockState(IBlockPos.create(0, 0, 0)).commandString);

Error:

[SERVER_STARTED][SERVER][FATAL] Cannot invoke "net.minecraft.world.IBlockAccess.func_180495_p(net.minecraft.util.math.BlockPos)" because "this.access" is null
java.lang.NullPointerException: Cannot invoke "net.minecraft.world.IBlockAccess.func_180495_p(net.minecraft.util.math.BlockPos)" because "this.access" is null
	at crafttweaker.mc1120.world.MCBlockAccess.getBlockState(MCBlockAccess.java:20)
	at CrafttweakerReloadabledebug\Devtools34.handle(debug\devtools.zs:142)
	at CrafttweakerReloadabledebug\Devtools34.handle(debug\devtools.zs)

Firstly, calling native CT functions should not causing errors. I still could make this issue on official CT issue tracker if you say (despite I know that will get answer "1.12.2 is not supported").

Secondly, calling getBlockState on existing world load the chunk, even if it wasnt loaded (this why i requested isBlockLoaded function before). So I expect that getBlockState and other IBlockAccess calls should load world to provide necessary block.


The problem I encountered is that in E2E-E I want to add feature of creating a portal, similar way as Nether portal created. But in my implementation it will have TileEntity in other dimension that would connect two points (im using BloodMagic portal doors). Comes out that there is no way to create a structure in other dimension using CT script.