Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/main/java/dev/dubhe/anvilcraft/block/FishTankBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
Expand Down Expand Up @@ -109,6 +111,16 @@ public BlockState getStateForPlacement(BlockPlaceContext context) {
return this.defaultBlockState().setValue(FishTankBlock.FACING, facing);
}

@Override
protected BlockState rotate(BlockState state, Rotation rotation) {
return state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}

@Override
protected BlockState mirror(BlockState state, Mirror mirror) {
return state.setValue(FACING, mirror.mirror(state.getValue(FACING)));
}

@Override
protected boolean hasAnalogOutputSignal(BlockState state) {
return true;
Expand Down
20 changes: 18 additions & 2 deletions src/main/java/dev/dubhe/anvilcraft/block/OverflowChuteBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,28 @@ public int getAnalogOutputSignal(BlockState blockState, Level level, BlockPos bl

@Override
public BlockState rotate(BlockState state, Rotation rotation) {
return state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
BlockState result = state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
for (Direction direction : Direction.values()) {
Direction rotatedDirection = rotation.rotate(direction);
result = result.setValue(
overflowProperty(rotatedDirection),
state.getValue(overflowProperty(direction))
);
}
return result;
}

@Override
public BlockState mirror(BlockState state, Mirror mirror) {
return this.rotate(state, mirror.getRotation(state.getValue(FACING)));
BlockState result = state.setValue(FACING, mirror.mirror(state.getValue(FACING)));
for (Direction direction : Direction.values()) {
Direction mirroredDirection = mirror.mirror(direction);
result = result.setValue(
overflowProperty(mirroredDirection),
state.getValue(overflowProperty(direction))
);
}
return result;
}

@Override
Expand Down
Loading