Fix doors not adapting the correct data from their other half
This commit is contained in:
parent
705f97dabf
commit
9b59483cbe
|
@ -50,7 +50,9 @@ public class DoorExtension implements BlockStateExtension {
|
||||||
public BlockState extend(MCAWorld world, Vector3i pos, BlockState state) {
|
public BlockState extend(MCAWorld world, Vector3i pos, BlockState state) {
|
||||||
BlockState otherDoor;
|
BlockState otherDoor;
|
||||||
|
|
||||||
if (state.getProperties().get("half").equals("lower")) {
|
boolean isLower = state.getProperties().get("half").equals("lower");
|
||||||
|
|
||||||
|
if (isLower) {
|
||||||
otherDoor = world.getBlockState(pos.add(Direction.UP.toVector()));
|
otherDoor = world.getBlockState(pos.add(Direction.UP.toVector()));
|
||||||
} else {
|
} else {
|
||||||
otherDoor = world.getBlockState(pos.add(Direction.DOWN.toVector()));
|
otherDoor = world.getBlockState(pos.add(Direction.DOWN.toVector()));
|
||||||
|
@ -58,7 +60,13 @@ public class DoorExtension implements BlockStateExtension {
|
||||||
|
|
||||||
//copy all properties from the other door
|
//copy all properties from the other door
|
||||||
for (Entry<String, String> prop : otherDoor.getProperties().entrySet()) {
|
for (Entry<String, String> prop : otherDoor.getProperties().entrySet()) {
|
||||||
if (!state.getProperties().containsKey(prop.getKey())) {
|
if (
|
||||||
|
!state.getProperties().containsKey(prop.getKey()) ||
|
||||||
|
(isLower && prop.getKey().equals("hinge")) ||
|
||||||
|
(isLower && prop.getKey().equals("powered")) ||
|
||||||
|
(!isLower && prop.getKey().equals("open")) ||
|
||||||
|
(!isLower && prop.getKey().equals("facing"))
|
||||||
|
) {
|
||||||
state = state.with(prop.getKey(), prop.getValue());
|
state = state.with(prop.getKey(), prop.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue