feat: backport recent changes to 1.21.1

This commit is contained in:
Martin Prokoph
2025-03-02 13:49:18 +01:00
parent 327b94d7cd
commit 395bbfc92c
228 changed files with 286 additions and 840 deletions

View File

@@ -5,8 +5,6 @@ import eu.midnightdust.motschen.rocks.blockstates.StickVariation;
import net.minecraft.block.*;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
@@ -17,12 +15,11 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.Random;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import net.minecraft.world.tick.ScheduledTickView;
import java.util.Objects;
@@ -33,7 +30,7 @@ public class Stick extends Block {
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
public Stick(Identifier blockId) {
super(AbstractBlock.Settings.copy(Blocks.POPPY).registryKey(RegistryKey.of(RegistryKeys.BLOCK, blockId)).nonOpaque().dynamicBounds().sounds(BlockSoundGroup.WOOD));
super(AbstractBlock.Settings.copy(Blocks.POPPY).nonOpaque().dynamicBounds().sounds(BlockSoundGroup.WOOD));
this.setDefaultState(this.stateManager.getDefaultState().with(STICK_VARIATION, StickVariation.SMALL).with(WATERLOGGED, false));
}
@@ -69,11 +66,11 @@ public class Stick extends Block {
return world.getBlockState(pos.down()).isSideSolidFullSquare(world,pos,Direction.UP);
}
@Override
public BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) {
return !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random);
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) {
return !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos);
}
@Override
protected boolean isTransparent(BlockState state) {return true;}
protected boolean isTransparent(BlockState state, BlockView world, BlockPos pos) {return true;}
@Override
protected boolean canReplace(BlockState state, ItemPlacementContext context) {return true;}
}