Placed machines now face the block they are placed on, like hoppers, fixes #231
This commit is contained in:
@@ -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.
|
||||
|
||||
|
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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:
|
||||
|
Reference in New Issue
Block a user