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
|
// scan blocks registry
|
||||||
final FakeWorld fakeWorld = new FakeWorld(null);
|
final FakeWorld fakeWorld = new FakeWorld(null, false);
|
||||||
for (final ResourceLocation resourceLocation : Block.REGISTRY.getKeys()) {
|
for (final ResourceLocation resourceLocation : Block.REGISTRY.getKeys()) {
|
||||||
final Block block = Block.REGISTRY.getObject(resourceLocation);
|
final Block block = Block.REGISTRY.getObject(resourceLocation);
|
||||||
WarpDrive.logger.debug(String.format("Checking block registry for %s: %s",
|
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)) {
|
if (WarpDriveConfig.TOOLTIP_ADD_HARDNESS.isEnabled(isSneaking, isCreativeMode)) {
|
||||||
final FakeWorld fakeWorld = new FakeWorld(blockState);
|
final FakeWorld fakeWorld = new FakeWorld(blockState, true);
|
||||||
try {
|
try {
|
||||||
final float hardness1 = blockState.getBlockHardness(fakeWorld, BlockPos.ORIGIN);
|
final float hardness1 = blockState.getBlockHardness(fakeWorld, BlockPos.ORIGIN);
|
||||||
final float hardness2 = block.blockHardness;
|
final float hardness2 = block.blockHardness;
|
||||||
|
|
|
@ -21,8 +21,8 @@ public class FakeWorld extends World {
|
||||||
private IBlockState blockState;
|
private IBlockState blockState;
|
||||||
private TileEntity tileEntity;
|
private TileEntity tileEntity;
|
||||||
|
|
||||||
public FakeWorld(final IBlockState blockState) {
|
public FakeWorld(final IBlockState blockState, final boolean isRemote) {
|
||||||
super(null, new WorldInfo(new NBTTagCompound()), new FakeWorldProvider(), null, true);
|
super(null, new WorldInfo(new NBTTagCompound()), new FakeWorldProvider(), null, isRemote);
|
||||||
this.blockState = blockState;
|
this.blockState = blockState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,6 +74,11 @@ public class FakeWorld extends World {
|
||||||
&& blockState.getBlock().hasTileEntity(blockState) ) {
|
&& blockState.getBlock().hasTileEntity(blockState) ) {
|
||||||
if (tileEntity == null) {
|
if (tileEntity == null) {
|
||||||
tileEntity = blockState.getBlock().createTileEntity(this, blockState);
|
tileEntity = blockState.getBlock().createTileEntity(this, blockState);
|
||||||
|
if (tileEntity != null) {
|
||||||
|
tileEntity.setPos(blockPos);
|
||||||
|
tileEntity.setWorld(this);
|
||||||
|
tileEntity.validate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return tileEntity;
|
return tileEntity;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue