Various fixes
This commit is contained in:
parent
dccb49f51c
commit
7d79452220
52 changed files with 130 additions and 101 deletions
|
@ -35,7 +35,7 @@ public abstract class BaseAnvilBlock extends AnvilBlock implements BlockModelPro
|
|||
public static final IntegerProperty DESTRUCTION = BlockProperties.DESTRUCTION;
|
||||
|
||||
public BaseAnvilBlock(MaterialColor color) {
|
||||
super(FabricBlockSettings.copyOf(Blocks.ANVIL).materialColor(color));
|
||||
super(FabricBlockSettings.copyOf(Blocks.ANVIL).mapColor(color));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -43,8 +43,9 @@ public abstract class BaseAnvilBlock extends AnvilBlock implements BlockModelPro
|
|||
super.createBlockStateDefinition(builder);
|
||||
builder.add(DESTRUCTION);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
ItemStack dropStack = new ItemStack(this);
|
||||
int destruction = state.getValue(DESTRUCTION);
|
||||
|
|
|
@ -16,12 +16,13 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
|||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public abstract class BaseAttachedBlock extends BaseBlockNotFull {
|
||||
public static final DirectionProperty FACING = BlockStateProperties.FACING;
|
||||
|
||||
public BaseAttachedBlock(Properties settings) {
|
||||
super(settings);
|
||||
this.registerDefaultState(this.defaultBlockState().setValue(FACING, Direction.UP));
|
||||
registerDefaultState(defaultBlockState().setValue(FACING, Direction.UP));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,7 +32,7 @@ public abstract class BaseAttachedBlock extends BaseBlockNotFull {
|
|||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
|
||||
BlockState blockState = this.defaultBlockState();
|
||||
BlockState blockState = defaultBlockState();
|
||||
LevelReader worldView = ctx.getLevel();
|
||||
BlockPos blockPos = ctx.getClickedPos();
|
||||
Direction[] directions = ctx.getNearestLookingDirections();
|
||||
|
@ -47,7 +48,7 @@ public abstract class BaseAttachedBlock extends BaseBlockNotFull {
|
|||
|
||||
@Override
|
||||
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
|
||||
Direction direction = (Direction) state.getValue(FACING);
|
||||
Direction direction = state.getValue(FACING);
|
||||
BlockPos blockPos = pos.relative(direction.getOpposite());
|
||||
return canSupportCenter(world, blockPos, direction) || world.getBlockState(blockPos).is(BlockTags.LEAVES);
|
||||
}
|
||||
|
|
|
@ -46,11 +46,12 @@ public class BaseBarrelBlock extends BarrelBlock implements BlockModelProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(BlockGetter world) {
|
||||
return BaseBlockEntities.BARREL.create();
|
||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
return BaseBlockEntities.BARREL.create(blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
List<ItemStack> drop = super.getDrops(state, builder);
|
||||
drop.add(new ItemStack(this.asItem()));
|
||||
|
|
|
@ -17,6 +17,7 @@ public class BaseBlock extends Block implements BlockModelProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package ru.bclib.blocks;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.block.BaseEntityBlock;
|
||||
|
@ -16,11 +17,12 @@ public class BaseBlockWithEntity extends BaseEntityBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(BlockGetter world) {
|
||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ public abstract class BaseButtonBlock extends ButtonBlock implements BlockModelP
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
|
|
@ -29,10 +29,11 @@ import ru.bclib.interfaces.IRenderTyped;
|
|||
|
||||
public class BaseChainBlock extends ChainBlock implements BlockModelProvider, IRenderTyped {
|
||||
public BaseChainBlock(MaterialColor color) {
|
||||
super(FabricBlockSettings.copyOf(Blocks.CHAIN).materialColor(color));
|
||||
super(FabricBlockSettings.copyOf(Blocks.CHAIN).mapColor(color));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package ru.bclib.blocks;
|
|||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
|
@ -33,12 +34,12 @@ public class BaseChestBlock extends ChestBlock implements BlockModelProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(BlockGetter world)
|
||||
{
|
||||
return BaseBlockEntities.CHEST.create();
|
||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
return BaseBlockEntities.CHEST.create(blockPos, blockState);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder)
|
||||
{
|
||||
List<ItemStack> drop = super.getDrops(state, builder);
|
||||
|
|
|
@ -28,8 +28,9 @@ public class BaseComposterBlock extends ComposterBlock implements BlockModelProv
|
|||
public BaseComposterBlock(Block source) {
|
||||
super(FabricBlockSettings.copyOf(source));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this.asItem()));
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ public class BaseCraftingTableBlock extends CraftingTableBlock implements BlockM
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this.asItem()));
|
||||
}
|
||||
|
|
|
@ -106,8 +106,9 @@ public class BaseCropBlock extends BasePlantBlock {
|
|||
public boolean isBonemealSuccess(Level world, Random random, BlockPos pos, BlockState state) {
|
||||
return state.getValue(AGE) < 3;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
super.tick(state, world, pos, random);
|
||||
if (isBonemealSuccess(world, random, pos, state) && random.nextInt(8) == 0) {
|
||||
|
|
|
@ -36,6 +36,7 @@ public class BaseDoorBlock extends DoorBlock implements IRenderTyped, BlockModel
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
if (state.getValue(HALF) == DoubleBlockHalf.LOWER)
|
||||
return Collections.singletonList(new ItemStack(this.asItem()));
|
||||
|
|
|
@ -38,6 +38,7 @@ import ru.bclib.client.render.BCLRenderLayer;
|
|||
import ru.bclib.interfaces.IRenderTyped;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public abstract class BaseDoublePlantBlock extends BaseBlockNotFull implements IRenderTyped, BonemealableBlock {
|
||||
private static final VoxelShape SHAPE = Block.box(4, 2, 4, 12, 16, 12);
|
||||
public static final IntegerProperty ROTATION = BlockProperties.ROTATION;
|
||||
|
@ -110,7 +111,7 @@ public abstract class BaseDoublePlantBlock extends BaseBlockNotFull implements I
|
|||
}
|
||||
|
||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||
if (tool != null && tool.getItem().is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
if (tool != null && FabricToolTags.SHEARS.contains(tool.getItem()) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
return Lists.newArrayList(new ItemStack(this));
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -35,6 +35,7 @@ public class BaseFenceBlock extends FenceBlock implements BlockModelProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ public class BaseFurnaceBlock extends FurnaceBlock implements BlockModelProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(BlockGetter world) {
|
||||
return new BaseFurnaceBlockEntity();
|
||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
return new BaseFurnaceBlockEntity(blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -95,8 +95,9 @@ public class BaseFurnaceBlock extends FurnaceBlock implements BlockModelProvider
|
|||
public BCLRenderLayer getRenderLayer() {
|
||||
return BCLRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
List<ItemStack> drop = Lists.newArrayList(new ItemStack(this));
|
||||
BlockEntity blockEntity = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY);
|
||||
|
|
|
@ -33,6 +33,7 @@ public class BaseGateBlock extends FenceGateBlock implements BlockModelProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ import ru.bclib.client.render.BCLRenderLayer;
|
|||
import ru.bclib.interfaces.IRenderTyped;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class BaseLadderBlock extends BaseBlockNotFull implements IRenderTyped, BlockModelProvider {
|
||||
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
|
||||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
||||
|
@ -57,17 +58,14 @@ public class BaseLadderBlock extends BaseBlockNotFull implements IRenderTyped, B
|
|||
stateManager.add(WATERLOGGED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
switch (state.getValue(FACING)) {
|
||||
case SOUTH:
|
||||
return SOUTH_SHAPE;
|
||||
case WEST:
|
||||
return WEST_SHAPE;
|
||||
case EAST:
|
||||
return EAST_SHAPE;
|
||||
default:
|
||||
return NORTH_SHAPE;
|
||||
}
|
||||
return switch (state.getValue(FACING)) {
|
||||
case SOUTH -> SOUTH_SHAPE;
|
||||
case WEST -> WEST_SHAPE;
|
||||
case EAST -> EAST_SHAPE;
|
||||
default -> NORTH_SHAPE;
|
||||
};
|
||||
}
|
||||
|
||||
private boolean canPlaceOn(BlockGetter world, BlockPos pos, Direction side) {
|
||||
|
@ -78,7 +76,7 @@ public class BaseLadderBlock extends BaseBlockNotFull implements IRenderTyped, B
|
|||
@Override
|
||||
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
|
||||
Direction direction = state.getValue(FACING);
|
||||
return this.canPlaceOn(world, pos.relative(direction.getOpposite()), direction);
|
||||
return canPlaceOn(world, pos.relative(direction.getOpposite()), direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,7 +29,7 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
|
|||
|
||||
public BaseLeavesBlock(Block sapling, MaterialColor color) {
|
||||
super(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES)
|
||||
.materialColor(color)
|
||||
.mapColor(color)
|
||||
.breakByTool(FabricToolTags.HOES)
|
||||
.breakByTool(FabricToolTags.SHEARS)
|
||||
.breakByHand(true)
|
||||
|
@ -41,7 +41,7 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
|
|||
|
||||
public BaseLeavesBlock(Block sapling, MaterialColor color, int light) {
|
||||
super(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES)
|
||||
.materialColor(color)
|
||||
.mapColor(color)
|
||||
.luminance(light)
|
||||
.breakByTool(FabricToolTags.HOES)
|
||||
.breakByTool(FabricToolTags.SHEARS)
|
||||
|
@ -55,12 +55,13 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
|
|||
public BCLRenderLayer getRenderLayer() {
|
||||
return BCLRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||
if (tool != null) {
|
||||
if (tool.getItem().is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
if (FabricToolTags.SHEARS.contains(tool.getItem()) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
int fortune = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.BLOCK_FORTUNE, tool);
|
||||
|
|
|
@ -34,6 +34,7 @@ public class BaseMetalBarsBlock extends IronBarsBlock implements BlockModelProvi
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
@ -99,7 +100,7 @@ public class BaseMetalBarsBlock extends IronBarsBlock implements BlockModelProvi
|
|||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public boolean skipRendering(BlockState state, BlockState stateFrom, Direction direction) {
|
||||
if (direction.getAxis().isVertical() && stateFrom.getBlock().is(this) && !stateFrom.equals(state)) {
|
||||
if (direction.getAxis().isVertical() && stateFrom.getBlock() == this && !stateFrom.equals(state)) {
|
||||
return false;
|
||||
}
|
||||
return super.skipRendering(state, stateFrom, direction);
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
|||
import net.minecraft.client.renderer.block.model.BlockModel;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.valueproviders.UniformInt;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
|
@ -26,26 +27,20 @@ public class BaseOreBlock extends OreBlock implements BlockModelProvider {
|
|||
private final Item dropItem;
|
||||
private final int minCount;
|
||||
private final int maxCount;
|
||||
private final int experience;
|
||||
|
||||
public BaseOreBlock(Item drop, int minCount, int maxCount, int experience) {
|
||||
super(FabricBlockSettings.of(Material.STONE, MaterialColor.SAND)
|
||||
.hardness(3F)
|
||||
.resistance(9F)
|
||||
.requiresCorrectToolForDrops()
|
||||
.sound(SoundType.STONE));
|
||||
.sound(SoundType.STONE), UniformInt.of(1, experience));
|
||||
this.dropItem = drop;
|
||||
this.minCount = minCount;
|
||||
this.maxCount = maxCount;
|
||||
this.experience = experience;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int xpOnDrop(Random random) {
|
||||
return this.experience > 0 ? random.nextInt(experience) + 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||
if (tool != null && tool.isCorrectToolForDrops(state)) {
|
||||
|
|
|
@ -33,6 +33,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
|||
import ru.bclib.client.render.BCLRenderLayer;
|
||||
import ru.bclib.interfaces.IRenderTyped;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public abstract class BasePlantBlock extends BaseBlockNotFull implements IRenderTyped, BonemealableBlock {
|
||||
private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 14, 12);
|
||||
|
||||
|
@ -97,7 +98,7 @@ public abstract class BasePlantBlock extends BaseBlockNotFull implements IRender
|
|||
@Override
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||
if (tool != null && tool.getItem().is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
if (tool != null && FabricToolTags.SHEARS.contains(tool.getItem()) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
return Lists.newArrayList(new ItemStack(this));
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -53,8 +53,9 @@ public abstract class BasePlantWithAgeBlock extends BasePlantBlock {
|
|||
public boolean isBonemealSuccess(Level world, Random random, BlockPos pos, BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
super.tick(state, world, pos, random);
|
||||
if (random.nextInt(8) == 0) {
|
||||
|
|
|
@ -33,6 +33,7 @@ public class BasePressurePlateBlock extends PressurePlateBlock implements BlockM
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
|
|
@ -30,8 +30,9 @@ public class BaseRotatedPillarBlock extends RotatedPillarBlock implements BlockM
|
|||
public BaseRotatedPillarBlock(Block block) {
|
||||
super(FabricBlockSettings.copyOf(block));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ import ru.bclib.client.models.ModelsHelper;
|
|||
import ru.bclib.interfaces.ISpetialItem;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class BaseSignBlock extends SignBlock implements BlockModelProvider, ISpetialItem {
|
||||
public static final IntegerProperty ROTATION = BlockStateProperties.ROTATION_16;
|
||||
public static final BooleanProperty FLOOR = BooleanProperty.create("floor");
|
||||
|
|
|
@ -35,6 +35,7 @@ public class BaseSlabBlock extends SlabBlock implements BlockModelProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ public class BaseStairsBlock extends StairBlock implements BlockModelProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
|
|
@ -20,13 +20,14 @@ public class BaseStripableLogBlock extends BaseRotatedPillarBlock {
|
|||
private final Block striped;
|
||||
|
||||
public BaseStripableLogBlock(MaterialColor color, Block striped) {
|
||||
super(FabricBlockSettings.copyOf(striped).materialColor(color));
|
||||
super(FabricBlockSettings.copyOf(striped).mapColor(color));
|
||||
this.striped = striped;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
if (player.getMainHandItem().getItem().is(FabricToolTags.AXES)) {
|
||||
if (FabricToolTags.AXES.contains(player.getMainHandItem().getItem())) {
|
||||
world.playSound(player, pos, SoundEvents.AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
if (!world.isClientSide) {
|
||||
world.setBlock(pos, striped.defaultBlockState().setValue(RotatedPillarBlock.AXIS, state.getValue(RotatedPillarBlock.AXIS)), 11);
|
||||
|
|
|
@ -67,7 +67,7 @@ public class BaseTerrainBlock extends BaseBlock {
|
|||
|
||||
@Override
|
||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
if (pathBlock != null && player.getMainHandItem().getItem().is(FabricToolTags.SHOVELS)) {
|
||||
if (pathBlock != null && FabricToolTags.SHOVELS.contains(player.getMainHandItem().getItem())) {
|
||||
world.playSound(player, pos, SoundEvents.SHOVEL_FLATTEN, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
if (!world.isClientSide) {
|
||||
world.setBlockAndUpdate(pos, pathBlock.defaultBlockState());
|
||||
|
|
|
@ -34,6 +34,7 @@ public class BaseTrapdoorBlock extends TrapDoorBlock implements IRenderTyped, Bl
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ public abstract class BaseUnderwaterWallPlantBlock extends BaseWallPlantBlock im
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return Fluids.WATER.getSource(false);
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ import ru.bclib.client.render.BCLRenderLayer;
|
|||
import ru.bclib.interfaces.IRenderTyped;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class BaseVineBlock extends BaseBlockNotFull implements IRenderTyped, BonemealableBlock {
|
||||
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
|
||||
private static final VoxelShape VOXEL_SHAPE = Block.box(2, 0, 2, 14, 16, 14);
|
||||
|
@ -106,7 +107,7 @@ public class BaseVineBlock extends BaseBlockNotFull implements IRenderTyped, Bon
|
|||
@Override
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||
if (tool != null && tool.getItem().is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
if (tool != null && FabricToolTags.SHEARS.contains(tool.getItem()) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
return Lists.newArrayList(new ItemStack(this));
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -36,6 +36,7 @@ public class BaseWallBlock extends WallBlock implements BlockModelProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
|
|
@ -113,11 +113,13 @@ public abstract class BaseWallPlantBlock extends BasePlantBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public BlockState rotate(BlockState state, Rotation rotation) {
|
||||
return BlocksHelper.rotateHorizontal(state, rotation, FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public BlockState mirror(BlockState state, Mirror mirror) {
|
||||
return BlocksHelper.mirrorHorizontal(state, mirror, FACING);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ public class BaseWeightedPlateBlock extends WeightedPressurePlateBlock implement
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
|
@ -36,6 +37,7 @@ import ru.bclib.client.models.PatternsHelper;
|
|||
import ru.bclib.client.render.BCLRenderLayer;
|
||||
import ru.bclib.interfaces.IRenderTyped;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public abstract class FeatureSaplingBlock extends SaplingBlock implements IRenderTyped, BlockModelProvider {
|
||||
private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 14, 12);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ public class SimpleLeavesBlock extends BaseBlockNotFull implements IRenderTyped
|
|||
public SimpleLeavesBlock(MaterialColor color) {
|
||||
super(FabricBlockSettings.of(Material.LEAVES)
|
||||
.strength(0.2F)
|
||||
.materialColor(color)
|
||||
.mapColor(color)
|
||||
.sound(SoundType.GRASS)
|
||||
.noOcclusion()
|
||||
.isValidSpawn((state, world, pos, type) -> false)
|
||||
|
@ -22,7 +22,7 @@ public class SimpleLeavesBlock extends BaseBlockNotFull implements IRenderTyped
|
|||
public SimpleLeavesBlock(MaterialColor color, int light) {
|
||||
super(FabricBlockSettings.of(Material.LEAVES)
|
||||
.luminance(light)
|
||||
.materialColor(color)
|
||||
.mapColor(color)
|
||||
.strength(0.2F)
|
||||
.sound(SoundType.GRASS)
|
||||
.noOcclusion()
|
||||
|
|
|
@ -43,6 +43,7 @@ import ru.bclib.client.models.PatternsHelper;
|
|||
import ru.bclib.client.render.BCLRenderLayer;
|
||||
import ru.bclib.interfaces.IRenderTyped;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class StalactiteBlock extends BaseBlockNotFull implements SimpleWaterloggedBlock, LiquidBlockContainer, IRenderTyped {
|
||||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
||||
public static final BooleanProperty IS_FLOOR = BlockProperties.IS_FLOOR;
|
||||
|
|
|
@ -20,13 +20,14 @@ public class StripableBarkBlock extends BaseBarkBlock {
|
|||
private final Block striped;
|
||||
|
||||
public StripableBarkBlock(MaterialColor color, Block striped) {
|
||||
super(FabricBlockSettings.copyOf(striped).materialColor(color));
|
||||
super(FabricBlockSettings.copyOf(striped).mapColor(color));
|
||||
this.striped = striped;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
if (player.getMainHandItem().getItem().is(FabricToolTags.AXES)) {
|
||||
if (FabricToolTags.AXES.contains(player.getMainHandItem().getItem())) {
|
||||
world.playSound(player, pos, SoundEvents.AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
if (!world.isClientSide) {
|
||||
world.setBlock(pos, striped.defaultBlockState().setValue(RotatedPillarBlock.AXIS, state.getValue(RotatedPillarBlock.AXIS)), 11);
|
||||
|
|
|
@ -37,6 +37,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
|||
import ru.bclib.client.render.BCLRenderLayer;
|
||||
import ru.bclib.interfaces.IRenderTyped;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public abstract class UnderwaterPlantBlock extends BaseBlockNotFull implements IRenderTyped, BonemealableBlock, LiquidBlockContainer {
|
||||
private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 14, 12);
|
||||
|
||||
|
@ -95,7 +96,7 @@ public abstract class UnderwaterPlantBlock extends BaseBlockNotFull implements I
|
|||
@Override
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||
if (tool != null && tool.getItem().is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
if (tool != null && FabricToolTags.SHEARS.contains(tool.getItem()) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
return Lists.newArrayList(new ItemStack(this));
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -47,6 +47,7 @@ public abstract class UnderwaterPlantWithAgeBlock extends UnderwaterPlantBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
super.tick(state, world, pos, random);
|
||||
if (isBonemealSuccess(world, random, pos, state)) {
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
|||
import ru.bclib.client.render.BCLRenderLayer;
|
||||
import ru.bclib.interfaces.IRenderTyped;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public abstract class UpDownPlantBlock extends BaseBlockNotFull implements IRenderTyped {
|
||||
private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 16, 12);
|
||||
|
||||
|
@ -71,7 +72,7 @@ public abstract class UpDownPlantBlock extends BaseBlockNotFull implements IRend
|
|||
@Override
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||
if (tool != null && tool.getItem().is(FabricToolTags.SHEARS) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
if (tool != null && FabricToolTags.SHEARS.contains(tool.getItem()) || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) > 0) {
|
||||
return Lists.newArrayList(new ItemStack(this));
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue