Update to BCLib 0.5.0 and new Fabric API
This commit is contained in:
parent
1d333071dc
commit
a9d1082ed2
72 changed files with 167 additions and 306 deletions
|
@ -60,7 +60,6 @@ public class BetterEnd implements ModInitializer {
|
|||
LootTableUtil.init();
|
||||
FabricLoader.getInstance().getEntrypoints("betterend", BetterEndPlugin.class).forEach(BetterEndPlugin::register);
|
||||
Integrations.init();
|
||||
DataFixer.register();
|
||||
Configs.saveConfigs();
|
||||
|
||||
if (GeneratorOptions.useNewGenerator()) {
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
}*/
|
||||
}
|
||||
}
|
|
@ -7,6 +7,6 @@ import ru.bclib.blocks.BaseRotatedPillarBlock;
|
|||
|
||||
public class AmaranitaStemBlock extends BaseRotatedPillarBlock {
|
||||
public AmaranitaStemBlock() {
|
||||
super(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).materialColor(MaterialColor.COLOR_LIGHT_GREEN));
|
||||
super(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).mapColor(MaterialColor.COLOR_LIGHT_GREEN));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,6 @@ import ru.bclib.blocks.BaseBlock;
|
|||
|
||||
public class AmberBlock extends BaseBlock {
|
||||
public AmberBlock() {
|
||||
super(FabricBlockSettings.copyOf(Blocks.DIAMOND_BLOCK).materialColor(MaterialColor.COLOR_YELLOW));
|
||||
super(FabricBlockSettings.copyOf(Blocks.DIAMOND_BLOCK).mapColor(MaterialColor.COLOR_YELLOW));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ public class AncientEmeraldIceBlock extends BaseBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
Direction dir = BlocksHelper.randomDirection(random);
|
||||
|
||||
|
|
|
@ -93,6 +93,7 @@ public class AuroraCrystalBlock extends AbstractGlassBlock implements RenderLaye
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||
if (tool != null && tool.isCorrectToolForDrops(state)) {
|
||||
|
|
|
@ -29,11 +29,13 @@ public class BlueVineLanternBlock extends BaseBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
|
||||
return !state.getValue(NATURAL) || world.getBlockState(pos.below()).getBlock() == EndBlocks.BLUE_VINE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
||||
if (!canSurvive(state, world, pos)) {
|
||||
return Blocks.AIR.defaultBlockState();
|
||||
|
|
|
@ -28,7 +28,7 @@ public class BrimstoneBlock extends BaseBlock {
|
|||
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE;
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,7 @@ public class BrimstoneBlock extends BaseBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
boolean deactivate = true;
|
||||
for (Direction dir : BlocksHelper.DIRECTIONS) {
|
||||
|
|
|
@ -36,7 +36,7 @@ public class BulbVineLanternBlock extends EndLanternBlock implements RenderLayer
|
|||
.hardness(1)
|
||||
.resistance(1)
|
||||
.breakByTool(FabricToolTags.PICKAXES)
|
||||
.materialColor(MaterialColor.COLOR_LIGHT_GRAY)
|
||||
.mapColor(MaterialColor.COLOR_LIGHT_GRAY)
|
||||
.luminance(15)
|
||||
.requiresCorrectToolForDrops()
|
||||
.sound(SoundType.LANTERN));
|
||||
|
@ -47,6 +47,7 @@ public class BulbVineLanternBlock extends EndLanternBlock implements RenderLayer
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
return state.getValue(IS_FLOOR) ? SHAPE_FLOOR : SHAPE_CEIL;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ public class CavePumpkinBlock extends BaseBlockNotFull implements RenderLayerPro
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
||||
return state.getValue(SMALL) ? SHAPE_SMALL : SHAPE_BIG;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ public class ChandelierBlock extends BaseAttachedBlock implements RenderLayerPro
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
return BOUNDING_SHAPES.get(state.getValue(FACING));
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ public class DragonTreeSaplingBlock extends PottableFeatureSapling {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Feature<?> getFeature() {
|
||||
return EndFeatures.DRAGON_TREE.getFeature();
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ public class EmeraldIceBlock extends HalfTransparentBlock implements RenderLayer
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
if (world.getBrightness(LightLayer.BLOCK, pos) > 11 - state.getLightBlock(world, pos)) {
|
||||
this.melt(state, world, pos);
|
||||
|
@ -75,6 +76,7 @@ public class EmeraldIceBlock extends HalfTransparentBlock implements RenderLayer
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
ItemStack tool = builder.getOptionalParameter(LootContextParams.TOOL);
|
||||
if (tool != null && EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) != 0) {
|
||||
|
|
|
@ -44,6 +44,7 @@ public class EndLotusFlowerBlock extends EndPlantBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
return SHAPE_COLLISION;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public class EndLotusLeafBlock extends BaseBlockNotFull implements RenderLayerPr
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
|
||||
BlockState down = world.getBlockState(pos.below());
|
||||
return !down.getFluidState().isEmpty() && down.getFluidState().getType() instanceof WaterFluid;
|
||||
|
@ -49,16 +50,19 @@ public class EndLotusLeafBlock extends BaseBlockNotFull implements RenderLayerPr
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
return VSHAPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public BlockState rotate(BlockState state, Rotation rotation) {
|
||||
return BlocksHelper.rotateHorizontal(state, rotation, HORIZONTAL_FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public BlockState mirror(BlockState state, Mirror mirror) {
|
||||
return BlocksHelper.mirrorHorizontal(state, mirror, HORIZONTAL_FACING);
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlo
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
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());
|
||||
}
|
||||
|
@ -57,6 +58,7 @@ public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlo
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state);
|
||||
}
|
||||
|
@ -71,16 +73,19 @@ public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlo
|
|||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public BlockState updateShape(BlockState state, Direction direction, BlockState newState, LevelAccessor world, BlockPos pos, BlockPos posFrom) {
|
||||
if (state.getValue(WATERLOGGED)) {
|
||||
world.getLiquidTicks().scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world));
|
||||
|
|
|
@ -58,6 +58,7 @@ public class EndStoneSmelter extends BaseBlockWithEntity {
|
|||
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) {
|
||||
if (world.isClientSide) {
|
||||
return InteractionResult.SUCCESS;
|
||||
|
@ -102,11 +103,13 @@ public class EndStoneSmelter extends BaseBlockWithEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean hasAnalogOutputSignal(BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) {
|
||||
//TODO
|
||||
return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(world.getBlockEntity(pos));
|
||||
|
@ -118,11 +121,13 @@ public class EndStoneSmelter extends BaseBlockWithEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public BlockState rotate(BlockState state, Rotation rotation) {
|
||||
return state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public BlockState mirror(BlockState state, Mirror mirror) {
|
||||
return state.rotate(mirror.getRotation(state.getValue(FACING)));
|
||||
}
|
||||
|
|
|
@ -21,12 +21,15 @@ public class EndstoneDustBlock extends FallingBlock {
|
|||
private static final int COLOR = ColorUtil.color(226, 239, 168);
|
||||
|
||||
public EndstoneDustBlock() {
|
||||
super(FabricBlockSettings.copyOf(Blocks.SAND)
|
||||
.breakByTool(FabricToolTags.SHOVELS)
|
||||
.materialColor(Blocks.END_STONE.defaultMaterialColor()));
|
||||
super(FabricBlockSettings
|
||||
.copyOf(Blocks.SAND)
|
||||
.breakByTool(FabricToolTags.SHOVELS)
|
||||
.mapColor(Blocks.END_STONE.defaultMaterialColor())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ public class FilaluxWingsBlock extends BaseAttachedBlock implements RenderLayerP
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
return BOUNDING_SHAPES.get(state.getValue(FACING));
|
||||
}
|
||||
|
|
|
@ -101,6 +101,7 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
||||
int plantID = state.getValue(PLANT_ID);
|
||||
if (plantID < 1 || plantID > plants.length || plants[plantID - 1] == null) {
|
||||
|
@ -198,6 +199,7 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
if (level.isClientSide) {
|
||||
return InteractionResult.CONSUME;
|
||||
|
@ -421,12 +423,14 @@ public class FlowerPotBlock extends BaseBlockNotFull implements RenderLayerProvi
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
int id = state.getValue(PLANT_ID);
|
||||
return id > 0 && id <= plants.length ? SHAPE_FULL : SHAPE_EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
return SHAPE_EMPTY;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class GlowingPillarLuminophorBlock extends BaseBlock {
|
|||
|
||||
public GlowingPillarLuminophorBlock() {
|
||||
super(FabricBlockSettings.of(Material.LEAVES)
|
||||
.materialColor(MaterialColor.COLOR_ORANGE)
|
||||
.mapColor(MaterialColor.COLOR_ORANGE)
|
||||
.breakByTool(FabricToolTags.SHEARS)
|
||||
.strength(0.2F)
|
||||
.luminance(15)
|
||||
|
@ -31,11 +31,13 @@ public class GlowingPillarLuminophorBlock extends BaseBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
|
||||
return !state.getValue(NATURAL) || world.getBlockState(pos.below()).is(EndBlocks.GLOWING_PILLAR_ROOTS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
||||
if (!canSurvive(state, world, pos)) {
|
||||
return Blocks.AIR.defaultBlockState();
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.client.color.block.BlockColor;
|
||||
|
@ -31,17 +27,22 @@ import ru.bclib.util.MHelper;
|
|||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class HelixTreeLeavesBlock extends BaseBlock implements CustomColorProvider {
|
||||
public static final IntegerProperty COLOR = EndBlockProperties.COLOR;
|
||||
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0);
|
||||
|
||||
public HelixTreeLeavesBlock() {
|
||||
super(FabricBlockSettings.of(Material.LEAVES)
|
||||
.materialColor(MaterialColor.COLOR_ORANGE)
|
||||
.breakByTool(FabricToolTags.SHEARS)
|
||||
.sound(SoundType.WART_BLOCK)
|
||||
.sound(SoundType.GRASS)
|
||||
.strength(0.2F));
|
||||
super(FabricBlockSettings
|
||||
.of(Material.LEAVES)
|
||||
.mapColor(MaterialColor.COLOR_ORANGE)
|
||||
.breakByTool(FabricToolTags.SHEARS)
|
||||
.sound(SoundType.WART_BLOCK)
|
||||
.sound(SoundType.GRASS)
|
||||
.strength(0.2F)
|
||||
);
|
||||
|
||||
TagAPI.addTags(this, TagAPI.BLOCK_LEAVES);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import ru.betterend.registry.EndFeatures;
|
|||
|
||||
public class HelixTreeSaplingBlock extends PottableFeatureSapling {
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Feature<?> getFeature() {
|
||||
return EndFeatures.HELIX_TREE.getFeature();
|
||||
}
|
||||
|
|
|
@ -13,13 +13,16 @@ import ru.bclib.blocks.BaseBlock;
|
|||
|
||||
public class HydraluxPetalBlock extends BaseBlock {
|
||||
public HydraluxPetalBlock() {
|
||||
this(FabricBlockSettings.of(Material.PLANT)
|
||||
.breakByTool(FabricToolTags.AXES)
|
||||
.breakByHand(true)
|
||||
.hardness(1)
|
||||
.resistance(1)
|
||||
.materialColor(MaterialColor.PODZOL)
|
||||
.sound(SoundType.WART_BLOCK));
|
||||
this(
|
||||
FabricBlockSettings
|
||||
.of(Material.PLANT)
|
||||
.breakByTool(FabricToolTags.AXES)
|
||||
.breakByHand(true)
|
||||
.hardness(1)
|
||||
.resistance(1)
|
||||
.mapColor(MaterialColor.PODZOL)
|
||||
.sound(SoundType.WART_BLOCK)
|
||||
);
|
||||
}
|
||||
|
||||
public HydraluxPetalBlock(Properties settings) {
|
||||
|
|
|
@ -66,6 +66,7 @@ public class JellyshroomCapBlock extends SlimeBlock implements RenderLayerProvid
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Lists.newArrayList(new ItemStack(this));
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ public class LacugroveSaplingBlock extends PottableFeatureSapling {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Feature<?> getFeature() {
|
||||
return EndFeatures.LACUGROVE.getFeature();
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ public class LucerniaSaplingBlock extends PottableFeatureSapling {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Feature<?> getFeature() {
|
||||
return EndFeatures.LUCERNIA.getFeature();
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ public class MossyGlowshroomSaplingBlock extends PottableFeatureSapling {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Feature<?> getFeature() {
|
||||
return EndFeatures.MOSSY_GLOWSHROOM.getFeature();
|
||||
}
|
||||
|
|
|
@ -35,12 +35,14 @@ public class MossyObsidian extends BaseBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
if (random.nextInt(16) == 0 && !canSurvive(state, world, pos)) {
|
||||
world.setBlockAndUpdate(pos, Blocks.OBSIDIAN.defaultBlockState());
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean canSurvive(BlockState state, LevelReader worldView, BlockPos pos) {
|
||||
BlockPos blockPos = pos.above();
|
||||
BlockState blockState = worldView.getBlockState(blockPos);
|
||||
|
|
|
@ -29,6 +29,7 @@ public class MurkweedBlock extends EndPlantBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
|
||||
if (entity instanceof LivingEntity && !((LivingEntity) entity).hasEffect(MobEffects.BLINDNESS)) {
|
||||
((LivingEntity) entity).addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 50));
|
||||
|
@ -41,6 +42,7 @@ public class MurkweedBlock extends EndPlantBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.List;
|
|||
|
||||
public class NeedlegrassBlock extends EndPlantBlock {
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
|
||||
if (entity instanceof LivingEntity) {
|
||||
entity.hurt(DamageSource.CACTUS, 0.1F);
|
||||
|
@ -50,6 +51,7 @@ public class NeedlegrassBlock extends EndPlantBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ public class PythadendronSaplingBlock extends PottableFeatureSapling {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Feature<?> getFeature() {
|
||||
return EndFeatures.PYTHADENDRON_TREE.getFeature();
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ public class RespawnObeliskBlock extends BaseBlock implements CustomColorProvide
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
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
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (!world.getBlockState(pos.above(i)).getMaterial().isReplaceable()) {
|
||||
|
@ -86,6 +88,7 @@ public class RespawnObeliskBlock extends BaseBlock implements CustomColorProvide
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
||||
TripleShape shape = state.getValue(SHAPE);
|
||||
if (shape == TripleShape.BOTTOM) {
|
||||
|
@ -156,6 +159,7 @@ public class RespawnObeliskBlock extends BaseBlock implements CustomColorProvide
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
ItemStack itemStack = player.getItemInHand(hand);
|
||||
boolean canActivate = itemStack.getItem() == EndItems.AMBER_GEM && itemStack.getCount() > 5;
|
||||
|
|
|
@ -63,16 +63,19 @@ public class SilkMothHiveBlock extends BaseBlock {
|
|||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
Direction dir = state.getValue(FACING);
|
||||
BlockPos spawn = pos.relative(dir);
|
||||
|
@ -94,6 +97,7 @@ public class SilkMothHiveBlock extends BaseBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
if (hand == InteractionHand.MAIN_HAND) {
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
|
|
|
@ -71,6 +71,7 @@ public class SilkMothNestBlock extends BaseBlock implements RenderLayerProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
return state.getValue(ACTIVE) ? BOTTOM : TOP;
|
||||
}
|
||||
|
@ -87,6 +88,7 @@ public class SilkMothNestBlock extends BaseBlock implements RenderLayerProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public BlockState updateShape(BlockState state, Direction facing, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
||||
if (!state.getValue(ACTIVE)) {
|
||||
if (canSupportCenter(world, pos.above(), Direction.DOWN) || world.getBlockState(pos.above())
|
||||
|
@ -101,11 +103,13 @@ public class SilkMothNestBlock extends BaseBlock implements RenderLayerProvider
|
|||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
@ -128,6 +132,7 @@ public class SilkMothNestBlock extends BaseBlock implements RenderLayerProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
if (!state.getValue(ACTIVE)) {
|
||||
return;
|
||||
|
@ -155,6 +160,7 @@ public class SilkMothNestBlock extends BaseBlock implements RenderLayerProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
if (hand == InteractionHand.MAIN_HAND) {
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
|
|
|
@ -15,6 +15,7 @@ public class TenaneaSaplingBlock extends PottableFeatureSapling {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Feature<?> getFeature() {
|
||||
return EndFeatures.TENANEA.getFeature();
|
||||
}
|
||||
|
|
|
@ -27,9 +27,11 @@ public class UmbrellaTreeClusterBlock extends BaseBlock {
|
|||
public static final BooleanProperty NATURAL = BlockProperties.NATURAL;
|
||||
|
||||
public UmbrellaTreeClusterBlock() {
|
||||
super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK)
|
||||
.materialColor(MaterialColor.COLOR_PURPLE)
|
||||
.luminance(15));
|
||||
super(FabricBlockSettings
|
||||
.copyOf(Blocks.NETHER_WART_BLOCK)
|
||||
.mapColor(MaterialColor.COLOR_PURPLE)
|
||||
.luminance(15)
|
||||
);
|
||||
registerDefaultState(stateDefinition.any().setValue(NATURAL, false));
|
||||
}
|
||||
|
||||
|
@ -39,6 +41,7 @@ public class UmbrellaTreeClusterBlock extends BaseBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if (stack.getItem() == Items.GLASS_BOTTLE) {
|
||||
|
|
|
@ -19,9 +19,11 @@ public class UmbrellaTreeClusterEmptyBlock extends BaseBlock {
|
|||
public static final BooleanProperty NATURAL = EndBlockProperties.NATURAL;
|
||||
|
||||
public UmbrellaTreeClusterEmptyBlock() {
|
||||
super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK)
|
||||
.materialColor(MaterialColor.COLOR_PURPLE)
|
||||
.randomTicks());
|
||||
super(FabricBlockSettings
|
||||
.copyOf(Blocks.NETHER_WART_BLOCK)
|
||||
.mapColor(MaterialColor.COLOR_PURPLE)
|
||||
.randomTicks()
|
||||
);
|
||||
registerDefaultState(stateDefinition.any().setValue(NATURAL, false));
|
||||
}
|
||||
|
||||
|
@ -31,6 +33,7 @@ public class UmbrellaTreeClusterEmptyBlock extends BaseBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
if (state.getValue(NATURAL) && random.nextInt(16) == 0) {
|
||||
BlocksHelper.setWithUpdate(
|
||||
|
|
|
@ -55,6 +55,7 @@ public class UmbrellaTreeMembraneBlock extends SlimeBlock implements RenderLayer
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
if (state.getValue(COLOR) > 0) {
|
||||
return Lists.newArrayList(new ItemStack(this));
|
||||
|
|
|
@ -16,6 +16,7 @@ public class UmbrellaTreeSaplingBlock extends PottableFeatureSapling {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected Feature<?> getFeature() {
|
||||
return EndFeatures.UMBRELLA_TREE.getFeature();
|
||||
}
|
||||
|
|
|
@ -48,22 +48,26 @@ public class VentBubbleColumnBlock extends Block implements BucketPickup, Liquid
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public RenderShape getRenderShape(BlockState state) {
|
||||
return RenderShape.INVISIBLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
|
||||
BlockState blockState = world.getBlockState(pos.below());
|
||||
return blockState.is(this) || blockState.is(EndBlocks.HYDROTHERMAL_VENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
||||
return Shapes.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public BlockState updateShape(BlockState state, Direction direction, BlockState newState, LevelAccessor world, BlockPos pos, BlockPos posFrom) {
|
||||
if (!state.canSurvive(world, pos)) {
|
||||
return Blocks.WATER.defaultBlockState();
|
||||
|
@ -101,6 +105,7 @@ public class VentBubbleColumnBlock extends Block implements BucketPickup, Liquid
|
|||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
@SuppressWarnings("deprecation")
|
||||
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
|
||||
BlockState blockState = world.getBlockState(pos.above());
|
||||
if (blockState.isAir()) {
|
||||
|
@ -150,6 +155,7 @@ public class VentBubbleColumnBlock extends Block implements BucketPickup, Liquid
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public FluidState getFluidState(BlockState state) {
|
||||
return Fluids.WATER.getSource(false);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
@ -29,6 +25,9 @@ import ru.bclib.client.render.BCLRenderLayer;
|
|||
import ru.bclib.interfaces.RenderLayerProvider;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
|
||||
public class FurBlock extends BaseAttachedBlock implements RenderLayerProvider {
|
||||
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
|
||||
private final ItemLike drop;
|
||||
|
@ -58,6 +57,7 @@ public class FurBlock extends BaseAttachedBlock implements RenderLayerProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
return BOUNDING_SHAPES.get(state.getValue(FACING));
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ public class StoneLanternBlock extends EndLanternBlock implements CustomColorPro
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
return state.getValue(IS_FLOOR) ? SHAPE_FLOOR : SHAPE_CEIL;
|
||||
}
|
||||
|
|
|
@ -30,8 +30,7 @@ public class ColoredMaterial {
|
|||
String id = Registry.BLOCK.getKey(source).getPath();
|
||||
colors.forEach((color, name) -> {
|
||||
String blockName = id + "_" + name;
|
||||
Block block = constructor.apply(FabricBlockSettings.copyOf(source)
|
||||
.materialColor(MaterialColor.COLOR_BLACK));
|
||||
Block block = constructor.apply(FabricBlockSettings.copyOf(source).mapColor(MaterialColor.COLOR_BLACK));
|
||||
EndBlocks.registerBlock(blockName, block);
|
||||
if (craftEight) {
|
||||
GridRecipe.make(BetterEnd.MOD_ID, blockName, block)
|
||||
|
|
|
@ -95,8 +95,7 @@ public class MetalMaterial {
|
|||
return new MetalMaterial(
|
||||
name,
|
||||
true,
|
||||
FabricBlockSettings.copyOf(Blocks.IRON_BLOCK)
|
||||
.materialColor(color),
|
||||
FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).mapColor(color),
|
||||
EndItems.makeEndItemSettings(),
|
||||
material,
|
||||
armor
|
||||
|
@ -108,7 +107,7 @@ public class MetalMaterial {
|
|||
name,
|
||||
true,
|
||||
FabricBlockSettings.copyOf(Blocks.IRON_BLOCK)
|
||||
.materialColor(color)
|
||||
.mapColor(color)
|
||||
.hardness(hardness)
|
||||
.resistance(resistance),
|
||||
EndItems.makeEndItemSettings(),
|
||||
|
@ -121,8 +120,7 @@ public class MetalMaterial {
|
|||
return new MetalMaterial(
|
||||
name,
|
||||
false,
|
||||
FabricBlockSettings.copyOf(Blocks.IRON_BLOCK)
|
||||
.materialColor(color),
|
||||
FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).mapColor(color),
|
||||
EndItems.makeEndItemSettings(),
|
||||
material,
|
||||
armor
|
||||
|
@ -134,7 +132,7 @@ public class MetalMaterial {
|
|||
name,
|
||||
false,
|
||||
FabricBlockSettings.copyOf(Blocks.IRON_BLOCK)
|
||||
.materialColor(color)
|
||||
.mapColor(color)
|
||||
.hardness(hardness)
|
||||
.resistance(resistance),
|
||||
EndItems.makeEndItemSettings(),
|
||||
|
|
|
@ -47,7 +47,7 @@ public class StoneMaterial {
|
|||
public final Block flowerPot;
|
||||
|
||||
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));
|
||||
polished = EndBlocks.registerBlock(name + "_polished", new BaseBlock(material));
|
||||
|
|
|
@ -6,8 +6,8 @@ import net.minecraft.world.effect.MobEffectInstance;
|
|||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.alchemy.Potion;
|
||||
import net.minecraft.world.item.alchemy.Potions;
|
||||
import ru.bclib.mixin.common.PotionBrewingAccessor;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.mixin.common.PotionBrewingAccessor;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.registry.EndItems;
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
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.display.SimpleGridMenuDisplay;
|
||||
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.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import ru.bclib.recipes.AnvilRecipe;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
|
||||
public class REIAnvilDisplay extends BasicDisplay implements SimpleGridMenuDisplay {
|
||||
|
||||
private final AnvilRecipe recipe;
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
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 me.shedaniel.rei.api.client.plugins.REIClientPlugin;
|
||||
import me.shedaniel.rei.api.client.registry.category.CategoryRegistry;
|
||||
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.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
|
||||
public class REIPlugin implements REIClientPlugin {
|
||||
public final static ResourceLocation PLUGIN_ID = BetterEnd.makeID("rei_plugin");
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -2,7 +2,6 @@ package ru.betterend.interfaces;
|
|||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.registry.EndItems;
|
||||
|
||||
public interface MultiModelItem {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.item.material;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.util.LazyLoadedValue;
|
||||
|
@ -32,10 +30,11 @@ public enum EndArmorMaterial implements ArmorMaterial {
|
|||
private final SoundEvent equipSound;
|
||||
private final float toughness;
|
||||
private final float knockbackResistance;
|
||||
@SuppressWarnings("deprecation")
|
||||
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) {
|
||||
|
||||
this.name = name;
|
||||
this.durabilityMultiplier = durabilityMultiplier;
|
||||
this.protectionAmounts = protectionAmounts;
|
||||
|
|
|
@ -22,10 +22,11 @@ public enum EndToolMaterial implements Tier {
|
|||
private final float attackDamage;
|
||||
private final int miningLevel;
|
||||
private final int enchantability;
|
||||
@SuppressWarnings("deprecation")
|
||||
private final LazyLoadedValue<Ingredient> repairIngredient;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private EndToolMaterial(int miningLevel, int durability, float miningSpeed, float attackDamage, int enchantability, Supplier<Ingredient> repairIngredient) {
|
||||
|
||||
this.durability = durability;
|
||||
this.miningSpeed = miningSpeed;
|
||||
this.attackDamage = attackDamage;
|
||||
|
|
|
@ -67,6 +67,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
|||
private void placeGrownFlower(Level world, BlockPos pos, int age) {}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
||||
if (GeneratorOptions.changeChorusPlant()) {
|
||||
return state.getValue(ChorusFlowerBlock.AGE) == 5 ? SHAPE_HALF : SHAPE_FULL;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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");
|
||||
}
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.tags.EntityTypeTags;
|
||||
import net.minecraft.util.Mth;
|
||||
|
@ -39,6 +37,8 @@ import ru.betterend.interfaces.MobEffectApplier;
|
|||
import ru.betterend.item.CrystaliteArmor;
|
||||
import ru.betterend.registry.EndAttributes;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@Mixin(value=LivingEntity.class, priority=200)
|
||||
public abstract class LivingEntityMixin extends Entity {
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
|
@ -26,6 +24,8 @@ import ru.bclib.util.MHelper;
|
|||
import ru.betterend.interfaces.FallFlyingItem;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Mixin(value=Player.class, priority=200)
|
||||
public abstract class PlayerMixin extends LivingEntity {
|
||||
protected PlayerMixin(EntityType<? extends LivingEntity> entityType, Level level) {
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@ public class InfusionParticleType extends ParticleType<InfusionParticleType> imp
|
|||
itemStack
|
||||
), infusionParticleType -> infusionParticleType.itemStack);
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static final ParticleOptions.Deserializer<InfusionParticleType> PARAMETERS_FACTORY = new ParticleOptions.Deserializer<InfusionParticleType>() {
|
||||
public InfusionParticleType fromCommand(ParticleType<InfusionParticleType> particleType, StringReader stringReader) throws CommandSyntaxException {
|
||||
stringReader.expect(' ');
|
||||
|
|
|
@ -20,11 +20,11 @@ import net.minecraft.world.level.ItemLike;
|
|||
import net.minecraft.world.level.Level;
|
||||
import ru.bclib.interfaces.UnknownReceipBookCategory;
|
||||
import ru.bclib.recipes.BCLRecipeManager;
|
||||
import ru.bclib.util.ItemUtil;
|
||||
import ru.bclib.util.RecipeHelper;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.config.Configs;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.bclib.util.ItemUtil;
|
||||
import ru.bclib.util.RecipeHelper;
|
||||
|
||||
public class AlloyingRecipe implements Recipe<Container>, UnknownReceipBookCategory {
|
||||
public final static String GROUP = "alloying";
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package ru.betterend.recipe.builders;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
@ -27,6 +24,8 @@ import ru.betterend.BetterEnd;
|
|||
import ru.betterend.config.Configs;
|
||||
import ru.betterend.rituals.InfusionRitual;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class InfusionRecipe implements Recipe<InfusionRitual>, UnknownReceipBookCategory {
|
||||
public final static String GROUP = "infusion";
|
||||
public final static RecipeType<InfusionRecipe> TYPE = BCLRecipeManager.registerType(BetterEnd.MOD_ID, GROUP);
|
||||
|
|
|
@ -2,14 +2,14 @@ package ru.betterend.registry;
|
|||
|
||||
import net.fabricmc.api.EnvType;
|
||||
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;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class EndBlockEntityRenders {
|
||||
public static void register() {
|
||||
BlockEntityRendererRegistry.INSTANCE.register(EndBlockEntities.PEDESTAL, PedestalItemRenderer::new);
|
||||
BlockEntityRendererRegistry.INSTANCE.register(EndBlockEntities.ETERNAL_PEDESTAL, PedestalItemRenderer::new);
|
||||
BlockEntityRendererRegistry.INSTANCE.register(EndBlockEntities.INFUSION_PEDESTAL, PedestalItemRenderer::new);
|
||||
BlockEntityRendererRegistry.register(EndBlockEntities.PEDESTAL, PedestalItemRenderer::new);
|
||||
BlockEntityRendererRegistry.register(EndBlockEntities.ETERNAL_PEDESTAL, PedestalItemRenderer::new);
|
||||
BlockEntityRendererRegistry.register(EndBlockEntities.INFUSION_PEDESTAL, PedestalItemRenderer::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
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.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.Blocks;
|
||||
import net.minecraft.world.level.material.MaterialColor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import ru.bclib.blocks.BaseBarrelBlock;
|
||||
import ru.bclib.blocks.BaseChestBlock;
|
||||
import ru.bclib.blocks.BaseFurnaceBlock;
|
||||
|
@ -150,6 +144,8 @@ import ru.betterend.item.material.EndArmorMaterial;
|
|||
import ru.betterend.item.material.EndToolMaterial;
|
||||
import ru.betterend.tab.CreativeTabs;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EndBlocks {
|
||||
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 List<Block> getModBlocks() {
|
||||
return BlockRegistry
|
||||
.getModBlocks(BetterEnd.MOD_ID)
|
||||
.stream()
|
||||
.filter(BlockItem.class::isInstance)
|
||||
.map(item -> ((BlockItem) item).getBlock())
|
||||
.collect(Collectors.toList());
|
||||
return BlockRegistry.getModBlocks(BetterEnd.MOD_ID);
|
||||
}
|
||||
|
||||
public static Block registerBlock(ResourceLocation id, Block block) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ru.betterend.registry;
|
||||
|
||||
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityModelLayerRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
|
||||
import net.minecraft.client.model.geom.ModelLayerLocation;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider.Context;
|
||||
import net.minecraft.client.renderer.entity.MobRenderer;
|
||||
|
@ -66,7 +66,7 @@ public class EndEntitiesRenders {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -24,11 +24,11 @@ import ru.bclib.api.BonemealAPI;
|
|||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.blocks.BaseVineBlock;
|
||||
import ru.bclib.blocks.SimpleLeavesBlock;
|
||||
import ru.bclib.mixin.common.ComposterBlockAccessor;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.blocks.basis.EndTerrainBlock;
|
||||
import ru.betterend.blocks.basis.PedestalBlock;
|
||||
import ru.betterend.item.tool.EndHammerItem;
|
||||
import ru.betterend.mixin.common.ComposterBlockAccessor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
package ru.betterend.util;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -23,6 +19,9 @@ import ru.betterend.blocks.BlueVineBlock;
|
|||
import ru.betterend.blocks.basis.FurBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class BlockFixer {
|
||||
private static final BlockState AIR = Blocks.AIR.defaultBlockState();
|
||||
private static final BlockState WATER = Blocks.WATER.defaultBlockState();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package ru.betterend.world.biome.cave;
|
||||
|
||||
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.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
|
|
|
@ -17,6 +17,7 @@ public class BlueVineFeature extends ScatterFeature {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
|
||||
float d = MHelper.length(
|
||||
center.getX() - blockPos.getX(),
|
||||
|
|
|
@ -16,11 +16,11 @@ import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
|||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.api.BiomeAPI;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.interfaces.BiomeSetter;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.biomes.BCLBiome;
|
||||
import ru.bclib.world.features.DefaultFeature;
|
||||
import ru.betterend.interfaces.IBiomeArray;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.util.BlockFixer;
|
||||
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) {
|
||||
IBiomeArray array = (IBiomeArray) world.getChunk(pos).getBiomes();
|
||||
BiomeSetter array = (BiomeSetter) world.getChunk(pos).getBiomes();
|
||||
if (array != null) {
|
||||
array.be_setBiome(biome.getActualBiome(), pos);
|
||||
array.bclib_setBiome(biome.getActualBiome(), pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue