Merge branch 'nightly' into marmot

This commit is contained in:
CovertJaguar 2013-12-28 00:43:25 -08:00
commit fedb4d5a42
2 changed files with 34 additions and 12 deletions

View file

@ -264,22 +264,17 @@ public class BlockGenericPipe extends BlockBuildCraft {
}
}
private RaytraceResult doRayTrace(World world, int x, int y, int z, EntityPlayer entityPlayer) {
double pitch = Math.toRadians(entityPlayer.rotationPitch);
double yaw = Math.toRadians(entityPlayer.rotationYaw);
double dirX = -Math.sin(yaw) * Math.cos(pitch);
double dirY = -Math.sin(pitch);
double dirZ = Math.cos(yaw) * Math.cos(pitch);
private RaytraceResult doRayTrace(World world, int x, int y, int z, EntityPlayer player) {
double reachDistance = 5;
if (entityPlayer instanceof EntityPlayerMP) {
reachDistance = ((EntityPlayerMP) entityPlayer).theItemInWorldManager.getBlockReachDistance();
if (player instanceof EntityPlayerMP) {
reachDistance = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance();
}
Vec3 origin = Vec3.fakePool.getVecFromPool(entityPlayer.posX, entityPlayer.posY + 1.62 - entityPlayer.yOffset, entityPlayer.posZ);
Vec3 direction = origin.addVector(dirX * reachDistance, dirY * reachDistance, dirZ * reachDistance);
double eyeHeight = world.isRemote ? player.getEyeHeight() - player.getDefaultEyeHeight() : player.getEyeHeight();
Vec3 lookVec = player.getLookVec();
Vec3 origin = world.getWorldVec3Pool().getVecFromPool(player.posX, player.posY + eyeHeight, player.posZ);
Vec3 direction = origin.addVector(lookVec.xCoord * reachDistance, lookVec.yCoord * reachDistance, lookVec.zCoord * reachDistance);
return doRayTrace(world, x, y, z, origin, direction);
}

View file

@ -7,12 +7,17 @@
*/
package buildcraft.transport.pipes;
import java.util.LinkedList;
import java.util.Map;
import buildcraft.BuildCraftTransport;
import buildcraft.api.core.IIconProvider;
import buildcraft.api.gates.IAction;
import buildcraft.transport.Pipe;
import buildcraft.transport.PipeIconProvider;
import buildcraft.transport.PipeTransportFluids;
import buildcraft.transport.TileGenericPipe;
import buildcraft.transport.triggers.ActionPipeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
@ -89,6 +94,28 @@ public class PipeFluidsIron extends Pipe<PipeTransportFluids> {
}
@Override
protected void actionsActivated(Map<IAction, Boolean> actions) {
super.actionsActivated(actions);
for (Map.Entry<IAction, Boolean> action : actions.entrySet()) {
if (action.getKey() instanceof ActionPipeDirection && action.getValue() != null && action.getValue()) {
logic.setFacing(((ActionPipeDirection) action.getKey()).direction);
break;
}
}
}
@Override
public LinkedList<IAction> getActions() {
LinkedList<IAction> action = super.getActions();
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
if (container.isPipeConnected(direction))
action.add(BuildCraftTransport.actionPipeDirection[direction.ordinal()]);
}
return action;
}
@Override
public boolean canConnectRedstone() {
return true;