Fixed Crafter facing bottom side on placement
This commit is contained in:
@@ -103,7 +103,7 @@ public abstract class BlockBase extends Block {
|
||||
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.withProperty(DIRECTION, getPlacementType().getFrom(facing, pos, entity));
|
||||
}
|
||||
|
||||
return state;
|
||||
|
||||
@@ -237,7 +237,7 @@ public class BlockCable extends BlockCoverable {
|
||||
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.withProperty(DIRECTION, getPlacementType().getFrom(facing, pos, entity));
|
||||
}
|
||||
|
||||
return state;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class BlockCrafter extends BlockNode {
|
||||
|
||||
@Override
|
||||
public EnumPlacementType getPlacementType() {
|
||||
return EnumPlacementType.ANY;
|
||||
return EnumPlacementType.ANY_FACE_PLAYER;
|
||||
}
|
||||
|
||||
public boolean hasConnectivityState() {
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
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(
|
||||
EnumFacing.VALUES
|
||||
),
|
||||
ANY_FACE_PLAYER(
|
||||
EnumFacing.VALUES
|
||||
),
|
||||
HORIZONTAL(
|
||||
EnumFacing.NORTH,
|
||||
EnumFacing.EAST,
|
||||
@@ -20,10 +25,12 @@ public enum EnumPlacementType {
|
||||
this.allowed = allowed;
|
||||
}
|
||||
|
||||
EnumFacing getFrom(EnumFacing facing, EntityLivingBase entity) {
|
||||
EnumFacing getFrom(EnumFacing facing, BlockPos pos, EntityLivingBase entity) {
|
||||
switch (this) {
|
||||
case ANY:
|
||||
return facing.getOpposite();
|
||||
case ANY_FACE_PLAYER:
|
||||
return BlockPistonBase.getFacingFromEntity(pos, entity);
|
||||
case HORIZONTAL:
|
||||
return entity.getHorizontalFacing().getOpposite();
|
||||
default:
|
||||
@@ -34,6 +41,7 @@ public enum EnumPlacementType {
|
||||
EnumFacing getNext(EnumFacing previous) {
|
||||
switch (this) {
|
||||
case ANY:
|
||||
case ANY_FACE_PLAYER:
|
||||
return previous.ordinal() + 1 >= EnumFacing.VALUES.length ? EnumFacing.VALUES[0] : EnumFacing.VALUES[previous.ordinal() + 1];
|
||||
case HORIZONTAL:
|
||||
return previous.rotateYCCW();
|
||||
|
||||
Reference in New Issue
Block a user