diff --git a/src/main/java/ru/bclib/blocks/BaseAnvilBlock.java b/src/main/java/ru/bclib/blocks/BaseAnvilBlock.java index 9fee7e24..5dafc0d5 100644 --- a/src/main/java/ru/bclib/blocks/BaseAnvilBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseAnvilBlock.java @@ -4,10 +4,14 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import org.jetbrains.annotations.Nullable; + import com.google.common.collect.Lists; import com.google.common.collect.Maps; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.resources.ResourceLocation; @@ -21,19 +25,17 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.storage.loot.LootContext; -import org.jetbrains.annotations.Nullable; import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.PatternsHelper; import ru.bclib.items.BaseAnvilItem; -import ru.bclib.util.BlocksHelper; public abstract class BaseAnvilBlock extends AnvilBlock implements BlockModelProvider { public static final IntegerProperty DESTRUCTION = BlockProperties.DESTRUCTION; public BaseAnvilBlock(MaterialColor color) { - super(BlocksHelper.copySettingsOf(Blocks.ANVIL).mapColor(color)); + super(FabricBlockSettings.copyOf(Blocks.ANVIL).mapColor(color)); } @Override diff --git a/src/main/java/ru/bclib/blocks/BaseBarrelBlock.java b/src/main/java/ru/bclib/blocks/BaseBarrelBlock.java index 6e023c3d..b36f8843 100644 --- a/src/main/java/ru/bclib/blocks/BaseBarrelBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseBarrelBlock.java @@ -5,8 +5,11 @@ import java.util.Map; import java.util.Optional; import java.util.Random; +import org.jetbrains.annotations.Nullable; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.client.resources.model.UnbakedModel; @@ -21,6 +24,7 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.monster.piglin.PiglinAi; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.BarrelBlock; import net.minecraft.world.level.block.Block; @@ -29,18 +33,16 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.phys.BlockHitResult; -import org.jetbrains.annotations.Nullable; import ru.bclib.blockentities.BaseBarrelBlockEntity; import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.PatternsHelper; import ru.bclib.registry.BaseBlockEntities; -import ru.bclib.util.BlocksHelper; public class BaseBarrelBlock extends BarrelBlock implements BlockModelProvider { public BaseBarrelBlock(Block source) { - super(BlocksHelper.copySettingsOf(source).noOcclusion()); + super(FabricBlockSettings.copyOf(source).noOcclusion()); } @Override diff --git a/src/main/java/ru/bclib/blocks/BaseBookshelfBlock.java b/src/main/java/ru/bclib/blocks/BaseBookshelfBlock.java index d97b69c2..a1b68b1d 100644 --- a/src/main/java/ru/bclib/blocks/BaseBookshelfBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseBookshelfBlock.java @@ -4,8 +4,11 @@ import java.util.Collections; import java.util.List; import java.util.Optional; +import org.jetbrains.annotations.Nullable; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; @@ -16,15 +19,13 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; -import org.jetbrains.annotations.Nullable; import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.PatternsHelper; -import ru.bclib.util.BlocksHelper; public class BaseBookshelfBlock extends BaseBlock { public BaseBookshelfBlock(Block source) { - super(BlocksHelper.copySettingsOf(source)); + super(FabricBlockSettings.copyOf(source)); } @Override diff --git a/src/main/java/ru/bclib/blocks/BaseChainBlock.java b/src/main/java/ru/bclib/blocks/BaseChainBlock.java index 9aab0184..c2a14fe3 100644 --- a/src/main/java/ru/bclib/blocks/BaseChainBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseChainBlock.java @@ -5,8 +5,11 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import org.jetbrains.annotations.Nullable; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.core.Direction; @@ -17,18 +20,16 @@ import net.minecraft.world.level.block.ChainBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.storage.loot.LootContext; -import org.jetbrains.annotations.Nullable; import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.render.BCLRenderLayer; import ru.bclib.interfaces.IRenderTyped; -import ru.bclib.util.BlocksHelper; public class BaseChainBlock extends ChainBlock implements BlockModelProvider, IRenderTyped { public BaseChainBlock(MaterialColor color) { - super(BlocksHelper.copySettingsOf(Blocks.CHAIN).mapColor(color)); + super(FabricBlockSettings.copyOf(Blocks.CHAIN).mapColor(color)); } @Override diff --git a/src/main/java/ru/bclib/blocks/BaseChestBlock.java b/src/main/java/ru/bclib/blocks/BaseChestBlock.java index 2820b5f0..2b89b5d2 100644 --- a/src/main/java/ru/bclib/blocks/BaseChestBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseChestBlock.java @@ -3,31 +3,33 @@ package ru.bclib.blocks; import java.util.List; import java.util.Optional; +import net.minecraft.core.BlockPos; +import org.jetbrains.annotations.Nullable; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; -import net.minecraft.core.BlockPos; import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.ChestBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.LootContext; -import org.jetbrains.annotations.Nullable; import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.PatternsHelper; import ru.bclib.registry.BaseBlockEntities; -import ru.bclib.util.BlocksHelper; public class BaseChestBlock extends ChestBlock implements BlockModelProvider { private final Block parent; public BaseChestBlock(Block source) { - super(BlocksHelper.copySettingsOf(source).noOcclusion(), () -> BaseBlockEntities.CHEST); + super(FabricBlockSettings.copyOf(source).noOcclusion(), () -> BaseBlockEntities.CHEST); this.parent = source; } diff --git a/src/main/java/ru/bclib/blocks/BaseComposterBlock.java b/src/main/java/ru/bclib/blocks/BaseComposterBlock.java index 335c39ca..faecc6e5 100644 --- a/src/main/java/ru/bclib/blocks/BaseComposterBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseComposterBlock.java @@ -5,8 +5,11 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import org.jetbrains.annotations.Nullable; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.resources.ResourceLocation; @@ -15,17 +18,15 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.ComposterBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.LootContext; -import org.jetbrains.annotations.Nullable; import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper.MultiPartBuilder; import ru.bclib.client.models.PatternsHelper; -import ru.bclib.util.BlocksHelper; public class BaseComposterBlock extends ComposterBlock implements BlockModelProvider { public BaseComposterBlock(Block source) { - super(BlocksHelper.copySettingsOf(source)); + super(FabricBlockSettings.copyOf(source)); } @Override diff --git a/src/main/java/ru/bclib/blocks/BaseCraftingTableBlock.java b/src/main/java/ru/bclib/blocks/BaseCraftingTableBlock.java index 8de112e2..570758fe 100644 --- a/src/main/java/ru/bclib/blocks/BaseCraftingTableBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseCraftingTableBlock.java @@ -5,8 +5,11 @@ import java.util.HashMap; import java.util.List; import java.util.Optional; +import org.jetbrains.annotations.Nullable; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; @@ -14,16 +17,14 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.CraftingTableBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.LootContext; -import org.jetbrains.annotations.Nullable; import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.PatternsHelper; -import ru.bclib.util.BlocksHelper; public class BaseCraftingTableBlock extends CraftingTableBlock implements BlockModelProvider { public BaseCraftingTableBlock(Block source) { - super(BlocksHelper.copySettingsOf(source)); + super(FabricBlockSettings.copyOf(source)); } @Override diff --git a/src/main/java/ru/bclib/blocks/BaseDoorBlock.java b/src/main/java/ru/bclib/blocks/BaseDoorBlock.java index 95d47310..1c2c6245 100644 --- a/src/main/java/ru/bclib/blocks/BaseDoorBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseDoorBlock.java @@ -5,8 +5,11 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import org.jetbrains.annotations.Nullable; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.client.resources.model.UnbakedModel; @@ -20,18 +23,16 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.DoorHingeSide; import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; import net.minecraft.world.level.storage.loot.LootContext; -import org.jetbrains.annotations.Nullable; import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.render.BCLRenderLayer; import ru.bclib.interfaces.IRenderTyped; -import ru.bclib.util.BlocksHelper; public class BaseDoorBlock extends DoorBlock implements IRenderTyped, BlockModelProvider { public BaseDoorBlock(Block source) { - super(BlocksHelper.copySettingsOf(source).strength(3F, 3F).noOcclusion()); + super(FabricBlockSettings.copyOf(source).strength(3F, 3F).noOcclusion()); } @Override diff --git a/src/main/java/ru/bclib/blocks/BaseFenceBlock.java b/src/main/java/ru/bclib/blocks/BaseFenceBlock.java index 556c368d..85adff6e 100644 --- a/src/main/java/ru/bclib/blocks/BaseFenceBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseFenceBlock.java @@ -5,8 +5,11 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import org.jetbrains.annotations.Nullable; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.client.resources.model.UnbakedModel; @@ -17,19 +20,17 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.FenceBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.LootContext; -import org.jetbrains.annotations.Nullable; import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper.MultiPartBuilder; import ru.bclib.client.models.PatternsHelper; -import ru.bclib.util.BlocksHelper; public class BaseFenceBlock extends FenceBlock implements BlockModelProvider { private final Block parent; public BaseFenceBlock(Block source) { - super(BlocksHelper.copySettingsOf(source).noOcclusion()); + super(FabricBlockSettings.copyOf(source).noOcclusion()); this.parent = source; } diff --git a/src/main/java/ru/bclib/blocks/BaseFurnaceBlock.java b/src/main/java/ru/bclib/blocks/BaseFurnaceBlock.java index 73072a3d..925a3e45 100644 --- a/src/main/java/ru/bclib/blocks/BaseFurnaceBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseFurnaceBlock.java @@ -1,13 +1,10 @@ package ru.bclib.blocks; -import java.util.List; -import java.util.Map; -import java.util.Optional; - import com.google.common.collect.Lists; import com.google.common.collect.Maps; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.core.BlockPos; @@ -35,11 +32,14 @@ import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.render.BCLRenderLayer; import ru.bclib.interfaces.IRenderTyped; import ru.bclib.registry.BaseBlockEntities; -import ru.bclib.util.BlocksHelper; + +import java.util.List; +import java.util.Map; +import java.util.Optional; public class BaseFurnaceBlock extends FurnaceBlock implements BlockModelProvider, IRenderTyped { public BaseFurnaceBlock(Block source) { - super(BlocksHelper.copySettingsOf(source).luminance(state -> state.getValue(LIT) ? 13 : 0)); + super(FabricBlockSettings.copyOf(source).luminance(state -> state.getValue(LIT) ? 13 : 0)); } @Override diff --git a/src/main/java/ru/bclib/blocks/BaseGateBlock.java b/src/main/java/ru/bclib/blocks/BaseGateBlock.java index 0d34d48f..d765ca2d 100644 --- a/src/main/java/ru/bclib/blocks/BaseGateBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseGateBlock.java @@ -5,8 +5,11 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import org.jetbrains.annotations.Nullable; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.core.Registry; @@ -16,18 +19,16 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.FenceGateBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.LootContext; -import org.jetbrains.annotations.Nullable; import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.PatternsHelper; -import ru.bclib.util.BlocksHelper; public class BaseGateBlock extends FenceGateBlock implements BlockModelProvider { private final Block parent; public BaseGateBlock(Block source) { - super(BlocksHelper.copySettingsOf(source).noOcclusion()); + super(FabricBlockSettings.copyOf(source).noOcclusion()); this.parent = source; } diff --git a/src/main/java/ru/bclib/blocks/BaseLadderBlock.java b/src/main/java/ru/bclib/blocks/BaseLadderBlock.java index 26871dbd..93939d8f 100644 --- a/src/main/java/ru/bclib/blocks/BaseLadderBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseLadderBlock.java @@ -49,7 +49,7 @@ public class BaseLadderBlock extends BaseBlockNotFull implements IRenderTyped, B protected static final VoxelShape NORTH_SHAPE = Block.box(0.0D, 0.0D, 13.0D, 16.0D, 16.0D, 16.0D); public BaseLadderBlock(Block block) { - super(BlocksHelper.copySettingsOf(block).noOcclusion()); + super(FabricBlockSettings.copyOf(block).noOcclusion()); } @Override diff --git a/src/main/java/ru/bclib/blocks/BaseLeavesBlock.java b/src/main/java/ru/bclib/blocks/BaseLeavesBlock.java index 696f32ac..4e644f8e 100644 --- a/src/main/java/ru/bclib/blocks/BaseLeavesBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseLeavesBlock.java @@ -4,6 +4,8 @@ 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.renderer.block.model.BlockModel; import net.minecraft.resources.ResourceLocation; @@ -20,14 +22,13 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.render.BCLRenderLayer; import ru.bclib.interfaces.IRenderTyped; -import ru.bclib.util.BlocksHelper; import ru.bclib.util.MHelper; public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider, IRenderTyped { private final Block sapling; public BaseLeavesBlock(Block sapling, MaterialColor color) { - super(BlocksHelper.copySettingsOf(Blocks.OAK_LEAVES) + super(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES) .mapColor(color) .breakByTool(FabricToolTags.HOES) .breakByTool(FabricToolTags.SHEARS) @@ -39,7 +40,7 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider, } public BaseLeavesBlock(Block sapling, MaterialColor color, int light) { - super(BlocksHelper.copySettingsOf(Blocks.OAK_LEAVES) + super(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES) .mapColor(color) .luminance(light) .breakByTool(FabricToolTags.HOES) diff --git a/src/main/java/ru/bclib/blocks/BaseMetalBarsBlock.java b/src/main/java/ru/bclib/blocks/BaseMetalBarsBlock.java index 79fb4151..d4ecb9bf 100644 --- a/src/main/java/ru/bclib/blocks/BaseMetalBarsBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseMetalBarsBlock.java @@ -5,8 +5,11 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import org.jetbrains.annotations.Nullable; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.client.resources.model.UnbakedModel; @@ -18,18 +21,16 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.IronBarsBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.LootContext; -import org.jetbrains.annotations.Nullable; import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.render.BCLRenderLayer; import ru.bclib.interfaces.IRenderTyped; -import ru.bclib.util.BlocksHelper; public class BaseMetalBarsBlock extends IronBarsBlock implements BlockModelProvider, IRenderTyped { public BaseMetalBarsBlock(Block source) { - super(BlocksHelper.copySettingsOf(source).strength(5.0F, 6.0F).noOcclusion()); + super(FabricBlockSettings.copyOf(source).strength(5.0F, 6.0F).noOcclusion()); } @Override diff --git a/src/main/java/ru/bclib/blocks/BasePathBlock.java b/src/main/java/ru/bclib/blocks/BasePathBlock.java index ce068f08..75060542 100644 --- a/src/main/java/ru/bclib/blocks/BasePathBlock.java +++ b/src/main/java/ru/bclib/blocks/BasePathBlock.java @@ -5,9 +5,13 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import org.jetbrains.annotations.Nullable; + import com.google.common.collect.Maps; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.core.BlockPos; @@ -24,11 +28,9 @@ import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; -import org.jetbrains.annotations.Nullable; import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.PatternsHelper; -import ru.bclib.util.BlocksHelper; @SuppressWarnings("deprecation") public class BasePathBlock extends BaseBlockNotFull { @@ -37,7 +39,7 @@ public class BasePathBlock extends BaseBlockNotFull { private Block baseBlock; public BasePathBlock(Block source) { - super(BlocksHelper.copySettingsOf(source).isValidSpawn((state, world, pos, type) -> false)); + super(FabricBlockSettings.copyOf(source).isValidSpawn((state, world, pos, type) -> false)); this.baseBlock = Blocks.DIRT; if (source instanceof BaseTerrainBlock) { BaseTerrainBlock terrain = (BaseTerrainBlock) source; diff --git a/src/main/java/ru/bclib/blocks/BasePressurePlateBlock.java b/src/main/java/ru/bclib/blocks/BasePressurePlateBlock.java index 63015b4c..9cd483f4 100644 --- a/src/main/java/ru/bclib/blocks/BasePressurePlateBlock.java +++ b/src/main/java/ru/bclib/blocks/BasePressurePlateBlock.java @@ -5,8 +5,11 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import org.jetbrains.annotations.Nullable; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.core.Registry; @@ -16,18 +19,16 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.PressurePlateBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.LootContext; -import org.jetbrains.annotations.Nullable; import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.PatternsHelper; -import ru.bclib.util.BlocksHelper; public class BasePressurePlateBlock extends PressurePlateBlock implements BlockModelProvider { private final Block parent; public BasePressurePlateBlock(Sensitivity rule, Block source) { - super(rule, BlocksHelper.copySettingsOf(source).noCollission().noOcclusion().strength(0.5F)); + super(rule, FabricBlockSettings.copyOf(source).noCollission().noOcclusion().strength(0.5F)); this.parent = source; } diff --git a/src/main/java/ru/bclib/blocks/BaseRotatedPillarBlock.java b/src/main/java/ru/bclib/blocks/BaseRotatedPillarBlock.java index 8661d687..e5d3af50 100644 --- a/src/main/java/ru/bclib/blocks/BaseRotatedPillarBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseRotatedPillarBlock.java @@ -5,8 +5,11 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import org.jetbrains.annotations.Nullable; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.resources.ResourceLocation; @@ -15,11 +18,9 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.RotatedPillarBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.LootContext; -import org.jetbrains.annotations.Nullable; import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.PatternsHelper; -import ru.bclib.util.BlocksHelper; public class BaseRotatedPillarBlock extends RotatedPillarBlock implements BlockModelProvider { public BaseRotatedPillarBlock(Properties settings) { @@ -27,7 +28,7 @@ public class BaseRotatedPillarBlock extends RotatedPillarBlock implements BlockM } public BaseRotatedPillarBlock(Block block) { - super(BlocksHelper.copySettingsOf(block)); + super(FabricBlockSettings.copyOf(block)); } @Override diff --git a/src/main/java/ru/bclib/blocks/BaseSignBlock.java b/src/main/java/ru/bclib/blocks/BaseSignBlock.java index 1af06923..5eeb16a0 100644 --- a/src/main/java/ru/bclib/blocks/BaseSignBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseSignBlock.java @@ -62,7 +62,7 @@ public class BaseSignBlock extends SignBlock implements BlockModelProvider, ISpe private final Block parent; public BaseSignBlock(Block source) { - super(BlocksHelper.copySettingsOf(source).strength(1.0F, 1.0F).noCollission().noOcclusion(), WoodType.OAK); + super(FabricBlockSettings.copyOf(source).strength(1.0F, 1.0F).noCollission().noOcclusion(), WoodType.OAK); this.registerDefaultState(this.stateDefinition.any().setValue(ROTATION, 0).setValue(FLOOR, false).setValue(WATERLOGGED, false)); this.parent = source; } diff --git a/src/main/java/ru/bclib/blocks/BaseSlabBlock.java b/src/main/java/ru/bclib/blocks/BaseSlabBlock.java index ca7c5776..73c2e109 100644 --- a/src/main/java/ru/bclib/blocks/BaseSlabBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseSlabBlock.java @@ -5,8 +5,11 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import org.jetbrains.annotations.Nullable; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.client.resources.model.UnbakedModel; @@ -18,18 +21,16 @@ import net.minecraft.world.level.block.SlabBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.SlabType; import net.minecraft.world.level.storage.loot.LootContext; -import org.jetbrains.annotations.Nullable; import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.PatternsHelper; -import ru.bclib.util.BlocksHelper; public class BaseSlabBlock extends SlabBlock implements BlockModelProvider { private final Block parent; public BaseSlabBlock(Block source) { - super(BlocksHelper.copySettingsOf(source)); + super(FabricBlockSettings.copyOf(source)); this.parent = source; } diff --git a/src/main/java/ru/bclib/blocks/BaseStairsBlock.java b/src/main/java/ru/bclib/blocks/BaseStairsBlock.java index 9cd63bd6..2f057e78 100644 --- a/src/main/java/ru/bclib/blocks/BaseStairsBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseStairsBlock.java @@ -5,8 +5,11 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import org.jetbrains.annotations.Nullable; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.client.resources.model.UnbakedModel; @@ -19,19 +22,17 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.Half; import net.minecraft.world.level.block.state.properties.StairsShape; import net.minecraft.world.level.storage.loot.LootContext; -import org.jetbrains.annotations.Nullable; import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.PatternsHelper; -import ru.bclib.util.BlocksHelper; public class BaseStairsBlock extends StairBlock implements BlockModelProvider { private final Block parent; public BaseStairsBlock(Block source) { - super(source.defaultBlockState(), BlocksHelper.copySettingsOf(source)); + super(source.defaultBlockState(), FabricBlockSettings.copyOf(source)); this.parent = source; } diff --git a/src/main/java/ru/bclib/blocks/BaseStoneButtonBlock.java b/src/main/java/ru/bclib/blocks/BaseStoneButtonBlock.java index 12f631f8..aabc865b 100644 --- a/src/main/java/ru/bclib/blocks/BaseStoneButtonBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseStoneButtonBlock.java @@ -1,14 +1,14 @@ package ru.bclib.blocks; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.level.block.Block; -import ru.bclib.util.BlocksHelper; public class BaseStoneButtonBlock extends BaseButtonBlock { public BaseStoneButtonBlock(Block source) { - super(source, BlocksHelper.copySettingsOf(source).noOcclusion(), false); + super(source, FabricBlockSettings.copyOf(source).noOcclusion(), false); } @Override diff --git a/src/main/java/ru/bclib/blocks/BaseStripableLogBlock.java b/src/main/java/ru/bclib/blocks/BaseStripableLogBlock.java index 9f511fa6..a552e9fc 100644 --- a/src/main/java/ru/bclib/blocks/BaseStripableLogBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseStripableLogBlock.java @@ -1,5 +1,6 @@ package ru.bclib.blocks; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerPlayer; @@ -14,13 +15,12 @@ import net.minecraft.world.level.block.RotatedPillarBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.phys.BlockHitResult; -import ru.bclib.util.BlocksHelper; public class BaseStripableLogBlock extends BaseRotatedPillarBlock { private final Block striped; public BaseStripableLogBlock(MaterialColor color, Block striped) { - super(BlocksHelper.copySettingsOf(striped).mapColor(color)); + super(FabricBlockSettings.copyOf(striped).mapColor(color)); this.striped = striped; } diff --git a/src/main/java/ru/bclib/blocks/BaseTerrainBlock.java b/src/main/java/ru/bclib/blocks/BaseTerrainBlock.java index dcb12d09..fd0537c1 100644 --- a/src/main/java/ru/bclib/blocks/BaseTerrainBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseTerrainBlock.java @@ -45,7 +45,6 @@ import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.sound.BlockSounds; -import ru.bclib.util.BlocksHelper; @SuppressWarnings("deprecation") public class BaseTerrainBlock extends BaseBlock { @@ -54,7 +53,7 @@ public class BaseTerrainBlock extends BaseBlock { private Block pathBlock; public BaseTerrainBlock(Block baseBlock, MaterialColor color) { - super(BlocksHelper.copySettingsOf(baseBlock).materialColor(color).sound(BlockSounds.TERRAIN_SOUND).randomTicks()); + super(FabricBlockSettings.copyOf(baseBlock).materialColor(color).sound(BlockSounds.TERRAIN_SOUND).randomTicks()); this.baseBlock = baseBlock; } diff --git a/src/main/java/ru/bclib/blocks/BaseTrapdoorBlock.java b/src/main/java/ru/bclib/blocks/BaseTrapdoorBlock.java index c3d52bab..b0167f0e 100644 --- a/src/main/java/ru/bclib/blocks/BaseTrapdoorBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseTrapdoorBlock.java @@ -6,8 +6,11 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import org.jetbrains.annotations.Nullable; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.client.resources.model.UnbakedModel; @@ -18,18 +21,16 @@ import net.minecraft.world.level.block.TrapDoorBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.Half; import net.minecraft.world.level.storage.loot.LootContext; -import org.jetbrains.annotations.Nullable; import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.render.BCLRenderLayer; import ru.bclib.interfaces.IRenderTyped; -import ru.bclib.util.BlocksHelper; public class BaseTrapdoorBlock extends TrapDoorBlock implements IRenderTyped, BlockModelProvider { public BaseTrapdoorBlock(Block source) { - super(BlocksHelper.copySettingsOf(source).strength(3.0F, 3.0F).noOcclusion()); + super(FabricBlockSettings.copyOf(source).strength(3.0F, 3.0F).noOcclusion()); } @Override diff --git a/src/main/java/ru/bclib/blocks/BaseWallBlock.java b/src/main/java/ru/bclib/blocks/BaseWallBlock.java index cc653dd9..031f4d31 100644 --- a/src/main/java/ru/bclib/blocks/BaseWallBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseWallBlock.java @@ -5,8 +5,11 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import org.jetbrains.annotations.Nullable; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.client.resources.model.UnbakedModel; @@ -18,19 +21,17 @@ import net.minecraft.world.level.block.WallBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.WallSide; import net.minecraft.world.level.storage.loot.LootContext; -import org.jetbrains.annotations.Nullable; import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.PatternsHelper; -import ru.bclib.util.BlocksHelper; public class BaseWallBlock extends WallBlock implements BlockModelProvider { private final Block parent; public BaseWallBlock(Block source) { - super(BlocksHelper.copySettingsOf(source).noOcclusion()); + super(FabricBlockSettings.copyOf(source).noOcclusion()); this.parent = source; } diff --git a/src/main/java/ru/bclib/blocks/BaseWeightedPlateBlock.java b/src/main/java/ru/bclib/blocks/BaseWeightedPlateBlock.java index 22398932..28bbe68e 100644 --- a/src/main/java/ru/bclib/blocks/BaseWeightedPlateBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseWeightedPlateBlock.java @@ -5,8 +5,11 @@ import java.util.List; import java.util.Map; import java.util.Optional; +import org.jetbrains.annotations.Nullable; + import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.core.Registry; @@ -16,18 +19,16 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.WeightedPressurePlateBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.LootContext; -import org.jetbrains.annotations.Nullable; import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.PatternsHelper; -import ru.bclib.util.BlocksHelper; public class BaseWeightedPlateBlock extends WeightedPressurePlateBlock implements BlockModelProvider { private final Block parent; public BaseWeightedPlateBlock(Block source) { - super(15, BlocksHelper.copySettingsOf(source).noCollission().noOcclusion().requiresCorrectToolForDrops().strength(0.5F)); + super(15, FabricBlockSettings.copyOf(source).noCollission().noOcclusion().requiresCorrectToolForDrops().strength(0.5F)); this.parent = source; } diff --git a/src/main/java/ru/bclib/blocks/BaseWoodenButtonBlock.java b/src/main/java/ru/bclib/blocks/BaseWoodenButtonBlock.java index 49b2dc13..daab12c0 100644 --- a/src/main/java/ru/bclib/blocks/BaseWoodenButtonBlock.java +++ b/src/main/java/ru/bclib/blocks/BaseWoodenButtonBlock.java @@ -1,14 +1,14 @@ package ru.bclib.blocks; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.level.block.Block; -import ru.bclib.util.BlocksHelper; public class BaseWoodenButtonBlock extends BaseButtonBlock { public BaseWoodenButtonBlock(Block source) { - super(source, BlocksHelper.copySettingsOf(source).strength(0.5F, 0.5F).noOcclusion(), true); + super(source, FabricBlockSettings.copyOf(source).strength(0.5F, 0.5F).noOcclusion(), true); } @Override diff --git a/src/main/java/ru/bclib/blocks/StripableBarkBlock.java b/src/main/java/ru/bclib/blocks/StripableBarkBlock.java index 312a2e2d..d0195177 100644 --- a/src/main/java/ru/bclib/blocks/StripableBarkBlock.java +++ b/src/main/java/ru/bclib/blocks/StripableBarkBlock.java @@ -1,5 +1,6 @@ package ru.bclib.blocks; +import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerPlayer; @@ -14,13 +15,12 @@ import net.minecraft.world.level.block.RotatedPillarBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.phys.BlockHitResult; -import ru.bclib.util.BlocksHelper; public class StripableBarkBlock extends BaseBarkBlock { private final Block striped; public StripableBarkBlock(MaterialColor color, Block striped) { - super(BlocksHelper.copySettingsOf(striped).mapColor(color)); + super(FabricBlockSettings.copyOf(striped).mapColor(color)); this.striped = striped; } diff --git a/src/main/java/ru/bclib/util/BlocksHelper.java b/src/main/java/ru/bclib/util/BlocksHelper.java index 1b88b687..21b974f9 100644 --- a/src/main/java/ru/bclib/util/BlocksHelper.java +++ b/src/main/java/ru/bclib/util/BlocksHelper.java @@ -5,12 +5,6 @@ import java.util.Random; 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.fabricmc.fabric.impl.object.builder.BlockSettingsInternals; -import net.fabricmc.fabric.impl.object.builder.FabricBlockInternals; -import net.fabricmc.fabric.mixin.object.builder.AbstractBlockAccessor; -import net.fabricmc.fabric.mixin.object.builder.AbstractBlockSettingsAccessor; import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.Direction; @@ -195,25 +189,4 @@ public class BlocksHelper { return false; } } - - public static FabricBlockSettings copySettingsOf(Block block) { - FabricBlockSettings fbs = FabricBlockSettings.copyOf(block); - - AbstractBlockSettingsAccessor blockSettings = (AbstractBlockSettingsAccessor) ((AbstractBlockAccessor)block).getSettings(); - - //When settings are copied from a vanilla Block, extraData is not copied - //When a Block requires a tool, that data contains the Tag for the tool and is (by default) empty - //We will check if we created a copy of vanilla settings and if those settings require a tool. - //If so, we set the tool to a pickaxe. - if (!(blockSettings instanceof FabricBlockSettings)) { - BlockSettingsInternals blockInternals = (BlockSettingsInternals) blockSettings; - FabricBlockInternals.ExtraData extraData = blockInternals.getExtraData(); - - if (blockSettings.isToolRequired() && extraData == null) { - System.out.println("Adding PIckAXE to settings of " + block ); - fbs.breakByTool(FabricToolTags.PICKAXES); - } - } - return fbs; - } }