Completed levers, added redstone interaction

This commit is contained in:
Chicken Bones committed 2013-06-03 13:30:36 +10:00
1 parent a695de4b9d
commit 283a723e38
8 files changed
+289 -21

No files matched your search

+18 -1
View File
@@ -13,8 +13,9 @@ import codechicken.core.lighting.LazyLightMatrix;
import codechicken.core.vec.BlockCoord;
import codechicken.core.vec.Cuboid6;
import codechicken.core.vec.Vector3;
import codechicken.multipart.IRedstonePart;
public class LeverPart extends McSidedMetaPart
public class LeverPart extends McSidedMetaPart implements IRedstonePart
{
public static BlockLever lever = (BlockLever) Block.lever;
public static int[] metaSideMap = new int[]{1, 4, 5, 2, 3, 0, 0, 1};
@@ -101,6 +102,7 @@ public class LeverPart extends McSidedMetaPart
meta = (byte) (meta^8);
sendDescUpdate();
tile().notifyPartChange();
tile().notifyNeighborChange(metaSideMap[meta&7]);
tile().markDirty();
return true;
}
@@ -112,4 +114,19 @@ public class LeverPart extends McSidedMetaPart
renderBlocks.renderBlockLever(lever, getTile().xCoord, getTile().yCoord, getTile().zCoord);
renderBlocks.blockAccess = actual;
}
public int weakPowerLevel(int side)
{
return (meta & 8) > 0 ? 15 : 0;
}
public int strongPowerLevel(int side)
{
return (meta & 8) > 0 && side == metaSideMap[meta&7] ? 15 : 0;
}
public boolean canConnectRedstone(int side)
{
return true;
}
}