Skip to content

Commit da22a77

Browse files
committedOct 17, 2015
Apparently there should be an instanceof check here...
@Victorious3, note that @Vexatos said that I should do this.
1 parent c39b0d1 commit da22a77

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed
 

‎src/main/java/moe/nightfall/vic/integratedcircuits/compat/gateio/GPComputerCraft.java

+9-5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import moe.nightfall.vic.integratedcircuits.api.gate.IGatePeripheralProvider;
55
import moe.nightfall.vic.integratedcircuits.api.gate.ISocket;
66
import moe.nightfall.vic.integratedcircuits.api.gate.ISocketWrapper;
7+
import net.minecraft.tileentity.TileEntity;
78
import net.minecraft.world.World;
89
import codechicken.lib.vec.BlockCoord;
910
import cpw.mods.fml.common.Optional.Interface;
@@ -55,11 +56,14 @@ public int getBundledRedstoneOutput(World world, int x, int y, int z, int side)
5556
@Override
5657
@Method(modid = "ComputerCraft")
5758
public IPeripheral getPeripheral(World world, int x, int y, int z, int side) {
58-
ISocket socket = ((ISocketWrapper) world.getTileEntity(x, y, z)).getSocket();
59-
if (socket.getGate() instanceof IGatePeripheralProvider) {
60-
IGatePeripheralProvider provider = (IGatePeripheralProvider) socket.getGate();
61-
return provider.hasPeripheral(side) ? provider.getPeripheral() : null;
59+
TileEntity tileEntity = world.getTileEntity(x, y, z);
60+
if (tileEntity instanceof ISocketWrapper) {
61+
ISocket socket = ((ISocketWrapper) tileEntity).getSocket();
62+
if (socket.getGate() instanceof IGatePeripheralProvider) {
63+
IGatePeripheralProvider provider = (IGatePeripheralProvider) socket.getGate();
64+
return provider.hasPeripheral(side) ? provider.getPeripheral() : null;
65+
}
6266
}
6367
return null;
6468
}
65-
}
69+
}

0 commit comments

Comments
 (0)
Please sign in to comment.