diff --git a/CHANGELOG.md b/CHANGELOG.md index 73c7d3fd6..d66aa7af1 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Added support for processing patterns with big stacksizes - The slot where the Wireless Grid is in in the Wireless Grid GUI is now disabled, so the item can't be thrown out of the inventory by accident - Changed Relay recipe to use redstone torch instead of Basic Processor +- Placed machines now face the block they are placed on, like hoppers **NOTE:** Config change: the config options for the energy capacity of the Controller and wether the Controller uses energy are now in a different config category called "controller", if you changed these config options, don't forget the change it under the new category. diff --git a/src/main/java/refinedstorage/block/BlockBase.java b/src/main/java/refinedstorage/block/BlockBase.java index 07238e5b8..84708da07 100755 --- a/src/main/java/refinedstorage/block/BlockBase.java +++ b/src/main/java/refinedstorage/block/BlockBase.java @@ -98,12 +98,23 @@ public abstract class BlockBase extends Block { return false; } + @Override + public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase entity) { + IBlockState state = super.onBlockPlaced(world, pos, facing, hitX, hitY, hitZ, meta, entity); + + if (getPlacementType() != null) { + return state.withProperty(DIRECTION, getPlacementType().getFrom(facing, entity)); + } + + return state; + } + @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) { super.onBlockPlacedBy(world, pos, state, player, stack); if (getPlacementType() != null) { - ((TileBase) world.getTileEntity(pos)).setDirection(getPlacementType().getFrom(pos, player)); + ((TileBase) world.getTileEntity(pos)).setDirection(state.getValue(DIRECTION)); } } diff --git a/src/main/java/refinedstorage/block/EnumPlacementType.java b/src/main/java/refinedstorage/block/EnumPlacementType.java index 5d61a53d5..b95a51f47 100755 --- a/src/main/java/refinedstorage/block/EnumPlacementType.java +++ b/src/main/java/refinedstorage/block/EnumPlacementType.java @@ -1,9 +1,7 @@ package refinedstorage.block; -import net.minecraft.block.BlockPistonBase; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; public enum EnumPlacementType { ANY( @@ -22,12 +20,10 @@ public enum EnumPlacementType { this.allowed = allowed; } - EnumFacing getFrom(BlockPos pos, EntityLivingBase entity) { + EnumFacing getFrom(EnumFacing facing, EntityLivingBase entity) { switch (this) { case ANY: - EnumFacing facing = BlockPistonBase.getFacingFromEntity(pos, entity); - - return entity.isSneaking() ? facing.getOpposite() : facing; + return facing.getOpposite(); case HORIZONTAL: return entity.getHorizontalFacing().getOpposite(); default: