9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-25 01:49:30 +00:00

fix facing mirror

This commit is contained in:
XiaoMoMi
2025-04-02 21:41:04 +08:00
parent c83a06f5ba
commit 8b49039894
2 changed files with 16 additions and 4 deletions

View File

@@ -61,14 +61,14 @@ public class BukkitBlockBehavior extends AbstractBlockBehavior {
}
});
HARD_CODED_PROPERTY_DATA.put("facing_clockwise", (behavior, property) -> {
if (property.valueClass() == Direction.class) {
if (property.valueClass() == HorizontalDirection.class) {
@SuppressWarnings("unchecked")
Property<Direction> directionProperty = (Property<Direction>) property;
Property<HorizontalDirection> directionProperty = (Property<HorizontalDirection>) property;
behavior.rotateFunction = (thisBlock, blockState, rotation) ->
blockState.with(directionProperty, rotation.rotate(blockState.get(directionProperty)))
blockState.with(directionProperty, rotation.rotate(blockState.get(directionProperty).toDirection()).toHorizontalDirection())
.customBlockState().handle();
behavior.mirrorFunction = (thisBlock, blockState, mirror) -> {
Rotation rotation = mirror.getRotation(blockState.get(directionProperty));
Rotation rotation = mirror.getRotation(blockState.get(directionProperty).toDirection());
return behavior.rotateFunction.rotate(thisBlock, blockState, rotation);
};
}

View File

@@ -6038,4 +6038,16 @@ public class Reflections {
clazz$BlockBehaviour, clazz$BlockState, clazz$BlockState, clazz$Mirror
)
);
public static final Method method$BlockStateBase$rotate = requireNonNull(
ReflectionUtils.getMethod(
clazz$BlockStateBase, clazz$BlockState, clazz$Rotation
)
);
public static final Method method$BlockStateBase$mirror = requireNonNull(
ReflectionUtils.getMethod(
clazz$BlockStateBase, clazz$BlockState, clazz$Mirror
)
);
}