Revert "Added automatic tool configuration for blocks"

This reverts commit 70b109758d.
This commit is contained in:
Frank Bauer 2021-07-04 23:55:14 +02:00
parent 70b109758d
commit 67c4decf8e
29 changed files with 102 additions and 106 deletions

View file

@ -4,10 +4,14 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.Nullable;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; 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.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.resources.ResourceLocation; 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.block.state.properties.IntegerProperty;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.items.BaseAnvilItem; import ru.bclib.items.BaseAnvilItem;
import ru.bclib.util.BlocksHelper;
public abstract class BaseAnvilBlock extends AnvilBlock implements BlockModelProvider { public abstract class BaseAnvilBlock extends AnvilBlock implements BlockModelProvider {
public static final IntegerProperty DESTRUCTION = BlockProperties.DESTRUCTION; public static final IntegerProperty DESTRUCTION = BlockProperties.DESTRUCTION;
public BaseAnvilBlock(MaterialColor color) { public BaseAnvilBlock(MaterialColor color) {
super(BlocksHelper.copySettingsOf(Blocks.ANVIL).mapColor(color)); super(FabricBlockSettings.copyOf(Blocks.ANVIL).mapColor(color));
} }
@Override @Override

View file

@ -5,8 +5,11 @@ import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.Random; import java.util.Random;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.client.resources.model.BlockModelRotation;
import net.minecraft.client.resources.model.UnbakedModel; 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.monster.piglin.PiglinAi;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BarrelBlock; import net.minecraft.world.level.block.BarrelBlock;
import net.minecraft.world.level.block.Block; 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.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import org.jetbrains.annotations.Nullable;
import ru.bclib.blockentities.BaseBarrelBlockEntity; import ru.bclib.blockentities.BaseBarrelBlockEntity;
import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.registry.BaseBlockEntities; import ru.bclib.registry.BaseBlockEntities;
import ru.bclib.util.BlocksHelper;
public class BaseBarrelBlock extends BarrelBlock implements BlockModelProvider { public class BaseBarrelBlock extends BarrelBlock implements BlockModelProvider {
public BaseBarrelBlock(Block source) { public BaseBarrelBlock(Block source) {
super(BlocksHelper.copySettingsOf(source).noOcclusion()); super(FabricBlockSettings.copyOf(source).noOcclusion());
} }
@Override @Override

View file

@ -4,8 +4,11 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack; 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.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams; 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.BasePatterns;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.util.BlocksHelper;
public class BaseBookshelfBlock extends BaseBlock { public class BaseBookshelfBlock extends BaseBlock {
public BaseBookshelfBlock(Block source) { public BaseBookshelfBlock(Block source) {
super(BlocksHelper.copySettingsOf(source)); super(FabricBlockSettings.copyOf(source));
} }
@Override @Override

View file

@ -5,8 +5,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.Direction; 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.block.state.BlockState;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.client.render.BCLRenderLayer; import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped; import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.util.BlocksHelper;
public class BaseChainBlock extends ChainBlock implements BlockModelProvider, IRenderTyped { public class BaseChainBlock extends ChainBlock implements BlockModelProvider, IRenderTyped {
public BaseChainBlock(MaterialColor color) { public BaseChainBlock(MaterialColor color) {
super(BlocksHelper.copySettingsOf(Blocks.CHAIN).mapColor(color)); super(FabricBlockSettings.copyOf(Blocks.CHAIN).mapColor(color));
} }
@Override @Override

View file

@ -3,31 +3,33 @@ package ru.bclib.blocks;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import net.minecraft.core.BlockPos;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.ChestBlock; import net.minecraft.world.level.block.ChestBlock;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.registry.BaseBlockEntities; import ru.bclib.registry.BaseBlockEntities;
import ru.bclib.util.BlocksHelper;
public class BaseChestBlock extends ChestBlock implements BlockModelProvider { public class BaseChestBlock extends ChestBlock implements BlockModelProvider {
private final Block parent; private final Block parent;
public BaseChestBlock(Block source) { public BaseChestBlock(Block source) {
super(BlocksHelper.copySettingsOf(source).noOcclusion(), () -> BaseBlockEntities.CHEST); super(FabricBlockSettings.copyOf(source).noOcclusion(), () -> BaseBlockEntities.CHEST);
this.parent = source; this.parent = source;
} }

View file

@ -5,8 +5,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.resources.ResourceLocation; 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.ComposterBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.ModelsHelper.MultiPartBuilder; import ru.bclib.client.models.ModelsHelper.MultiPartBuilder;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.util.BlocksHelper;
public class BaseComposterBlock extends ComposterBlock implements BlockModelProvider { public class BaseComposterBlock extends ComposterBlock implements BlockModelProvider {
public BaseComposterBlock(Block source) { public BaseComposterBlock(Block source) {
super(BlocksHelper.copySettingsOf(source)); super(FabricBlockSettings.copyOf(source));
} }
@Override @Override

View file

@ -5,8 +5,11 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack; 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.CraftingTableBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.util.BlocksHelper;
public class BaseCraftingTableBlock extends CraftingTableBlock implements BlockModelProvider { public class BaseCraftingTableBlock extends CraftingTableBlock implements BlockModelProvider {
public BaseCraftingTableBlock(Block source) { public BaseCraftingTableBlock(Block source) {
super(BlocksHelper.copySettingsOf(source)); super(FabricBlockSettings.copyOf(source));
} }
@Override @Override

View file

@ -5,8 +5,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.client.resources.model.BlockModelRotation;
import net.minecraft.client.resources.model.UnbakedModel; 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.DoorHingeSide;
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.client.render.BCLRenderLayer; import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped; import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.util.BlocksHelper;
public class BaseDoorBlock extends DoorBlock implements IRenderTyped, BlockModelProvider { public class BaseDoorBlock extends DoorBlock implements IRenderTyped, BlockModelProvider {
public BaseDoorBlock(Block source) { public BaseDoorBlock(Block source) {
super(BlocksHelper.copySettingsOf(source).strength(3F, 3F).noOcclusion()); super(FabricBlockSettings.copyOf(source).strength(3F, 3F).noOcclusion());
} }
@Override @Override

View file

@ -5,8 +5,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.client.resources.model.BlockModelRotation;
import net.minecraft.client.resources.model.UnbakedModel; 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.FenceBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.ModelsHelper.MultiPartBuilder; import ru.bclib.client.models.ModelsHelper.MultiPartBuilder;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.util.BlocksHelper;
public class BaseFenceBlock extends FenceBlock implements BlockModelProvider { public class BaseFenceBlock extends FenceBlock implements BlockModelProvider {
private final Block parent; private final Block parent;
public BaseFenceBlock(Block source) { public BaseFenceBlock(Block source) {
super(BlocksHelper.copySettingsOf(source).noOcclusion()); super(FabricBlockSettings.copyOf(source).noOcclusion());
this.parent = source; this.parent = source;
} }

View file

@ -1,13 +1,10 @@
package ru.bclib.blocks; 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.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -35,11 +32,14 @@ import ru.bclib.client.models.PatternsHelper;
import ru.bclib.client.render.BCLRenderLayer; import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped; import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.registry.BaseBlockEntities; 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 class BaseFurnaceBlock extends FurnaceBlock implements BlockModelProvider, IRenderTyped {
public BaseFurnaceBlock(Block source) { 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 @Override

View file

@ -5,8 +5,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.Registry; 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.FenceGateBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.util.BlocksHelper;
public class BaseGateBlock extends FenceGateBlock implements BlockModelProvider { public class BaseGateBlock extends FenceGateBlock implements BlockModelProvider {
private final Block parent; private final Block parent;
public BaseGateBlock(Block source) { public BaseGateBlock(Block source) {
super(BlocksHelper.copySettingsOf(source).noOcclusion()); super(FabricBlockSettings.copyOf(source).noOcclusion());
this.parent = source; this.parent = source;
} }

View file

@ -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); protected static final VoxelShape NORTH_SHAPE = Block.box(0.0D, 0.0D, 13.0D, 16.0D, 16.0D, 16.0D);
public BaseLadderBlock(Block block) { public BaseLadderBlock(Block block) {
super(BlocksHelper.copySettingsOf(block).noOcclusion()); super(FabricBlockSettings.copyOf(block).noOcclusion());
} }
@Override @Override

View file

@ -4,6 +4,8 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags; import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.resources.ResourceLocation; 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.models.BlockModelProvider;
import ru.bclib.client.render.BCLRenderLayer; import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped; import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper; import ru.bclib.util.MHelper;
public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider, IRenderTyped { public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider, IRenderTyped {
private final Block sapling; private final Block sapling;
public BaseLeavesBlock(Block sapling, MaterialColor color) { public BaseLeavesBlock(Block sapling, MaterialColor color) {
super(BlocksHelper.copySettingsOf(Blocks.OAK_LEAVES) super(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES)
.mapColor(color) .mapColor(color)
.breakByTool(FabricToolTags.HOES) .breakByTool(FabricToolTags.HOES)
.breakByTool(FabricToolTags.SHEARS) .breakByTool(FabricToolTags.SHEARS)
@ -39,7 +40,7 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
} }
public BaseLeavesBlock(Block sapling, MaterialColor color, int light) { public BaseLeavesBlock(Block sapling, MaterialColor color, int light) {
super(BlocksHelper.copySettingsOf(Blocks.OAK_LEAVES) super(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES)
.mapColor(color) .mapColor(color)
.luminance(light) .luminance(light)
.breakByTool(FabricToolTags.HOES) .breakByTool(FabricToolTags.HOES)

View file

@ -5,8 +5,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.client.resources.model.BlockModelRotation;
import net.minecraft.client.resources.model.UnbakedModel; 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.IronBarsBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.client.render.BCLRenderLayer; import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped; import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.util.BlocksHelper;
public class BaseMetalBarsBlock extends IronBarsBlock implements BlockModelProvider, IRenderTyped { public class BaseMetalBarsBlock extends IronBarsBlock implements BlockModelProvider, IRenderTyped {
public BaseMetalBarsBlock(Block source) { 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 @Override

View file

@ -5,9 +5,13 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.Nullable;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.BlockPos; 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.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.util.BlocksHelper;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class BasePathBlock extends BaseBlockNotFull { public class BasePathBlock extends BaseBlockNotFull {
@ -37,7 +39,7 @@ public class BasePathBlock extends BaseBlockNotFull {
private Block baseBlock; private Block baseBlock;
public BasePathBlock(Block source) { 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; this.baseBlock = Blocks.DIRT;
if (source instanceof BaseTerrainBlock) { if (source instanceof BaseTerrainBlock) {
BaseTerrainBlock terrain = (BaseTerrainBlock) source; BaseTerrainBlock terrain = (BaseTerrainBlock) source;

View file

@ -5,8 +5,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.Registry; 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.PressurePlateBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.util.BlocksHelper;
public class BasePressurePlateBlock extends PressurePlateBlock implements BlockModelProvider { public class BasePressurePlateBlock extends PressurePlateBlock implements BlockModelProvider {
private final Block parent; private final Block parent;
public BasePressurePlateBlock(Sensitivity rule, Block source) { 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; this.parent = source;
} }

View file

@ -5,8 +5,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.resources.ResourceLocation; 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.RotatedPillarBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.util.BlocksHelper;
public class BaseRotatedPillarBlock extends RotatedPillarBlock implements BlockModelProvider { public class BaseRotatedPillarBlock extends RotatedPillarBlock implements BlockModelProvider {
public BaseRotatedPillarBlock(Properties settings) { public BaseRotatedPillarBlock(Properties settings) {
@ -27,7 +28,7 @@ public class BaseRotatedPillarBlock extends RotatedPillarBlock implements BlockM
} }
public BaseRotatedPillarBlock(Block block) { public BaseRotatedPillarBlock(Block block) {
super(BlocksHelper.copySettingsOf(block)); super(FabricBlockSettings.copyOf(block));
} }
@Override @Override

View file

@ -62,7 +62,7 @@ public class BaseSignBlock extends SignBlock implements BlockModelProvider, ISpe
private final Block parent; private final Block parent;
public BaseSignBlock(Block source) { 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.registerDefaultState(this.stateDefinition.any().setValue(ROTATION, 0).setValue(FLOOR, false).setValue(WATERLOGGED, false));
this.parent = source; this.parent = source;
} }

View file

@ -5,8 +5,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.client.resources.model.BlockModelRotation;
import net.minecraft.client.resources.model.UnbakedModel; 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.BlockState;
import net.minecraft.world.level.block.state.properties.SlabType; import net.minecraft.world.level.block.state.properties.SlabType;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.util.BlocksHelper;
public class BaseSlabBlock extends SlabBlock implements BlockModelProvider { public class BaseSlabBlock extends SlabBlock implements BlockModelProvider {
private final Block parent; private final Block parent;
public BaseSlabBlock(Block source) { public BaseSlabBlock(Block source) {
super(BlocksHelper.copySettingsOf(source)); super(FabricBlockSettings.copyOf(source));
this.parent = source; this.parent = source;
} }

View file

@ -5,8 +5,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.client.resources.model.BlockModelRotation;
import net.minecraft.client.resources.model.UnbakedModel; 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.Half;
import net.minecraft.world.level.block.state.properties.StairsShape; import net.minecraft.world.level.block.state.properties.StairsShape;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.util.BlocksHelper;
public class BaseStairsBlock extends StairBlock implements BlockModelProvider { public class BaseStairsBlock extends StairBlock implements BlockModelProvider {
private final Block parent; private final Block parent;
public BaseStairsBlock(Block source) { public BaseStairsBlock(Block source) {
super(source.defaultBlockState(), BlocksHelper.copySettingsOf(source)); super(source.defaultBlockState(), FabricBlockSettings.copyOf(source));
this.parent = source; this.parent = source;
} }

View file

@ -1,14 +1,14 @@
package ru.bclib.blocks; package ru.bclib.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import ru.bclib.util.BlocksHelper;
public class BaseStoneButtonBlock extends BaseButtonBlock { public class BaseStoneButtonBlock extends BaseButtonBlock {
public BaseStoneButtonBlock(Block source) { public BaseStoneButtonBlock(Block source) {
super(source, BlocksHelper.copySettingsOf(source).noOcclusion(), false); super(source, FabricBlockSettings.copyOf(source).noOcclusion(), false);
} }
@Override @Override

View file

@ -1,5 +1,6 @@
package ru.bclib.blocks; 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.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerPlayer; 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.block.state.BlockState;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import ru.bclib.util.BlocksHelper;
public class BaseStripableLogBlock extends BaseRotatedPillarBlock { public class BaseStripableLogBlock extends BaseRotatedPillarBlock {
private final Block striped; private final Block striped;
public BaseStripableLogBlock(MaterialColor color, Block striped) { public BaseStripableLogBlock(MaterialColor color, Block striped) {
super(BlocksHelper.copySettingsOf(striped).mapColor(color)); super(FabricBlockSettings.copyOf(striped).mapColor(color));
this.striped = striped; this.striped = striped;
} }

View file

@ -45,7 +45,6 @@ import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.client.sound.BlockSounds; import ru.bclib.client.sound.BlockSounds;
import ru.bclib.util.BlocksHelper;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class BaseTerrainBlock extends BaseBlock { public class BaseTerrainBlock extends BaseBlock {
@ -54,7 +53,7 @@ public class BaseTerrainBlock extends BaseBlock {
private Block pathBlock; private Block pathBlock;
public BaseTerrainBlock(Block baseBlock, MaterialColor color) { 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; this.baseBlock = baseBlock;
} }

View file

@ -6,8 +6,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.client.resources.model.BlockModelRotation;
import net.minecraft.client.resources.model.UnbakedModel; 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.BlockState;
import net.minecraft.world.level.block.state.properties.Half; import net.minecraft.world.level.block.state.properties.Half;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.client.render.BCLRenderLayer; import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IRenderTyped; import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.util.BlocksHelper;
public class BaseTrapdoorBlock extends TrapDoorBlock implements IRenderTyped, BlockModelProvider { public class BaseTrapdoorBlock extends TrapDoorBlock implements IRenderTyped, BlockModelProvider {
public BaseTrapdoorBlock(Block source) { 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 @Override

View file

@ -5,8 +5,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.client.resources.model.BlockModelRotation;
import net.minecraft.client.resources.model.UnbakedModel; 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.BlockState;
import net.minecraft.world.level.block.state.properties.WallSide; import net.minecraft.world.level.block.state.properties.WallSide;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.util.BlocksHelper;
public class BaseWallBlock extends WallBlock implements BlockModelProvider { public class BaseWallBlock extends WallBlock implements BlockModelProvider {
private final Block parent; private final Block parent;
public BaseWallBlock(Block source) { public BaseWallBlock(Block source) {
super(BlocksHelper.copySettingsOf(source).noOcclusion()); super(FabricBlockSettings.copyOf(source).noOcclusion());
this.parent = source; this.parent = source;
} }

View file

@ -5,8 +5,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.Nullable;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.Registry; 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.WeightedPressurePlateBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import org.jetbrains.annotations.Nullable;
import ru.bclib.client.models.BasePatterns; import ru.bclib.client.models.BasePatterns;
import ru.bclib.client.models.BlockModelProvider; import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.models.PatternsHelper; import ru.bclib.client.models.PatternsHelper;
import ru.bclib.util.BlocksHelper;
public class BaseWeightedPlateBlock extends WeightedPressurePlateBlock implements BlockModelProvider { public class BaseWeightedPlateBlock extends WeightedPressurePlateBlock implements BlockModelProvider {
private final Block parent; private final Block parent;
public BaseWeightedPlateBlock(Block source) { 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; this.parent = source;
} }

View file

@ -1,14 +1,14 @@
package ru.bclib.blocks; package ru.bclib.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import ru.bclib.util.BlocksHelper;
public class BaseWoodenButtonBlock extends BaseButtonBlock { public class BaseWoodenButtonBlock extends BaseButtonBlock {
public BaseWoodenButtonBlock(Block source) { 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 @Override

View file

@ -1,5 +1,6 @@
package ru.bclib.blocks; 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.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerPlayer; 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.block.state.BlockState;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import ru.bclib.util.BlocksHelper;
public class StripableBarkBlock extends BaseBarkBlock { public class StripableBarkBlock extends BaseBarkBlock {
private final Block striped; private final Block striped;
public StripableBarkBlock(MaterialColor color, Block striped) { public StripableBarkBlock(MaterialColor color, Block striped) {
super(BlocksHelper.copySettingsOf(striped).mapColor(color)); super(FabricBlockSettings.copyOf(striped).mapColor(color));
this.striped = striped; this.striped = striped;
} }

View file

@ -5,12 +5,6 @@ import java.util.Random;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.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;
import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
@ -195,25 +189,4 @@ public class BlocksHelper {
return false; 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;
}
} }