mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-28 15:46:01 +00:00
Cleaned up computer integration
This commit is contained in:
1 parent
c2006d5e70
commit
21fa9fdb26
7 files changed
+32
-106
No files matched your search
@@ -5,10 +5,14 @@ import dan200.computercraft.api.lua.ILuaContext;
|
||||
import dan200.computercraft.api.lua.LuaException;
|
||||
import dan200.computercraft.api.peripheral.IComputerAccess;
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import dan200.computercraft.api.peripheral.IPeripheralProvider;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Created by aidancbrady on 7/20/15.
|
||||
*/
|
||||
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
|
||||
public class CCPeripheral implements IPeripheral
|
||||
{
|
||||
public IComputerIntegration computerTile;
|
||||
@@ -60,4 +64,20 @@ public class CCPeripheral implements IPeripheral
|
||||
{
|
||||
return this == other;
|
||||
}
|
||||
|
||||
public static class CCPeripheralProvider implements IPeripheralProvider
|
||||
{
|
||||
@Override
|
||||
public IPeripheral getPeripheral(World world, int x, int y, int z, int side)
|
||||
{
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(te != null && te instanceof IComputerIntegration)
|
||||
{
|
||||
return new CCPeripheral((IComputerIntegration)te);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user