fix: IPeripheral ClassCarstenException

This commit is contained in:
Timo Ley 2024-08-27 10:48:01 +02:00
parent de2c2d419c
commit 2bfd953e6a
6 changed files with 6 additions and 6 deletions

View file

@ -23,7 +23,7 @@ public class BlockATOTransmitterStopPoint extends BlockContainer implements IPer
public IPeripheral getPeripheral(World world, int x, int y, int z, int side) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
return (IPeripheral)tileEntity;
return tileEntity instanceof IPeripheral ? (IPeripheral)tileEntity : null;
}

View file

@ -22,7 +22,7 @@ public class BlockInfoGrabberDestination extends BlockContainer implements IPer
public IPeripheral getPeripheral(World world, int x, int y, int z, int side) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
return (IPeripheral)tileEntity;
return tileEntity instanceof IPeripheral ? (IPeripheral)tileEntity : null;
}

View file

@ -22,6 +22,6 @@ public class BlockInfoGrabberMTC extends BlockContainer implements IPeripheralPr
public IPeripheral getPeripheral(World world, int x, int y, int z, int side) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
return (IPeripheral)tileEntity;
return tileEntity instanceof IPeripheral ? (IPeripheral)tileEntity : null;
}
}

View file

@ -16,7 +16,7 @@ public class BlockInfoTransmitterMTC extends BlockContainer implements IPeripher
@Override
public IPeripheral getPeripheral(World world, int x, int y, int z, int side) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
return (IPeripheral)tileEntity;
return tileEntity instanceof IPeripheral ? (IPeripheral)tileEntity : null;
}
@Override

View file

@ -20,7 +20,7 @@ public class BlockInfoTransmitterSpeed extends BlockContainer implements IPeriph
@Override
public IPeripheral getPeripheral(World world, int x, int y, int z, int side) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
return (IPeripheral)tileEntity;
return tileEntity instanceof IPeripheral ? (IPeripheral)tileEntity : null;
}

View file

@ -19,7 +19,7 @@ public class BlockPDMInstructionRadio extends Block implements IPeripheralProvi
@Override
public IPeripheral getPeripheral(World world, int x, int y, int z, int side) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
return (IPeripheral)tileEntity;
return tileEntity instanceof IPeripheral ? (IPeripheral)tileEntity : null;
}