mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 23:27:59 +01:00
Fixed dutch doors not updating correctly
This commit is contained in:
parent
1e032e1915
commit
4170d3301d
1 changed files with 14 additions and 12 deletions
|
@ -1,6 +1,7 @@
|
||||||
package com.minelittlepony.unicopia.block;
|
package com.minelittlepony.unicopia.block;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.enums.DoubleBlockHalf;
|
import net.minecraft.block.enums.DoubleBlockHalf;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
|
@ -32,24 +33,25 @@ public class DutchDoorBlock extends AbstractDoorBlock {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// UPPER - HALF/HINGE/POWER{/OPEN}
|
|
||||||
// LOWER - HALF/FACING/FACING/OPEN
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction face, BlockState other, IWorld world, BlockPos pos, BlockPos otherPos) {
|
public BlockState getStateForNeighborUpdate(BlockState state, Direction face, BlockState other, IWorld world, BlockPos pos, BlockPos otherPos) {
|
||||||
|
|
||||||
// copy properties in stored by the sibling block
|
DoubleBlockHalf half = state.get(HALF);
|
||||||
if (state.get(HALF) == DoubleBlockHalf.LOWER) {
|
|
||||||
if (other.getBlock() == this) {
|
if (face.getAxis() == Direction.Axis.Y && half == DoubleBlockHalf.LOWER == (face == Direction.UP)) {
|
||||||
return state.with(HINGE, other.get(HINGE))
|
if (other.getBlock() == this && other.get(HALF) != half) {
|
||||||
.with(POWERED, other.get(POWERED));
|
return state
|
||||||
}
|
.with(FACING, other.get(FACING))
|
||||||
} else {
|
.with(HINGE, other.get(HINGE))
|
||||||
if (other.getBlock() == this) {
|
.with(POWERED, other.get(POWERED));
|
||||||
return state.with(FACING, other.get(FACING));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Blocks.AIR.getDefaultState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (half == DoubleBlockHalf.LOWER && face == Direction.DOWN && !state.canPlaceAt(world, pos)) {
|
||||||
|
return Blocks.AIR.getDefaultState();
|
||||||
|
}
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue