ThisRocks 1.8.0 - Update to 1.21

- Fixed #15
- Allow blocks to replace rocks and sticks (closes #43)
- Added unifiedPublishing for a better workflow
This commit is contained in:
Martin Prokoph
2024-06-16 23:24:49 +02:00
parent d66ee7abb4
commit ac3c519fc4
45 changed files with 813 additions and 619 deletions

View File

@@ -31,7 +31,7 @@ public class Stick extends Block {
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
public Stick() {
super(FabricBlockSettings.copy(Blocks.POPPY).nonOpaque().sounds(BlockSoundGroup.WOOD));
super(AbstractBlock.Settings.copy(Blocks.POPPY).nonOpaque().sounds(BlockSoundGroup.WOOD));
this.setDefaultState(this.stateManager.getDefaultState().with(STICK_VARIATION, StickVariation.SMALL).with(WATERLOGGED, false));
}
@@ -40,7 +40,7 @@ public class Stick extends Block {
return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
.with(STICK_VARIATION, StickVariation.SMALL).with(WATERLOGGED, false);
}
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
if (player.isCreative()) {
if (state.get(STICK_VARIATION) == StickVariation.SMALL) {
world.setBlockState(pos, state.with(STICK_VARIATION, StickVariation.MEDIUM));
@@ -74,4 +74,6 @@ public class Stick extends Block {
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
return !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, newState, world, pos, posFrom);
}
protected boolean isTransparent(BlockState state, BlockView world, BlockPos pos) {return true;}
protected boolean canReplace(BlockState state, ItemPlacementContext context) {return true;}
}