Fixed Crafter facing bottom side on placement

This commit is contained in:
Raoul Van den Berge
2016-08-08 02:16:12 +02:00
parent b830b3c31e
commit a341cc4319
5 changed files with 13 additions and 4 deletions

View File

@@ -9,6 +9,7 @@
- Fixed serverside configs not syncing up with clientside - Fixed serverside configs not syncing up with clientside
- Fixed not being able to move inventory items in Grid GUI's to hotbar via the number keys - Fixed not being able to move inventory items in Grid GUI's to hotbar via the number keys
- Fixed Relays when being in "Ignore Redstone" mode using up energy - Fixed Relays when being in "Ignore Redstone" mode using up energy
- Fixed Crafter facing bottom side on placement
- Improved collisions of Cable parts - Improved collisions of Cable parts
- You now have to click the actual cable part head in order to get the GUI open - You now have to click the actual cable part head in order to get the GUI open

View File

@@ -103,7 +103,7 @@ public abstract class BlockBase extends Block {
IBlockState state = super.onBlockPlaced(world, pos, facing, hitX, hitY, hitZ, meta, entity); IBlockState state = super.onBlockPlaced(world, pos, facing, hitX, hitY, hitZ, meta, entity);
if (getPlacementType() != null) { if (getPlacementType() != null) {
return state.withProperty(DIRECTION, getPlacementType().getFrom(facing, entity)); return state.withProperty(DIRECTION, getPlacementType().getFrom(facing, pos, entity));
} }
return state; return state;

View File

@@ -237,7 +237,7 @@ public class BlockCable extends BlockCoverable {
IBlockState state = super.onBlockPlaced(world, pos, facing, hitX, hitY, hitZ, meta, entity); IBlockState state = super.onBlockPlaced(world, pos, facing, hitX, hitY, hitZ, meta, entity);
if (getPlacementType() != null) { if (getPlacementType() != null) {
return state.withProperty(DIRECTION, getPlacementType().getFrom(facing, entity)); return state.withProperty(DIRECTION, getPlacementType().getFrom(facing, pos, entity));
} }
return state; return state;

View File

@@ -33,7 +33,7 @@ public class BlockCrafter extends BlockNode {
@Override @Override
public EnumPlacementType getPlacementType() { public EnumPlacementType getPlacementType() {
return EnumPlacementType.ANY; return EnumPlacementType.ANY_FACE_PLAYER;
} }
public boolean hasConnectivityState() { public boolean hasConnectivityState() {

View File

@@ -1,12 +1,17 @@
package refinedstorage.block; package refinedstorage.block;
import net.minecraft.block.BlockPistonBase;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
public enum EnumPlacementType { public enum EnumPlacementType {
ANY( ANY(
EnumFacing.VALUES EnumFacing.VALUES
), ),
ANY_FACE_PLAYER(
EnumFacing.VALUES
),
HORIZONTAL( HORIZONTAL(
EnumFacing.NORTH, EnumFacing.NORTH,
EnumFacing.EAST, EnumFacing.EAST,
@@ -20,10 +25,12 @@ public enum EnumPlacementType {
this.allowed = allowed; this.allowed = allowed;
} }
EnumFacing getFrom(EnumFacing facing, EntityLivingBase entity) { EnumFacing getFrom(EnumFacing facing, BlockPos pos, EntityLivingBase entity) {
switch (this) { switch (this) {
case ANY: case ANY:
return facing.getOpposite(); return facing.getOpposite();
case ANY_FACE_PLAYER:
return BlockPistonBase.getFacingFromEntity(pos, entity);
case HORIZONTAL: case HORIZONTAL:
return entity.getHorizontalFacing().getOpposite(); return entity.getHorizontalFacing().getOpposite();
default: default:
@@ -34,6 +41,7 @@ public enum EnumPlacementType {
EnumFacing getNext(EnumFacing previous) { EnumFacing getNext(EnumFacing previous) {
switch (this) { switch (this) {
case ANY: case ANY:
case ANY_FACE_PLAYER:
return previous.ordinal() + 1 >= EnumFacing.VALUES.length ? EnumFacing.VALUES[0] : EnumFacing.VALUES[previous.ordinal() + 1]; return previous.ordinal() + 1 >= EnumFacing.VALUES.length ? EnumFacing.VALUES[0] : EnumFacing.VALUES[previous.ordinal() + 1];
case HORIZONTAL: case HORIZONTAL:
return previous.rotateYCCW(); return previous.rotateYCCW();