Update to BCLib 0.5.0 and new Fabric API

This commit is contained in:
paulevsGitch 2021-11-06 16:45:43 +03:00
parent 1d333071dc
commit a9d1082ed2
72 changed files with 167 additions and 306 deletions

View file

@ -6,7 +6,7 @@ minecraft_version=1.17.1
yarn_mappings=6 yarn_mappings=6
loader_version=0.12.4 loader_version=0.12.4
# Mod Properties # Mod Properties
mod_version=0.12.2 mod_version=0.13.0
maven_group=ru.betterend maven_group=ru.betterend
archives_base_name=better-end archives_base_name=better-end
@ -15,6 +15,6 @@ archives_base_name=better-end
patchouli_version = 55-FABRIC-SNAPSHOT patchouli_version = 55-FABRIC-SNAPSHOT
fabric_version = 0.41.3+1.17 fabric_version = 0.41.3+1.17
bclib_version = 0.4.4 bclib_version = 0.5.0
rei_version = 6.0.264-alpha rei_version = 6.0.264-alpha
canvas_version = 1.0.+ canvas_version = 1.0.+

View file

@ -60,7 +60,6 @@ public class BetterEnd implements ModInitializer {
LootTableUtil.init(); LootTableUtil.init();
FabricLoader.getInstance().getEntrypoints("betterend", BetterEndPlugin.class).forEach(BetterEndPlugin::register); FabricLoader.getInstance().getEntrypoints("betterend", BetterEndPlugin.class).forEach(BetterEndPlugin::register);
Integrations.init(); Integrations.init();
DataFixer.register();
Configs.saveConfigs(); Configs.saveConfigs();
if (GeneratorOptions.useNewGenerator()) { if (GeneratorOptions.useNewGenerator()) {

View file

@ -1,33 +0,0 @@
package ru.betterend;
import ru.bclib.api.datafixer.DataFixerAPI;
import ru.bclib.api.datafixer.Patch;
public class DataFixer {
public static void register() {
DataFixerAPI.registerPatch(() -> {
return new BetterEndPatch();
});
}
private static final class BetterEndPatch extends Patch {
protected BetterEndPatch() {
super(BetterEnd.MOD_ID, "0.11.0");
}
/*public PatchFunction<CompoundTag, Boolean> getLevelDatPatcher() {
return (root, profile) -> {
CompoundTag dimensions = root.getCompound("Data").getCompound("WorldGenSettings").getCompound("dimensions");
if (dimensions.contains("minecraft:the_end")) {
CompoundTag biomeSource = dimensions.getCompound("minecraft:the_end").getCompound("generator").getCompound("biome_source");
if (!biomeSource.getString("type").equals("betterend:better_end_biome_source")) {
BetterEnd.LOGGER.info("Applying biome source patch");
biomeSource.putString("type", "betterend:better_end_biome_source");
return true;
}
}
return false;
};
}*/
}
}

View file

@ -7,6 +7,6 @@ import ru.bclib.blocks.BaseRotatedPillarBlock;
public class AmaranitaStemBlock extends BaseRotatedPillarBlock { public class AmaranitaStemBlock extends BaseRotatedPillarBlock {
public AmaranitaStemBlock() { public AmaranitaStemBlock() {
super(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).materialColor(MaterialColor.COLOR_LIGHT_GREEN)); super(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).mapColor(MaterialColor.COLOR_LIGHT_GREEN));
} }
} }

View file

@ -7,6 +7,6 @@ import ru.bclib.blocks.BaseBlock;
public class AmberBlock extends BaseBlock { public class AmberBlock extends BaseBlock {
public AmberBlock() { public AmberBlock() {
super(FabricBlockSettings.copyOf(Blocks.DIAMOND_BLOCK).materialColor(MaterialColor.COLOR_YELLOW)); super(FabricBlockSettings.copyOf(Blocks.DIAMOND_BLOCK).mapColor(MaterialColor.COLOR_YELLOW));
} }
} }

View file

@ -29,6 +29,7 @@ public class AncientEmeraldIceBlock extends BaseBlock {
} }
@Override @Override
@SuppressWarnings("deprecation")
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) { public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
Direction dir = BlocksHelper.randomDirection(random); Direction dir = BlocksHelper.randomDirection(random);

View file

@ -93,6 +93,7 @@ public class AuroraCrystalBlock extends AbstractGlassBlock implements RenderLaye
} }
@Override @Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) { public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL); ItemStack tool = builder.getParameter(LootContextParams.TOOL);
if (tool != null && tool.isCorrectToolForDrops(state)) { if (tool != null && tool.isCorrectToolForDrops(state)) {

View file

@ -29,11 +29,13 @@ public class BlueVineLanternBlock extends BaseBlock {
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return !state.getValue(NATURAL) || world.getBlockState(pos.below()).getBlock() == EndBlocks.BLUE_VINE; return !state.getValue(NATURAL) || world.getBlockState(pos.below()).getBlock() == EndBlocks.BLUE_VINE;
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
if (!canSurvive(state, world, pos)) { if (!canSurvive(state, world, pos)) {
return Blocks.AIR.defaultBlockState(); return Blocks.AIR.defaultBlockState();

View file

@ -28,7 +28,7 @@ public class BrimstoneBlock extends BaseBlock {
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE; public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE;
public BrimstoneBlock() { public BrimstoneBlock() {
super(FabricBlockSettings.copyOf(Blocks.END_STONE).materialColor(MaterialColor.COLOR_BROWN).randomTicks()); super(FabricBlockSettings.copyOf(Blocks.END_STONE).mapColor(MaterialColor.COLOR_BROWN).randomTicks());
registerDefaultState(stateDefinition.any().setValue(ACTIVATED, false)); registerDefaultState(stateDefinition.any().setValue(ACTIVATED, false));
} }
@ -64,6 +64,7 @@ public class BrimstoneBlock extends BaseBlock {
} }
@Override @Override
@SuppressWarnings("deprecation")
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) { public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
boolean deactivate = true; boolean deactivate = true;
for (Direction dir : BlocksHelper.DIRECTIONS) { for (Direction dir : BlocksHelper.DIRECTIONS) {

View file

@ -36,7 +36,7 @@ public class BulbVineLanternBlock extends EndLanternBlock implements RenderLayer
.hardness(1) .hardness(1)
.resistance(1) .resistance(1)
.breakByTool(FabricToolTags.PICKAXES) .breakByTool(FabricToolTags.PICKAXES)
.materialColor(MaterialColor.COLOR_LIGHT_GRAY) .mapColor(MaterialColor.COLOR_LIGHT_GRAY)
.luminance(15) .luminance(15)
.requiresCorrectToolForDrops() .requiresCorrectToolForDrops()
.sound(SoundType.LANTERN)); .sound(SoundType.LANTERN));
@ -47,6 +47,7 @@ public class BulbVineLanternBlock extends EndLanternBlock implements RenderLayer
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) { public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
return state.getValue(IS_FLOOR) ? SHAPE_FLOOR : SHAPE_CEIL; return state.getValue(IS_FLOOR) ? SHAPE_FLOOR : SHAPE_CEIL;
} }

View file

@ -43,6 +43,7 @@ public class CavePumpkinBlock extends BaseBlockNotFull implements RenderLayerPro
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
return state.getValue(SMALL) ? SHAPE_SMALL : SHAPE_BIG; return state.getValue(SMALL) ? SHAPE_SMALL : SHAPE_BIG;
} }

View file

@ -45,6 +45,7 @@ public class ChandelierBlock extends BaseAttachedBlock implements RenderLayerPro
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) { public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
return BOUNDING_SHAPES.get(state.getValue(FACING)); return BOUNDING_SHAPES.get(state.getValue(FACING));
} }

