mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 19:29:31 +00:00
Fix tileentity markDirty() methods accessing the world when it may not be available. Fixes #3352
This commit is contained in:
1 parent
98b93ddce9
commit
2b1c003b62
8 files changed
+24
-15
No files matched your search
@@ -178,7 +178,9 @@ public class TileCraftCrate extends TileOpenCrate {
|
||||
@Override
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
|
||||
if (world != null && !world.isRemote) {
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -171,7 +171,7 @@ public class TileHourglass extends TileExposedSimpleInventory implements ITickab
|
||||
@Override
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
if (!world.isRemote) {
|
||||
if (world != null && !world.isRemote) {
|
||||
time = 0;
|
||||
timeFraction = 0F;
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(TileHourglass.this);
|
||||
|
||||
@@ -175,7 +175,7 @@ public class TileIncensePlate extends TileExposedSimpleInventory implements ISid
|
||||
@Override
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
if (!world.isRemote) {
|
||||
if (world != null && !world.isRemote) {
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,9 @@ public class TileSparkChanger extends TileExposedSimpleInventory {
|
||||
@Override
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
|
||||
if (world != null && !world.isRemote) {
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -115,7 +115,9 @@ public class TileTinyPotato extends TileExposedSimpleInventory implements ITicka
|
||||
@Override
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
|
||||
if (world != null && !world.isRemote) {
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -70,8 +70,8 @@ public class TilePrism extends TileExposedSimpleInventory {
|
||||
@Override
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
|
||||
if (world != null && !world.isRemote) {
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
|
||||
BlockState state = getBlockState();
|
||||
boolean hasLens = !getItemHandler().getStackInSlot(0).isEmpty();
|
||||
if (state.getBlock() != ModBlocks.prism || state.get(BotaniaStateProps.HAS_LENS) != hasLens) {
|
||||
|
||||
@@ -386,13 +386,12 @@ public class TileSpreader extends TileExposedSimpleInventory implements IManaCol
|
||||
if (!player.isSneaking()) {
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
|
||||
} else {
|
||||
RayTraceResult pos = Item.rayTrace(world, player, RayTraceContext.FluidMode.ANY);
|
||||
if (pos instanceof BlockRayTraceResult && !world.isRemote) {
|
||||
double x = pos.getHitVec().x - getPos().getX() - 0.5;
|
||||
double y = pos.getHitVec().y - getPos().getY() - 0.5;
|
||||
double z = pos.getHitVec().z - getPos().getZ() - 0.5;
|
||||
BlockRayTraceResult bpos = Item.rayTrace(world, player, RayTraceContext.FluidMode.ANY);
|
||||
if (!world.isRemote) {
|
||||
double x = bpos.getHitVec().x - getPos().getX() - 0.5;
|
||||
double y = bpos.getHitVec().y - getPos().getY() - 0.5;
|
||||
double z = bpos.getHitVec().z - getPos().getZ() - 0.5;
|
||||
|
||||
BlockRayTraceResult bpos = (BlockRayTraceResult) pos;
|
||||
if (bpos.getFace() != Direction.DOWN && bpos.getFace() != Direction.UP) {
|
||||
Vector3 clickVector = new Vector3(x, 0, z);
|
||||
Vector3 relative = new Vector3(-0.5, 0, 0);
|
||||
@@ -606,8 +605,12 @@ public class TileSpreader extends TileExposedSimpleInventory implements IManaCol
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
checkForReceiver();
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
|
||||
if (world != null) {
|
||||
checkForReceiver();
|
||||
if (!world.isRemote) {
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -92,7 +92,7 @@ public abstract class TileRedString extends TileMod implements ITileBound, ITick
|
||||
|
||||
public TileEntity getTileAtBinding() {
|
||||
BlockPos binding = getBinding();
|
||||
return binding == null ? null : world.getTileEntity(binding);
|
||||
return binding == null || world == null ? null : world.getTileEntity(binding);
|
||||
}
|
||||
|
||||
public BlockState getStateAtBinding() {
|
||||
|
||||
Reference in new issue
Block a user