From 1ec866f98de4eebf9d5bb9d71252354bd70e916f Mon Sep 17 00:00:00 2001 From: mDiyo Date: Tue, 6 Aug 2013 01:57:05 -0700 Subject: [PATCH] Redstone connection rules for Drawbridge --- tconstruct/blocks/RedstoneMachine.java | 14 ++++++++------ tconstruct/blocks/logic/DrawbridgeLogic.java | 14 +++++++++++++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/tconstruct/blocks/RedstoneMachine.java b/tconstruct/blocks/RedstoneMachine.java index be18ac02..4e9054f4 100644 --- a/tconstruct/blocks/RedstoneMachine.java +++ b/tconstruct/blocks/RedstoneMachine.java @@ -12,6 +12,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.Direction; import net.minecraft.util.Icon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -238,12 +239,6 @@ public class RedstoneMachine extends InventoryBlock return false; } - - @Override - public boolean canConnectRedstone (IBlockAccess world, int x, int y, int z, int side) - { - return true; - } /* Keep inventory */ @Override @@ -338,4 +333,11 @@ public class RedstoneMachine extends InventoryBlock } } } + + /* Redstone connections */ + + public boolean canConnectRedstone (IBlockAccess world, int x, int y, int z, int side) + { + return true; + } } diff --git a/tconstruct/blocks/logic/DrawbridgeLogic.java b/tconstruct/blocks/logic/DrawbridgeLogic.java index 06d4ce77..ed47f38d 100644 --- a/tconstruct/blocks/logic/DrawbridgeLogic.java +++ b/tconstruct/blocks/logic/DrawbridgeLogic.java @@ -150,7 +150,7 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc } else { - if (keycode % 2 == 0) + if (keycode == 0) //Forward { fakePlayer.rotationYaw = mapDirection() * 90; @@ -159,6 +159,18 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc else fakePlayer.rotationPitch = -90; } + else if (keycode == 2) //Backward + { + int face = mapDirection() + 2; + if (face > 3) + face -= 4; + fakePlayer.rotationYaw = face * 90; + + if (keycode == 0) + fakePlayer.rotationPitch = 90; + else + fakePlayer.rotationPitch = -90; + } else { fakePlayer.rotationPitch = 0;