View file

@ -15,6 +15,7 @@ public class DragonTreeSaplingBlock extends PottableFeatureSapling {
} }
@Override @Override
@SuppressWarnings("deprecation")
protected Feature<?> getFeature() { protected Feature<?> getFeature() {
return EndFeatures.DRAGON_TREE.getFeature(); return EndFeatures.DRAGON_TREE.getFeature();
} }

View file

@ -57,6 +57,7 @@ public class EmeraldIceBlock extends HalfTransparentBlock implements RenderLayer
} }
@Override @Override
@SuppressWarnings("deprecation")
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) { public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
if (world.getBrightness(LightLayer.BLOCK, pos) > 11 - state.getLightBlock(world, pos)) { if (world.getBrightness(LightLayer.BLOCK, pos) > 11 - state.getLightBlock(world, pos)) {
this.melt(state, world, pos); this.melt(state, world, pos);
@ -75,6 +76,7 @@ public class EmeraldIceBlock extends HalfTransparentBlock implements RenderLayer
} }
@Override @Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) { public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
ItemStack tool = builder.getOptionalParameter(LootContextParams.TOOL); ItemStack tool = builder.getOptionalParameter(LootContextParams.TOOL);
if (tool != null && EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) != 0) { if (tool != null && EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) != 0) {

View file

@ -44,6 +44,7 @@ public class EndLotusFlowerBlock extends EndPlantBlock {
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getCollisionShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) { public VoxelShape getCollisionShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
return SHAPE_COLLISION; return SHAPE_COLLISION;
} }

View file

@ -38,6 +38,7 @@ public class EndLotusLeafBlock extends BaseBlockNotFull implements RenderLayerPr
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
BlockState down = world.getBlockState(pos.below()); BlockState down = world.getBlockState(pos.below());
return !down.getFluidState().isEmpty() && down.getFluidState().getType() instanceof WaterFluid; return !down.getFluidState().isEmpty() && down.getFluidState().getType() instanceof WaterFluid;
@ -49,16 +50,19 @@ public class EndLotusLeafBlock extends BaseBlockNotFull implements RenderLayerPr
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) { public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
return VSHAPE; return VSHAPE;
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState rotate(BlockState state, Rotation rotation) { public BlockState rotate(BlockState state, Rotation rotation) {
return BlocksHelper.rotateHorizontal(state, rotation, HORIZONTAL_FACING); return BlocksHelper.rotateHorizontal(state, rotation, HORIZONTAL_FACING);
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState mirror(BlockState state, Mirror mirror) { public BlockState mirror(BlockState state, Mirror mirror) {
return BlocksHelper.mirrorHorizontal(state, mirror, HORIZONTAL_FACING); return BlocksHelper.mirrorHorizontal(state, mirror, HORIZONTAL_FACING);
} }

View file

@ -47,6 +47,7 @@ public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlo
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) { public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
return state.getValue(LEAF) ? SHAPES.get(Axis.Y) : SHAPES.get(state.getValue(FACING).getAxis()); return state.getValue(LEAF) ? SHAPES.get(Axis.Y) : SHAPES.get(state.getValue(FACING).getAxis());
} }
@ -57,6 +58,7 @@ public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlo
} }
@Override @Override
@SuppressWarnings("deprecation")
public FluidState getFluidState(BlockState state) { public FluidState getFluidState(BlockState state) {
return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state);
} }
@ -71,16 +73,19 @@ public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlo
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState rotate(BlockState state, Rotation rotation) { public BlockState rotate(BlockState state, Rotation rotation) {
return BlocksHelper.rotateHorizontal(state, rotation, FACING); return BlocksHelper.rotateHorizontal(state, rotation, FACING);
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState mirror(BlockState state, Mirror mirror) { public BlockState mirror(BlockState state, Mirror mirror) {
return BlocksHelper.mirrorHorizontal(state, mirror, FACING); return BlocksHelper.mirrorHorizontal(state, mirror, FACING);
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState updateShape(BlockState state, Direction direction, BlockState newState, LevelAccessor world, BlockPos pos, BlockPos posFrom) { public BlockState updateShape(BlockState state, Direction direction, BlockState newState, LevelAccessor world, BlockPos pos, BlockPos posFrom) {
if (state.getValue(WATERLOGGED)) { if (state.getValue(WATERLOGGED)) {
world.getLiquidTicks().scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); world.getLiquidTicks().scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world));

View file

@ -58,6 +58,7 @@ public class EndStoneSmelter extends BaseBlockWithEntity {
registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(LIT, false)); registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(LIT, false));
} }
@SuppressWarnings("deprecation")
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
if (world.isClientSide) { if (world.isClientSide) {
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
@ -102,11 +103,13 @@ public class EndStoneSmelter extends BaseBlockWithEntity {
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean hasAnalogOutputSignal(BlockState state) { public boolean hasAnalogOutputSignal(BlockState state) {
return true; return true;
} }
@Override @Override
@SuppressWarnings("deprecation")
public int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) { public int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) {
//TODO //TODO
return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(world.getBlockEntity(pos)); return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(world.getBlockEntity(pos));
@ -118,11 +121,13 @@ public class EndStoneSmelter extends BaseBlockWithEntity {
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState rotate(BlockState state, Rotation rotation) { public BlockState rotate(BlockState state, Rotation rotation) {
return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); return state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState mirror(BlockState state, Mirror mirror) { public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING))); return state.rotate(mirror.getRotation(state.getValue(FACING)));
} }

View file

@ -21,12 +21,15 @@ public class EndstoneDustBlock extends FallingBlock {
private static final int COLOR = ColorUtil.color(226, 239, 168); private static final int COLOR = ColorUtil.color(226, 239, 168);
public EndstoneDustBlock() { public EndstoneDustBlock() {
super(FabricBlockSettings.copyOf(Blocks.SAND) super(FabricBlockSettings
.breakByTool(FabricToolTags.SHOVELS) .copyOf(Blocks.SAND)
.materialColor(Blocks.END_STONE.defaultMaterialColor())); .breakByTool(FabricToolTags.SHOVELS)
.mapColor(Blocks.END_STONE.defaultMaterialColor())
);
} }
@Override @Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) { public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
return Collections.singletonList(new ItemStack(this)); return Collections.singletonList(new ItemStack(this));
} }

View file

@ -34,6 +34,7 @@ public class FilaluxWingsBlock extends BaseAttachedBlock implements RenderLayerP
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) { public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
return BOUNDING_SHAPES.get(state.getValue(FACING)); return BOUNDING_SHAPES.get(state.getValue(FACING));
} }

View file

@ -101,6 +101,7 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
int plantID = state.getValue(PLANT_ID); int plantID = state.getValue(PLANT_ID);
if (plantID < 1 || plantID > plants.length || plants[plantID - 1] == null) { if (plantID < 1 || plantID > plants.length || plants[plantID - 1] == null) {
@ -198,6 +199,7 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
} }
@Override @Override
@SuppressWarnings("deprecation")
public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
if (level.isClientSide) { if (level.isClientSide) {
return InteractionResult.CONSUME; return InteractionResult.CONSUME;
@ -421,12 +423,14 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) { public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
int id = state.getValue(PLANT_ID); int id = state.getValue(PLANT_ID);
return id > 0 && id <= plants.length ? SHAPE_FULL : SHAPE_EMPTY; return id > 0 && id <= plants.length ? SHAPE_FULL : SHAPE_EMPTY;
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getCollisionShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) { public VoxelShape getCollisionShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
return SHAPE_EMPTY; return SHAPE_EMPTY;
} }

View file

@ -22,7 +22,7 @@ public class GlowingPillarLuminophorBlock extends BaseBlock {
public GlowingPillarLuminophorBlock() { public GlowingPillarLuminophorBlock() {
super(FabricBlockSettings.of(Material.LEAVES) super(FabricBlockSettings.of(Material.LEAVES)
.materialColor(MaterialColor.COLOR_ORANGE) .mapColor(MaterialColor.COLOR_ORANGE)
.breakByTool(FabricToolTags.SHEARS) .breakByTool(FabricToolTags.SHEARS)
.strength(0.2F) .strength(0.2F)
.luminance(15) .luminance(15)
@ -31,11 +31,13 @@ public class GlowingPillarLuminophorBlock extends BaseBlock {
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return !state.getValue(NATURAL) || world.getBlockState(pos.below()).is(EndBlocks.GLOWING_PILLAR_ROOTS); return !state.getValue(NATURAL) || world.getBlockState(pos.below()).is(EndBlocks.GLOWING_PILLAR_ROOTS);
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
if (!canSurvive(state, world, pos)) { if (!canSurvive(state, world, pos)) {
return Blocks.AIR.defaultBlockState(); return Blocks.AIR.defaultBlockState();

View file

@ -1,10 +1,6 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import java.util.Collections;
import java.util.List;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags; import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.client.color.block.BlockColor; import net.minecraft.client.color.block.BlockColor;
@ -31,17 +27,22 @@ import ru.bclib.util.MHelper;
import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import java.util.Collections;
import java.util.List;
public class HelixTreeLeavesBlock extends BaseBlock implements CustomColorProvider { public class HelixTreeLeavesBlock extends BaseBlock implements CustomColorProvider {
public static final IntegerProperty COLOR = EndBlockProperties.COLOR; public static final IntegerProperty COLOR = EndBlockProperties.COLOR;
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0); private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0);
public HelixTreeLeavesBlock() { public HelixTreeLeavesBlock() {
super(FabricBlockSettings.of(Material.LEAVES) super(FabricBlockSettings
.materialColor(MaterialColor.COLOR_ORANGE) .of(Material.LEAVES)
.breakByTool(FabricToolTags.SHEARS) .mapColor(MaterialColor.COLOR_ORANGE)
.sound(SoundType.WART_BLOCK) .breakByTool(FabricToolTags.SHEARS)
.sound(SoundType.GRASS) .sound(SoundType.WART_BLOCK)
.strength(0.2F)); .sound(SoundType.GRASS)
.strength(0.2F)
);
TagAPI.addTags(this, TagAPI.BLOCK_LEAVES); TagAPI.addTags(this, TagAPI.BLOCK_LEAVES);
} }

View file

@ -11,6 +11,7 @@ import ru.betterend.registry.EndFeatures;
public class HelixTreeSaplingBlock extends PottableFeatureSapling { public class HelixTreeSaplingBlock extends PottableFeatureSapling {
@Override @Override
@SuppressWarnings("deprecation")
protected Feature<?> getFeature() { protected Feature<?> getFeature() {
return EndFeatures.HELIX_TREE.getFeature(); return EndFeatures.HELIX_TREE.getFeature();
} }

View file

@ -13,13 +13,16 @@ import ru.bclib.blocks.BaseBlock;
public class HydraluxPetalBlock extends BaseBlock { public class HydraluxPetalBlock extends BaseBlock {
public HydraluxPetalBlock() { public HydraluxPetalBlock() {
this(FabricBlockSettings.of(Material.PLANT) this(
.breakByTool(FabricToolTags.AXES) FabricBlockSettings
.breakByHand(true) .of(Material.PLANT)
.hardness(1) .breakByTool(FabricToolTags.AXES)
.resistance(1) .breakByHand(true)
.materialColor(MaterialColor.PODZOL) .hardness(1)
.sound(SoundType.WART_BLOCK)); .resistance(1)
.mapColor(MaterialColor.PODZOL)
.sound(SoundType.WART_BLOCK)
);
} }
public HydraluxPetalBlock(Properties settings) { public HydraluxPetalBlock(Properties settings) {

View file

@ -66,6 +66,7 @@ public class JellyshroomCapBlock extends SlimeBlock implements RenderLayerProvid
} }
@Override @Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) { public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
return Lists.newArrayList(new ItemStack(this)); return Lists.newArrayList(new ItemStack(this));
} }

View file

@ -15,6 +15,7 @@ public class LacugroveSaplingBlock extends PottableFeatureSapling {
} }
@Override @Override
@SuppressWarnings("deprecation")
protected Feature<?> getFeature() { protected Feature<?> getFeature() {
return EndFeatures.LACUGROVE.getFeature(); return EndFeatures.LACUGROVE.getFeature();
} }

View file

@ -15,6 +15,7 @@ public class LucerniaSaplingBlock extends PottableFeatureSapling {
} }
@Override @Override
@SuppressWarnings("deprecation")
protected Feature<?> getFeature() { protected Feature<?> getFeature() {
return EndFeatures.LUCERNIA.getFeature(); return EndFeatures.LUCERNIA.getFeature();
} }

View file

@ -15,6 +15,7 @@ public class MossyGlowshroomSaplingBlock extends PottableFeatureSapling {
} }
@Override @Override
@SuppressWarnings("deprecation")
protected Feature<?> getFeature() { protected Feature<?> getFeature() {
return EndFeatures.MOSSY_GLOWSHROOM.getFeature(); return EndFeatures.MOSSY_GLOWSHROOM.getFeature();
} }

View file

@ -35,12 +35,14 @@ public class MossyObsidian extends BaseBlock {
} }
@Override @Override
@SuppressWarnings("deprecation")
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) { public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
if (random.nextInt(16) == 0 && !canSurvive(state, world, pos)) { if (random.nextInt(16) == 0 && !canSurvive(state, world, pos)) {
world.setBlockAndUpdate(pos, Blocks.OBSIDIAN.defaultBlockState()); world.setBlockAndUpdate(pos, Blocks.OBSIDIAN.defaultBlockState());
} }
} }
@SuppressWarnings("deprecation")
public boolean canSurvive(BlockState state, LevelReader worldView, BlockPos pos) { public boolean canSurvive(BlockState state, LevelReader worldView, BlockPos pos) {
BlockPos blockPos = pos.above(); BlockPos blockPos = pos.above();
BlockState blockState = worldView.getBlockState(blockPos); BlockState blockState = worldView.getBlockState(blockPos);

View file

@ -29,6 +29,7 @@ public class MurkweedBlock extends EndPlantBlock {
} }
@Override @Override
@SuppressWarnings("deprecation")
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
if (entity instanceof LivingEntity && !((LivingEntity) entity).hasEffect(MobEffects.BLINDNESS)) { if (entity instanceof LivingEntity && !((LivingEntity) entity).hasEffect(MobEffects.BLINDNESS)) {
((LivingEntity) entity).addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 50)); ((LivingEntity) entity).addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 50));
@ -41,6 +42,7 @@ public class MurkweedBlock extends EndPlantBlock {
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type) { public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type) {
return false; return false;
} }

View file

@ -24,6 +24,7 @@ import java.util.List;
public class NeedlegrassBlock extends EndPlantBlock { public class NeedlegrassBlock extends EndPlantBlock {
@Override @Override
@SuppressWarnings("deprecation")
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
entity.hurt(DamageSource.CACTUS, 0.1F); entity.hurt(DamageSource.CACTUS, 0.1F);
@ -50,6 +51,7 @@ public class NeedlegrassBlock extends EndPlantBlock {
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type) { public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type) {
return false; return false;
} }

View file

@ -15,6 +15,7 @@ public class PythadendronSaplingBlock extends PottableFeatureSapling {
} }
@Override @Override
@SuppressWarnings("deprecation")
protected Feature<?> getFeature() { protected Feature<?> getFeature() {
return EndFeatures.PYTHADENDRON_TREE.getFeature(); return EndFeatures.PYTHADENDRON_TREE.getFeature();
} }

View file

@ -58,6 +58,7 @@ public class RespawnObeliskBlock extends BaseBlock implements CustomColorProvide
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) { public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
return (state.getValue(SHAPE) == TripleShape.BOTTOM) ? VOXEL_SHAPE_BOTTOM : VOXEL_SHAPE_MIDDLE_TOP; return (state.getValue(SHAPE) == TripleShape.BOTTOM) ? VOXEL_SHAPE_BOTTOM : VOXEL_SHAPE_MIDDLE_TOP;
} }
@ -68,6 +69,7 @@ public class RespawnObeliskBlock extends BaseBlock implements CustomColorProvide
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
if (!world.getBlockState(pos.above(i)).getMaterial().isReplaceable()) { if (!world.getBlockState(pos.above(i)).getMaterial().isReplaceable()) {
@ -86,6 +88,7 @@ public class RespawnObeliskBlock extends BaseBlock implements CustomColorProvide
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
TripleShape shape = state.getValue(SHAPE); TripleShape shape = state.getValue(SHAPE);
if (shape == TripleShape.BOTTOM) { if (shape == TripleShape.BOTTOM) {
@ -156,6 +159,7 @@ public class RespawnObeliskBlock extends BaseBlock implements CustomColorProvide
} }
@Override @Override
@SuppressWarnings("deprecation")
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
ItemStack itemStack = player.getItemInHand(hand); ItemStack itemStack = player.getItemInHand(hand);
boolean canActivate = itemStack.getItem() == EndItems.AMBER_GEM && itemStack.getCount() > 5; boolean canActivate = itemStack.getItem() == EndItems.AMBER_GEM && itemStack.getCount() > 5;

View file

@ -63,16 +63,19 @@ public class SilkMothHiveBlock extends BaseBlock {
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState rotate(BlockState state, Rotation rotation) { public BlockState rotate(BlockState state, Rotation rotation) {
return BlocksHelper.rotateHorizontal(state, rotation, FACING); return BlocksHelper.rotateHorizontal(state, rotation, FACING);
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState mirror(BlockState state, Mirror mirror) { public BlockState mirror(BlockState state, Mirror mirror) {
return BlocksHelper.mirrorHorizontal(state, mirror, FACING); return BlocksHelper.mirrorHorizontal(state, mirror, FACING);
} }
@Override @Override
@SuppressWarnings("deprecation")
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) { public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
Direction dir = state.getValue(FACING); Direction dir = state.getValue(FACING);
BlockPos spawn = pos.relative(dir); BlockPos spawn = pos.relative(dir);
@ -94,6 +97,7 @@ public class SilkMothHiveBlock extends BaseBlock {
} }
@Override @Override
@SuppressWarnings("deprecation")
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
if (hand == InteractionHand.MAIN_HAND) { if (hand == InteractionHand.MAIN_HAND) {
ItemStack stack = player.getMainHandItem(); ItemStack stack = player.getMainHandItem();

View file

@ -71,6 +71,7 @@ public class SilkMothNestBlock extends BaseBlock implements RenderLayerProvider
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) { public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
return state.getValue(ACTIVE) ? BOTTOM : TOP; return state.getValue(ACTIVE) ? BOTTOM : TOP;
} }
@ -87,6 +88,7 @@ public class SilkMothNestBlock extends BaseBlock implements RenderLayerProvider
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
if (!state.getValue(ACTIVE)) { if (!state.getValue(ACTIVE)) {
if (canSupportCenter(world, pos.above(), Direction.DOWN) || world.getBlockState(pos.above()) if (canSupportCenter(world, pos.above(), Direction.DOWN) || world.getBlockState(pos.above())
@ -101,11 +103,13 @@ public class SilkMothNestBlock extends BaseBlock implements RenderLayerProvider
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState rotate(BlockState state, Rotation rotation) { public BlockState rotate(BlockState state, Rotation rotation) {
return BlocksHelper.rotateHorizontal(state, rotation, FACING); return BlocksHelper.rotateHorizontal(state, rotation, FACING);
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState mirror(BlockState state, Mirror mirror) { public BlockState mirror(BlockState state, Mirror mirror) {
return BlocksHelper.mirrorHorizontal(state, mirror, FACING); return BlocksHelper.mirrorHorizontal(state, mirror, FACING);
} }
@ -128,6 +132,7 @@ public class SilkMothNestBlock extends BaseBlock implements RenderLayerProvider
} }
@Override @Override
@SuppressWarnings("deprecation")
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) { public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
if (!state.getValue(ACTIVE)) { if (!state.getValue(ACTIVE)) {
return; return;
@ -155,6 +160,7 @@ public class SilkMothNestBlock extends BaseBlock implements RenderLayerProvider
} }
@Override @Override
@SuppressWarnings("deprecation")
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
if (hand == InteractionHand.MAIN_HAND) { if (hand == InteractionHand.MAIN_HAND) {
ItemStack stack = player.getMainHandItem(); ItemStack stack = player.getMainHandItem();

View file

@ -15,6 +15,7 @@ public class TenaneaSaplingBlock extends PottableFeatureSapling {
} }
@Override @Override
@SuppressWarnings("deprecation")
protected Feature<?> getFeature() { protected Feature<?> getFeature() {
return EndFeatures.TENANEA.getFeature(); return EndFeatures.TENANEA.getFeature();
} }

View file

@ -27,9 +27,11 @@ public class UmbrellaTreeClusterBlock extends BaseBlock {
public static final BooleanProperty NATURAL = BlockProperties.NATURAL; public static final BooleanProperty NATURAL = BlockProperties.NATURAL;
public UmbrellaTreeClusterBlock() { public UmbrellaTreeClusterBlock() {
super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK) super(FabricBlockSettings
.materialColor(MaterialColor.COLOR_PURPLE) .copyOf(Blocks.NETHER_WART_BLOCK)
.luminance(15)); .mapColor(MaterialColor.COLOR_PURPLE)
.luminance(15)
);
registerDefaultState(stateDefinition.any().setValue(NATURAL, false)); registerDefaultState(stateDefinition.any().setValue(NATURAL, false));
} }
@ -39,6 +41,7 @@ public class UmbrellaTreeClusterBlock extends BaseBlock {
} }
@Override @Override
@SuppressWarnings("deprecation")
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
ItemStack stack = player.getMainHandItem(); ItemStack stack = player.getMainHandItem();
if (stack.getItem() == Items.GLASS_BOTTLE) { if (stack.getItem() == Items.GLASS_BOTTLE) {

View file

@ -19,9 +19,11 @@ public class UmbrellaTreeClusterEmptyBlock extends BaseBlock {
public static final BooleanProperty NATURAL = EndBlockProperties.NATURAL; public static final BooleanProperty NATURAL = EndBlockProperties.NATURAL;
public UmbrellaTreeClusterEmptyBlock() { public UmbrellaTreeClusterEmptyBlock() {
super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK) super(FabricBlockSettings
.materialColor(MaterialColor.COLOR_PURPLE) .copyOf(Blocks.NETHER_WART_BLOCK)
.randomTicks()); .mapColor(MaterialColor.COLOR_PURPLE)
.randomTicks()
);
registerDefaultState(stateDefinition.any().setValue(NATURAL, false)); registerDefaultState(stateDefinition.any().setValue(NATURAL, false));
} }
@ -31,6 +33,7 @@ public class UmbrellaTreeClusterEmptyBlock extends BaseBlock {
} }
@Override @Override
@SuppressWarnings("deprecation")
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) { public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
if (state.getValue(NATURAL) && random.nextInt(16) == 0) { if (state.getValue(NATURAL) && random.nextInt(16) == 0) {
BlocksHelper.setWithUpdate( BlocksHelper.setWithUpdate(

View file

@ -55,6 +55,7 @@ public class UmbrellaTreeMembraneBlock extends SlimeBlock implements RenderLayer
} }
@Override @Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) { public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
if (state.getValue(COLOR) > 0) { if (state.getValue(COLOR) > 0) {
return Lists.newArrayList(new ItemStack(this)); return Lists.newArrayList(new ItemStack(this));

View file

@ -16,6 +16,7 @@ public class UmbrellaTreeSaplingBlock extends PottableFeatureSapling {
} }
@Override @Override
@SuppressWarnings("deprecation")
protected Feature<?> getFeature() { protected Feature<?> getFeature() {
return EndFeatures.UMBRELLA_TREE.getFeature(); return EndFeatures.UMBRELLA_TREE.getFeature();
} }

View file

@ -48,22 +48,26 @@ public class VentBubbleColumnBlock extends Block implements BucketPickup, Liquid
} }
@Override @Override
@SuppressWarnings("deprecation")
public RenderShape getRenderShape(BlockState state) { public RenderShape getRenderShape(BlockState state) {
return RenderShape.INVISIBLE; return RenderShape.INVISIBLE;
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
BlockState blockState = world.getBlockState(pos.below()); BlockState blockState = world.getBlockState(pos.below());
return blockState.is(this) || blockState.is(EndBlocks.HYDROTHERMAL_VENT); return blockState.is(this) || blockState.is(EndBlocks.HYDROTHERMAL_VENT);
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
return Shapes.empty(); return Shapes.empty();
} }
@Override @Override
@SuppressWarnings("deprecation")
public BlockState updateShape(BlockState state, Direction direction, BlockState newState, LevelAccessor world, BlockPos pos, BlockPos posFrom) { public BlockState updateShape(BlockState state, Direction direction, BlockState newState, LevelAccessor world, BlockPos pos, BlockPos posFrom) {
if (!state.canSurvive(world, pos)) { if (!state.canSurvive(world, pos)) {
return Blocks.WATER.defaultBlockState(); return Blocks.WATER.defaultBlockState();
@ -101,6 +105,7 @@ public class VentBubbleColumnBlock extends Block implements BucketPickup, Liquid
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
@SuppressWarnings("deprecation")
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
BlockState blockState = world.getBlockState(pos.above()); BlockState blockState = world.getBlockState(pos.above());
if (blockState.isAir()) { if (blockState.isAir()) {
@ -150,6 +155,7 @@ public class VentBubbleColumnBlock extends Block implements BucketPickup, Liquid
} }
@Override @Override
@SuppressWarnings("deprecation")
public FluidState getFluidState(BlockState state) { public FluidState getFluidState(BlockState state) {
return Fluids.WATER.getSource(false); return Fluids.WATER.getSource(false);
} }

View file

@ -1,11 +1,7 @@
package ru.betterend.blocks.basis; package ru.betterend.blocks.basis;
import java.util.EnumMap;
import java.util.List;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags; import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -29,6 +25,9 @@ import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.RenderLayerProvider; import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.util.MHelper; import ru.bclib.util.MHelper;
import java.util.EnumMap;
import java.util.List;
public class FurBlock extends BaseAttachedBlock implements RenderLayerProvider { public class FurBlock extends BaseAttachedBlock implements RenderLayerProvider {
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class); private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
private final ItemLike drop; private final ItemLike drop;
@ -58,6 +57,7 @@ public class FurBlock extends BaseAttachedBlock implements RenderLayerProvider {
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) { public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
return BOUNDING_SHAPES.get(state.getValue(FACING)); return BOUNDING_SHAPES.get(state.getValue(FACING));
} }

View file

@ -40,6 +40,7 @@ public class StoneLanternBlock extends EndLanternBlock implements CustomColorPro
} }
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) { public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
return state.getValue(IS_FLOOR) ? SHAPE_FLOOR : SHAPE_CEIL; return state.getValue(IS_FLOOR) ? SHAPE_FLOOR : SHAPE_CEIL;
} }

View file

@ -30,8 +30,7 @@ public class ColoredMaterial {
String id = Registry.BLOCK.getKey(source).getPath(); String id = Registry.BLOCK.getKey(source).getPath();
colors.forEach((color, name) -> { colors.forEach((color, name) -> {
String blockName = id + "_" + name; String blockName = id + "_" + name;
Block block = constructor.apply(FabricBlockSettings.copyOf(source) Block block = constructor.apply(FabricBlockSettings.copyOf(source).mapColor(MaterialColor.COLOR_BLACK));
.materialColor(MaterialColor.COLOR_BLACK));
EndBlocks.registerBlock(blockName, block); EndBlocks.registerBlock(blockName, block);
if (craftEight) { if (craftEight) {
GridRecipe.make(BetterEnd.MOD_ID, blockName, block) GridRecipe.make(BetterEnd.MOD_ID, blockName, block)

View file

@ -95,8 +95,7 @@ public class MetalMaterial {
return new MetalMaterial( return new MetalMaterial(
name, name,
true, true,
FabricBlockSettings.copyOf(Blocks.IRON_BLOCK) FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).mapColor(color),
.materialColor(color),
EndItems.makeEndItemSettings(), EndItems.makeEndItemSettings(),
material, material,
armor armor
@ -108,7 +107,7 @@ public class MetalMaterial {
name, name,
true, true,
FabricBlockSettings.copyOf(Blocks.IRON_BLOCK) FabricBlockSettings.copyOf(Blocks.IRON_BLOCK)
.materialColor(color) .mapColor(color)
.hardness(hardness) .hardness(hardness)
.resistance(resistance), .resistance(resistance),
EndItems.makeEndItemSettings(), EndItems.makeEndItemSettings(),
@ -121,8 +120,7 @@ public class MetalMaterial {
return new MetalMaterial( return new MetalMaterial(
name, name,
false, false,
FabricBlockSettings.copyOf(Blocks.IRON_BLOCK) FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).mapColor(color),
.materialColor(color),
EndItems.makeEndItemSettings(), EndItems.makeEndItemSettings(),
material, material,
armor armor
@ -134,7 +132,7 @@ public class MetalMaterial {
name, name,
false, false,
FabricBlockSettings.copyOf(Blocks.IRON_BLOCK) FabricBlockSettings.copyOf(Blocks.IRON_BLOCK)
.materialColor(color) .mapColor(color)
.hardness(hardness) .hardness(hardness)
.resistance(resistance), .resistance(resistance),
EndItems.makeEndItemSettings(), EndItems.makeEndItemSettings(),

View file

@ -47,7 +47,7 @@ public class StoneMaterial {
public final Block flowerPot; public final Block flowerPot;
public StoneMaterial(String name, MaterialColor color) { public StoneMaterial(String name, MaterialColor color) {
FabricBlockSettings material = FabricBlockSettings.copyOf(Blocks.END_STONE).materialColor(color); FabricBlockSettings material = FabricBlockSettings.copyOf(Blocks.END_STONE).mapColor(color);
stone = EndBlocks.registerBlock(name, new BaseBlock(material)); stone = EndBlocks.registerBlock(name, new BaseBlock(material));
polished = EndBlocks.registerBlock(name + "_polished", new BaseBlock(material)); polished = EndBlocks.registerBlock(name + "_polished", new BaseBlock(material));

View file

@ -6,8 +6,8 @@ import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.item.alchemy.Potion;
import net.minecraft.world.item.alchemy.Potions; import net.minecraft.world.item.alchemy.Potions;
import ru.bclib.mixin.common.PotionBrewingAccessor;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.mixin.common.PotionBrewingAccessor;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndItems; import ru.betterend.registry.EndItems;

View file

@ -1,10 +1,5 @@
package ru.betterend.integration.rei; package ru.betterend.integration.rei;
import java.util.Collections;
import java.util.Optional;
import org.jetbrains.annotations.NotNull;
import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.display.SimpleGridMenuDisplay; import me.shedaniel.rei.api.common.display.SimpleGridMenuDisplay;
import me.shedaniel.rei.api.common.display.basic.BasicDisplay; import me.shedaniel.rei.api.common.display.basic.BasicDisplay;
@ -12,8 +7,12 @@ import me.shedaniel.rei.api.common.util.EntryIngredients;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.Recipe;
import org.jetbrains.annotations.NotNull;
import ru.bclib.recipes.AnvilRecipe; import ru.bclib.recipes.AnvilRecipe;
import java.util.Collections;
import java.util.Optional;
public class REIAnvilDisplay extends BasicDisplay implements SimpleGridMenuDisplay { public class REIAnvilDisplay extends BasicDisplay implements SimpleGridMenuDisplay {
private final AnvilRecipe recipe; private final AnvilRecipe recipe;

View file

@ -1,11 +1,6 @@
package ru.betterend.integration.rei; package ru.betterend.integration.rei;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin; import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; import me.shedaniel.rei.api.client.registry.category.CategoryRegistry;
import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; import me.shedaniel.rei.api.client.registry.display.DisplayRegistry;
@ -29,6 +24,10 @@ import ru.betterend.recipe.builders.AlloyingRecipe;
import ru.betterend.recipe.builders.InfusionRecipe; import ru.betterend.recipe.builders.InfusionRecipe;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
//https://github.com/shedaniel/RoughlyEnoughItems/blob/6.x-1.17/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java //https://github.com/shedaniel/RoughlyEnoughItems/blob/6.x-1.17/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java
public class REIPlugin implements REIClientPlugin { public class REIPlugin implements REIClientPlugin {
public final static ResourceLocation PLUGIN_ID = BetterEnd.makeID("rei_plugin"); public final static ResourceLocation PLUGIN_ID = BetterEnd.makeID("rei_plugin");

View file

@ -1,8 +0,0 @@
package ru.betterend.interfaces;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.biome.Biome;
public interface IBiomeArray {
public void be_setBiome(Biome biome, BlockPos pos);
}

View file

@ -2,7 +2,6 @@ package ru.betterend.interfaces;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import ru.betterend.BetterEnd;
import ru.betterend.registry.EndItems; import ru.betterend.registry.EndItems;
public interface MultiModelItem { public interface MultiModelItem {

View file

@ -1,7 +1,5 @@
package ru.betterend.item.material; package ru.betterend.item.material;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.LazyLoadedValue; import net.minecraft.util.LazyLoadedValue;
@ -32,10 +30,11 @@ public enum EndArmorMaterial implements ArmorMaterial {
private final SoundEvent equipSound; private final SoundEvent equipSound;
private final float toughness; private final float toughness;
private final float knockbackResistance; private final float knockbackResistance;
@SuppressWarnings("deprecation")
private final LazyLoadedValue<Ingredient> repairIngredient; private final LazyLoadedValue<Ingredient> repairIngredient;
@SuppressWarnings("deprecation")
private EndArmorMaterial(String name, int durabilityMultiplier, int[] protectionAmounts, int enchantability, SoundEvent equipSound, float toughness, float knockbackResistance, Supplier<Ingredient> repairIngredient) { private EndArmorMaterial(String name, int durabilityMultiplier, int[] protectionAmounts, int enchantability, SoundEvent equipSound, float toughness, float knockbackResistance, Supplier<Ingredient> repairIngredient) {
this.name = name; this.name = name;
this.durabilityMultiplier = durabilityMultiplier; this.durabilityMultiplier = durabilityMultiplier;
this.protectionAmounts = protectionAmounts; this.protectionAmounts = protectionAmounts;

View file

@ -22,10 +22,11 @@ public enum EndToolMaterial implements Tier {
private final float attackDamage; private final float attackDamage;
private final int miningLevel; private final int miningLevel;
private final int enchantability; private final int enchantability;
@SuppressWarnings("deprecation")
private final LazyLoadedValue<Ingredient> repairIngredient; private final LazyLoadedValue<Ingredient> repairIngredient;
@SuppressWarnings("deprecation")
private EndToolMaterial(int miningLevel, int durability, float miningSpeed, float attackDamage, int enchantability, Supplier<Ingredient> repairIngredient) { private EndToolMaterial(int miningLevel, int durability, float miningSpeed, float attackDamage, int enchantability, Supplier<Ingredient> repairIngredient) {
this.durability = durability; this.durability = durability;
this.miningSpeed = miningSpeed; this.miningSpeed = miningSpeed;
this.attackDamage = attackDamage; this.attackDamage = attackDamage;

View file

@ -67,6 +67,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
private void placeGrownFlower(Level world, BlockPos pos, int age) {} private void placeGrownFlower(Level world, BlockPos pos, int age) {}
@Override @Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
if (GeneratorOptions.changeChorusPlant()) { if (GeneratorOptions.changeChorusPlant()) {
return state.getValue(ChorusFlowerBlock.AGE) == 5 ? SHAPE_HALF : SHAPE_FULL; return state.getValue(ChorusFlowerBlock.AGE) == 5 ? SHAPE_HALF : SHAPE_FULL;

View file

@ -1,132 +0,0 @@
package ru.betterend.mixin.common;
import net.minecraft.core.BlockPos;
import net.minecraft.util.BitStorage;
import net.minecraft.util.Mth;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.chunk.ChunkBiomeContainer;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import ru.betterend.BetterEnd;
import ru.betterend.integration.Integrations;
import ru.betterend.interfaces.IBiomeArray;
import java.lang.reflect.Field;
@Mixin(ChunkBiomeContainer.class)
public class ChunkBiomeContainerMixin implements IBiomeArray {
@Final
@Shadow
private Biome[] biomes;
@Final
@Shadow
private static int WIDTH_BITS;
@Final
@Shadow
private static int HORIZONTAL_MASK;
@Override
public void be_setBiome(Biome biome, BlockPos pos) {
int biomeX = pos.getX() >> 2;
int biomeY = pos.getY() >> 2;
int biomeZ = pos.getZ() >> 2;
int index = be_getArrayIndex(biomeX, biomeY, biomeZ);
if (Integrations.hasHydrogen() && be_shouldWriteToHydrogen()) {
try {
ChunkBiomeContainer self = (ChunkBiomeContainer) (Object) this;
BitStorage storage = be_getHydrogenStorage(self);
Biome[] palette = be_getHydrogenPalette(self);
int paletteIndex = be_getHydrogenPaletteIndex(biome, palette);
if (paletteIndex == -1) {
Biome[] newPalette = new Biome[palette.length + 1];
System.arraycopy(palette, 0, newPalette, 0, palette.length);
paletteIndex = palette.length;
palette = newPalette;
palette[paletteIndex] = biome;
be_setHydrogenPalette(self, palette);
}
try {
storage.set(index, paletteIndex);
}
catch (Exception e) {
int size = storage.getSize();
int bits = Mth.ceillog2(palette.length);
BitStorage newStorage = new BitStorage(bits, size);
for (int i = 0; i < size; i++) {
newStorage.set(i, storage.get(i));
}
storage = newStorage;
storage.set(index, paletteIndex);
be_setHydrogenStorage(self, storage);
}
}
catch (Exception e) {
BetterEnd.LOGGER.warning(e.getLocalizedMessage());
}
return;
}
biomes[index] = biome;
}
@Shadow
@Final
private int quartMinY;
@Shadow
@Final
private int quartHeight;
private boolean be_shouldWriteToHydrogen() {
try {
Field field = ChunkBiomeContainer.class.getDeclaredField("intArray");
return field != null;
}
catch (NoSuchFieldException e) {
return false;
}
}
private int be_getArrayIndex(int biomeX, int biomeY, int biomeZ) {
int i = biomeX & HORIZONTAL_MASK;
int j = Mth.clamp(biomeY - this.quartMinY, 0, this.quartHeight);
int k = biomeZ & HORIZONTAL_MASK;
return j << WIDTH_BITS + WIDTH_BITS | k << WIDTH_BITS | i;
}
private Field be_getField(String name) throws Exception {
Field field = ChunkBiomeContainer.class.getDeclaredField(name);
field.setAccessible(true);
return field;
}
private BitStorage be_getHydrogenStorage(ChunkBiomeContainer container) throws Exception {
return (BitStorage) be_getField("intArray").get(container);
}
private Biome[] be_getHydrogenPalette(ChunkBiomeContainer container) throws Exception {
return (Biome[]) be_getField("palette").get(container);
}
private int be_getHydrogenPaletteIndex(Biome biome, Biome[] palette) {
int index = -1;
for (int i = 0; i < palette.length; i++) {
if (palette[i] == biome) {
index = i;
break;
}
}
return index;
}
private void be_setHydrogenPalette(ChunkBiomeContainer container, Biome[] palette) throws Exception {
be_getField("palette").set(container, palette);
}
private void be_setHydrogenStorage(ChunkBiomeContainer container, BitStorage storage) throws Exception {
be_getField("intArray").set(container, storage);
}
}

View file

@ -1,14 +0,0 @@
package ru.betterend.mixin.common;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.block.ComposterBlock;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin(ComposterBlock.class)
public interface ComposterBlockAccessor {
@Invoker
static void callAdd(float levelIncreaseChance, ItemLike item) {
throw new AssertionError("@Invoker dummy body called");
}
}

View file

@ -1,7 +1,5 @@
package ru.betterend.mixin.common; package ru.betterend.mixin.common;
import java.util.Collection;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.tags.EntityTypeTags; import net.minecraft.tags.EntityTypeTags;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
@ -39,6 +37,8 @@ import ru.betterend.interfaces.MobEffectApplier;
import ru.betterend.item.CrystaliteArmor; import ru.betterend.item.CrystaliteArmor;
import ru.betterend.registry.EndAttributes; import ru.betterend.registry.EndAttributes;
import java.util.Collection;
@Mixin(value=LivingEntity.class, priority=200) @Mixin(value=LivingEntity.class, priority=200)
public abstract class LivingEntityMixin extends Entity { public abstract class LivingEntityMixin extends Entity {

View file

@ -1,7 +1,5 @@
package ru.betterend.mixin.common; package ru.betterend.mixin.common;
import java.util.Optional;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
@ -26,6 +24,8 @@ import ru.bclib.util.MHelper;
import ru.betterend.interfaces.FallFlyingItem; import ru.betterend.interfaces.FallFlyingItem;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import java.util.Optional;
@Mixin(value=Player.class, priority=200) @Mixin(value=Player.class, priority=200)
public abstract class PlayerMixin extends LivingEntity { public abstract class PlayerMixin extends LivingEntity {
protected PlayerMixin(EntityType<? extends LivingEntity> entityType, Level level) { protected PlayerMixin(EntityType<? extends LivingEntity> entityType, Level level) {

View file

@ -1,15 +0,0 @@
package ru.betterend.mixin.common;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.alchemy.Potion;
import net.minecraft.world.item.alchemy.PotionBrewing;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin(PotionBrewing.class)
public interface PotionBrewingAccessor {
@Invoker
static void callAddMix(Potion input, Item item, Potion output) {
throw new AssertionError("@Invoker dummy body called");
}
}

View file

@ -21,6 +21,7 @@ public class InfusionParticleType extends ParticleType<InfusionParticleType> imp
itemStack itemStack
), infusionParticleType -> infusionParticleType.itemStack); ), infusionParticleType -> infusionParticleType.itemStack);
@SuppressWarnings("deprecation")
public static final ParticleOptions.Deserializer<InfusionParticleType> PARAMETERS_FACTORY = new ParticleOptions.Deserializer<InfusionParticleType>() { public static final ParticleOptions.Deserializer<InfusionParticleType> PARAMETERS_FACTORY = new ParticleOptions.Deserializer<InfusionParticleType>() {
public InfusionParticleType fromCommand(ParticleType<InfusionParticleType> particleType, StringReader stringReader) throws CommandSyntaxException { public InfusionParticleType fromCommand(ParticleType<InfusionParticleType> particleType, StringReader stringReader) throws CommandSyntaxException {
stringReader.expect(' '); stringReader.expect(' ');

View file

@ -20,11 +20,11 @@ import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import ru.bclib.interfaces.UnknownReceipBookCategory; import ru.bclib.interfaces.UnknownReceipBookCategory;
import ru.bclib.recipes.BCLRecipeManager; import ru.bclib.recipes.BCLRecipeManager;
import ru.bclib.util.ItemUtil;
import ru.bclib.util.RecipeHelper;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.config.Configs; import ru.betterend.config.Configs;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.bclib.util.ItemUtil;
import ru.bclib.util.RecipeHelper;
public class AlloyingRecipe implements Recipe<Container>, UnknownReceipBookCategory { public class AlloyingRecipe implements Recipe<Container>, UnknownReceipBookCategory {
public final static String GROUP = "alloying"; public final static String GROUP = "alloying";

View file

@ -1,9 +1,6 @@
package ru.betterend.recipe.builders; package ru.betterend.recipe.builders;
import java.util.Arrays;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
@ -27,6 +24,8 @@ import ru.betterend.BetterEnd;
import ru.betterend.config.Configs; import ru.betterend.config.Configs;
import ru.betterend.rituals.InfusionRitual; import ru.betterend.rituals.InfusionRitual;
import java.util.Arrays;
public class InfusionRecipe implements Recipe<InfusionRitual>, UnknownReceipBookCategory { public class InfusionRecipe implements Recipe<InfusionRitual>, UnknownReceipBookCategory {
public final static String GROUP = "infusion"; public final static String GROUP = "infusion";
public final static RecipeType<InfusionRecipe> TYPE = BCLRecipeManager.registerType(BetterEnd.MOD_ID, GROUP); public final static RecipeType<InfusionRecipe> TYPE = BCLRecipeManager.registerType(BetterEnd.MOD_ID, GROUP);

View file

@ -2,14 +2,14 @@ package ru.betterend.registry;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry; import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
import ru.betterend.client.render.PedestalItemRenderer; import ru.betterend.client.render.PedestalItemRenderer;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class EndBlockEntityRenders { public class EndBlockEntityRenders {
public static void register() { public static void register() {
BlockEntityRendererRegistry.INSTANCE.register(EndBlockEntities.PEDESTAL, PedestalItemRenderer::new); BlockEntityRendererRegistry.register(EndBlockEntities.PEDESTAL, PedestalItemRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(EndBlockEntities.ETERNAL_PEDESTAL, PedestalItemRenderer::new); BlockEntityRendererRegistry.register(EndBlockEntities.ETERNAL_PEDESTAL, PedestalItemRenderer::new);
BlockEntityRendererRegistry.INSTANCE.register(EndBlockEntities.INFUSION_PEDESTAL, PedestalItemRenderer::new); BlockEntityRendererRegistry.register(EndBlockEntities.INFUSION_PEDESTAL, PedestalItemRenderer::new);
} }
} }

View file

@ -1,17 +1,11 @@
package ru.betterend.registry; package ru.betterend.registry;
import java.util.List;
import java.util.stream.Collectors;
import org.jetbrains.annotations.NotNull;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MaterialColor;
import org.jetbrains.annotations.NotNull;
import ru.bclib.blocks.BaseBarrelBlock; import ru.bclib.blocks.BaseBarrelBlock;
import ru.bclib.blocks.BaseChestBlock; import ru.bclib.blocks.BaseChestBlock;
import ru.bclib.blocks.BaseFurnaceBlock; import ru.bclib.blocks.BaseFurnaceBlock;
@ -150,6 +144,8 @@ import ru.betterend.item.material.EndArmorMaterial;
import ru.betterend.item.material.EndToolMaterial; import ru.betterend.item.material.EndToolMaterial;
import ru.betterend.tab.CreativeTabs; import ru.betterend.tab.CreativeTabs;
import java.util.List;
public class EndBlocks { public class EndBlocks {
private static final BlockRegistry REGISTRY = new BlockRegistry(CreativeTabs.TAB_BLOCKS, Configs.BLOCK_CONFIG); private static final BlockRegistry REGISTRY = new BlockRegistry(CreativeTabs.TAB_BLOCKS, Configs.BLOCK_CONFIG);
@ -526,12 +522,7 @@ public class EndBlocks {
public static final Block END_PORTAL_BLOCK = registerEndBlockOnly("end_portal_block", new EndPortalBlock()); public static final Block END_PORTAL_BLOCK = registerEndBlockOnly("end_portal_block", new EndPortalBlock());
public static List<Block> getModBlocks() { public static List<Block> getModBlocks() {
return BlockRegistry return BlockRegistry.getModBlocks(BetterEnd.MOD_ID);
.getModBlocks(BetterEnd.MOD_ID)
.stream()
.filter(BlockItem.class::isInstance)
.map(item -> ((BlockItem) item).getBlock())
.collect(Collectors.toList());
} }
public static Block registerBlock(ResourceLocation id, Block block) { public static Block registerBlock(ResourceLocation id, Block block) {

View file

@ -1,7 +1,7 @@
package ru.betterend.registry; package ru.betterend.registry;
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityModelLayerRegistry; import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry; import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; import net.minecraft.client.renderer.entity.EntityRendererProvider.Context;
import net.minecraft.client.renderer.entity.MobRenderer; import net.minecraft.client.renderer.entity.MobRenderer;
@ -66,7 +66,7 @@ public class EndEntitiesRenders {
} }
private static void register(EntityType<?> type, Function<Context, MobRenderer> renderer) { private static void register(EntityType<?> type, Function<Context, MobRenderer> renderer) {
EntityRendererRegistry.INSTANCE.register(type, (context) -> renderer.apply(context)); EntityRendererRegistry.register(type, (context) -> renderer.apply(context));
} }
private static ModelLayerLocation registerMain(String id) { private static ModelLayerLocation registerMain(String id) {

View file

@ -24,11 +24,11 @@ import ru.bclib.api.BonemealAPI;
import ru.bclib.api.TagAPI; import ru.bclib.api.TagAPI;
import ru.bclib.blocks.BaseVineBlock; import ru.bclib.blocks.BaseVineBlock;
import ru.bclib.blocks.SimpleLeavesBlock; import ru.bclib.blocks.SimpleLeavesBlock;
import ru.bclib.mixin.common.ComposterBlockAccessor;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.blocks.basis.EndTerrainBlock; import ru.betterend.blocks.basis.EndTerrainBlock;
import ru.betterend.blocks.basis.PedestalBlock; import ru.betterend.blocks.basis.PedestalBlock;
import ru.betterend.item.tool.EndHammerItem; import ru.betterend.item.tool.EndHammerItem;
import ru.betterend.mixin.common.ComposterBlockAccessor;
import java.util.List; import java.util.List;

View file

@ -1,10 +1,6 @@
package ru.betterend.util; package ru.betterend.util;
import java.util.Set;
import java.util.stream.IntStream;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
@ -23,6 +19,9 @@ import ru.betterend.blocks.BlueVineBlock;
import ru.betterend.blocks.basis.FurBlock; import ru.betterend.blocks.basis.FurBlock;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import java.util.Set;
import java.util.stream.IntStream;
public class BlockFixer { public class BlockFixer {
private static final BlockState AIR = Blocks.AIR.defaultBlockState(); private static final BlockState AIR = Blocks.AIR.defaultBlockState();
private static final BlockState WATER = Blocks.WATER.defaultBlockState(); private static final BlockState WATER = Blocks.WATER.defaultBlockState();

View file

@ -1,7 +1,6 @@
package ru.betterend.world.biome.cave; package ru.betterend.world.biome.cave;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.ai.behavior.ShufflingList;
import net.minecraft.world.level.biome.Biome.BiomeCategory; import net.minecraft.world.level.biome.Biome.BiomeCategory;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;

View file

@ -17,6 +17,7 @@ public class BlueVineFeature extends ScatterFeature {
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) { public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
float d = MHelper.length( float d = MHelper.length(
center.getX() - blockPos.getX(), center.getX() - blockPos.getX(),

View file

@ -16,11 +16,11 @@ import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import ru.bclib.api.BiomeAPI; import ru.bclib.api.BiomeAPI;
import ru.bclib.api.TagAPI; import ru.bclib.api.TagAPI;
import ru.bclib.interfaces.BiomeSetter;
import ru.bclib.util.BlocksHelper; import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper; import ru.bclib.util.MHelper;
import ru.bclib.world.biomes.BCLBiome; import ru.bclib.world.biomes.BCLBiome;
import ru.bclib.world.features.DefaultFeature; import ru.bclib.world.features.DefaultFeature;
import ru.betterend.interfaces.IBiomeArray;
import ru.betterend.registry.EndBiomes; import ru.betterend.registry.EndBiomes;
import ru.betterend.util.BlockFixer; import ru.betterend.util.BlockFixer;
import ru.betterend.world.biome.cave.EndCaveBiome; import ru.betterend.world.biome.cave.EndCaveBiome;
@ -155,9 +155,9 @@ public abstract class EndCaveFeature extends DefaultFeature {
} }
protected void setBiome(WorldGenLevel world, BlockPos pos, EndCaveBiome biome) { protected void setBiome(WorldGenLevel world, BlockPos pos, EndCaveBiome biome) {
IBiomeArray array = (IBiomeArray) world.getChunk(pos).getBiomes(); BiomeSetter array = (BiomeSetter) world.getChunk(pos).getBiomes();
if (array != null) { if (array != null) {
array.be_setBiome(biome.getActualBiome(), pos); array.bclib_setBiome(biome.getActualBiome(), pos);
} }
} }

View file

@ -6,14 +6,11 @@
"mixins": [ "mixins": [
"BiomeGenerationSettingsAccessor", "BiomeGenerationSettingsAccessor",
"NoiseBasedChunkGeneratorMixin", "NoiseBasedChunkGeneratorMixin",
"ChunkBiomeContainerMixin",
"ChorusPlantFeatureMixin", "ChorusPlantFeatureMixin",
"PlayerAdvancementsMixin", "PlayerAdvancementsMixin",
"ChorusFlowerBlockMixin", "ChorusFlowerBlockMixin",
"ComposterBlockAccessor",
"ChorusPlantBlockMixin", "ChorusPlantBlockMixin",
"EndPodiumFeatureMixin", "EndPodiumFeatureMixin",
"PotionBrewingAccessor",
"MinecraftServerMixin", "MinecraftServerMixin",
"EndDragonFightMixin", "EndDragonFightMixin",
"WorldGenRegionMixin", "WorldGenRegionMixin",