Fixed #408 crash at boot with FTB Quests
This commit is contained in:
parent
9f73f5b7de
commit
4a0e60a3ca
3 changed files with 9 additions and 4 deletions
|
@ -640,7 +640,7 @@ public class Dictionary {
|
|||
/**/
|
||||
|
||||
// scan blocks registry
|
||||
final FakeWorld fakeWorld = new FakeWorld(null);
|
||||
final FakeWorld fakeWorld = new FakeWorld(null, false);
|
||||
for (final ResourceLocation resourceLocation : Block.REGISTRY.getKeys()) {
|
||||
final Block block = Block.REGISTRY.getObject(resourceLocation);
|
||||
WarpDrive.logger.debug(String.format("Checking block registry for %s: %s",
|
||||
|
|
|
@ -263,7 +263,7 @@ public class TooltipHandler {
|
|||
}
|
||||
|
||||
if (WarpDriveConfig.TOOLTIP_ADD_HARDNESS.isEnabled(isSneaking, isCreativeMode)) {
|
||||
final FakeWorld fakeWorld = new FakeWorld(blockState);
|
||||
final FakeWorld fakeWorld = new FakeWorld(blockState, true);
|
||||
try {
|
||||
final float hardness1 = blockState.getBlockHardness(fakeWorld, BlockPos.ORIGIN);
|
||||
final float hardness2 = block.blockHardness;
|
||||
|
|
|
@ -21,8 +21,8 @@ public class FakeWorld extends World {
|
|||
private IBlockState blockState;
|
||||
private TileEntity tileEntity;
|
||||
|
||||
public FakeWorld(final IBlockState blockState) {
|
||||
super(null, new WorldInfo(new NBTTagCompound()), new FakeWorldProvider(), null, true);
|
||||
public FakeWorld(final IBlockState blockState, final boolean isRemote) {
|
||||
super(null, new WorldInfo(new NBTTagCompound()), new FakeWorldProvider(), null, isRemote);
|
||||
this.blockState = blockState;
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,11 @@ public class FakeWorld extends World {
|
|||
&& blockState.getBlock().hasTileEntity(blockState) ) {
|
||||
if (tileEntity == null) {
|
||||
tileEntity = blockState.getBlock().createTileEntity(this, blockState);
|
||||
if (tileEntity != null) {
|
||||
tileEntity.setPos(blockPos);
|
||||
tileEntity.setWorld(this);
|
||||
tileEntity.validate();
|
||||
}
|
||||
}
|
||||
return tileEntity;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue