mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 19:46:42 +01:00
Implement rotating and mirroring for compacted clouds
This commit is contained in:
parent
f9c4234cbe
commit
30a6868f63
1 changed files with 25 additions and 0 deletions
|
@ -19,6 +19,8 @@ import net.minecraft.state.StateManager;
|
|||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.Property;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.BlockMirror;
|
||||
import net.minecraft.util.BlockRotation;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
|
@ -84,4 +86,27 @@ public class CompactedCloudBlock extends CloudBlock {
|
|||
|
||||
return ActionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState rotate(BlockState state, BlockRotation rotation) {
|
||||
BlockState result = state;
|
||||
for (var property : FACING_PROPERTIES.entrySet()) {
|
||||
if (property.getKey().getAxis() != Direction.Axis.Y) {
|
||||
result = result.with(FACING_PROPERTIES.get(rotation.rotate(property.getKey())), state.get(property.getValue()));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState mirror(BlockState state, BlockMirror mirror) {
|
||||
BlockState result = state;
|
||||
for (var property : FACING_PROPERTIES.entrySet()) {
|
||||
if (property.getKey().getAxis() != Direction.Axis.Y) {
|
||||
result = result.with(FACING_PROPERTIES.get(mirror.apply(property.getKey())), state.get(property.getValue()));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue