Use rotationYaw to set quarry orientation.
Allows computercraft turtles to place quarries.
This commit is contained in:
parent
1b186df3f8
commit
7e9f75a7bc
1 changed files with 5 additions and 1 deletions
|
@ -19,6 +19,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.BuildCraftFactory;
|
||||
|
@ -48,7 +49,10 @@ public class BlockQuarry extends BlockMachineRoot {
|
|||
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, i, j, k, entityliving, stack);
|
||||
|
||||
ForgeDirection orientation = Utils.get2dOrientation(new Position(entityliving.posX, entityliving.posY, entityliving.posZ), new Position(i, j, k));
|
||||
// Convert entityLiving.rotationYaw into a cardinal direction.
|
||||
ForgeDirection [] orientationTable = {ForgeDirection.SOUTH, ForgeDirection.WEST, ForgeDirection.NORTH, ForgeDirection.EAST};
|
||||
int orientationIndex = MathHelper.floor_double((entityliving.rotationYaw + 45.0) / 90.0) & 3;
|
||||
ForgeDirection orientation = orientationTable[orientationIndex];
|
||||
|
||||
world.setBlockMetadataWithNotify(i, j, k, orientation.getOpposite().ordinal(),1);
|
||||
if (entityliving instanceof EntityPlayer) {
|
||||
|
|
Loading…
Reference in a new issue