Automatic tool configuration for Blocks

This commit is contained in:
Frank Bauer 2021-07-04 18:53:00 +02:00
parent 2b71f7782a
commit 8c1f9567a5
35 changed files with 89 additions and 76 deletions

View file

@ -3,6 +3,7 @@ package ru.betterend.blocks;
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.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.core.BlockPos;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
@ -17,6 +18,7 @@ public class AeterniumBlock extends BaseBlock {
super(FabricBlockSettings.of(Material.METAL, MaterialColor.COLOR_GRAY) super(FabricBlockSettings.of(Material.METAL, MaterialColor.COLOR_GRAY)
.hardness(65F) .hardness(65F)
.resistance(1200F) .resistance(1200F)
.breakByTool(FabricToolTags.PICKAXES)
.requiresCorrectToolForDrops() .requiresCorrectToolForDrops()
.sound(SoundType.NETHERITE_BLOCK)); .sound(SoundType.NETHERITE_BLOCK));
} }

View file

@ -1,12 +1,12 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MaterialColor;
import ru.bclib.blocks.BaseRotatedPillarBlock; import ru.bclib.blocks.BaseRotatedPillarBlock;
import ru.bclib.util.BlocksHelper;
public class AmaranitaStemBlock extends BaseRotatedPillarBlock { public class AmaranitaStemBlock extends BaseRotatedPillarBlock {
public AmaranitaStemBlock() { public AmaranitaStemBlock() {
super(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).materialColor(MaterialColor.COLOR_LIGHT_GREEN)); super(BlocksHelper.copySettingsOf(Blocks.OAK_PLANKS).materialColor(MaterialColor.COLOR_LIGHT_GREEN));
} }
} }

View file

@ -1,12 +1,12 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MaterialColor;
import ru.bclib.blocks.BaseBlock; import ru.bclib.blocks.BaseBlock;
import ru.bclib.util.BlocksHelper;
public class AmberBlock extends BaseBlock { public class AmberBlock extends BaseBlock {
public AmberBlock() { public AmberBlock() {
super(FabricBlockSettings.copyOf(Blocks.DIAMOND_BLOCK).materialColor(MaterialColor.COLOR_YELLOW)); super(BlocksHelper.copySettingsOf(Blocks.DIAMOND_BLOCK).materialColor(MaterialColor.COLOR_YELLOW));
} }
} }

View file

@ -4,7 +4,6 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
@ -23,7 +22,7 @@ import ru.betterend.registry.EndParticles;
public class AncientEmeraldIceBlock extends BaseBlock { public class AncientEmeraldIceBlock extends BaseBlock {
public AncientEmeraldIceBlock() { public AncientEmeraldIceBlock() {
super(FabricBlockSettings.copyOf(Blocks.BLUE_ICE).randomTicks()); super(BlocksHelper.copySettingsOf(Blocks.BLUE_ICE).randomTicks());
} }
@Override @Override

View file

@ -4,7 +4,6 @@ import java.util.Random;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
@ -29,7 +28,7 @@ public class BrimstoneBlock extends BaseBlock {
public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE; public static final BooleanProperty ACTIVATED = BlockProperties.ACTIVE;
public BrimstoneBlock() { public BrimstoneBlock() {
super(FabricBlockSettings.copyOf(Blocks.END_STONE).materialColor(MaterialColor.COLOR_BROWN).randomTicks()); super(BlocksHelper.copySettingsOf(Blocks.END_STONE).materialColor(MaterialColor.COLOR_BROWN).randomTicks());
registerDefaultState(stateDefinition.any().setValue(ACTIVATED, false)); registerDefaultState(stateDefinition.any().setValue(ACTIVATED, false));
} }

View file

@ -3,7 +3,6 @@ package ru.betterend.blocks;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
@ -20,6 +19,7 @@ import ru.bclib.blocks.BaseBlockNotFull;
import ru.bclib.blocks.BlockProperties; import ru.bclib.blocks.BlockProperties;
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.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
public class CavePumpkinBlock extends BaseBlockNotFull implements IRenderTyped { public class CavePumpkinBlock extends BaseBlockNotFull implements IRenderTyped {
@ -28,7 +28,7 @@ public class CavePumpkinBlock extends BaseBlockNotFull implements IRenderTyped {
private static final VoxelShape SHAPE_BIG; private static final VoxelShape SHAPE_BIG;
public CavePumpkinBlock() { public CavePumpkinBlock() {
super(FabricBlockSettings.copyOf(Blocks.PUMPKIN).luminance((state) -> state.getValue(SMALL) ? 10 : 15)); super(BlocksHelper.copySettingsOf(Blocks.PUMPKIN).luminance((state) -> state.getValue(SMALL) ? 10 : 15));
registerDefaultState(defaultBlockState().setValue(SMALL, false)); registerDefaultState(defaultBlockState().setValue(SMALL, false));
} }

View file

@ -10,7 +10,7 @@ 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.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.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;
@ -28,13 +28,20 @@ import ru.bclib.client.models.BlockModelProvider;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
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.betterend.client.models.Patterns; import ru.betterend.client.models.Patterns;
public class ChandelierBlock extends BaseAttachedBlock implements IRenderTyped, BlockModelProvider { public class ChandelierBlock extends BaseAttachedBlock implements IRenderTyped, BlockModelProvider {
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class); private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
public ChandelierBlock(Block source) { public ChandelierBlock(Block source) {
super(FabricBlockSettings.copyOf(source).luminance(15).noCollission().noOcclusion().requiresCorrectToolForDrops()); super(BlocksHelper.copySettingsOf(source)
.breakByTool(FabricToolTags.PICKAXES)
.luminance(15)
.noCollission()
.noOcclusion()
.requiresCorrectToolForDrops()
);
} }
@Override @Override

View file

@ -1,13 +1,13 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.registry.FuelRegistry; import net.fabricmc.fabric.api.registry.FuelRegistry;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import ru.bclib.blocks.BaseBlock; import ru.bclib.blocks.BaseBlock;
import ru.bclib.util.BlocksHelper;
public class CharcoalBlock extends BaseBlock { public class CharcoalBlock extends BaseBlock {
public CharcoalBlock() { public CharcoalBlock() {
super(FabricBlockSettings.copyOf(Blocks.COAL_BLOCK)); super(BlocksHelper.copySettingsOf(Blocks.COAL_BLOCK));
FuelRegistry.INSTANCE.add(this, 16000); FuelRegistry.INSTANCE.add(this, 16000);
} }
} }

View file

@ -3,7 +3,6 @@ package ru.betterend.blocks;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.item.enchantment.Enchantments;
@ -14,10 +13,11 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import ru.bclib.blocks.BaseBlock; import ru.bclib.blocks.BaseBlock;
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 DenseEmeraldIceBlock extends BaseBlock implements IRenderTyped { public class DenseEmeraldIceBlock extends BaseBlock implements IRenderTyped {
public DenseEmeraldIceBlock() { public DenseEmeraldIceBlock() {
super(FabricBlockSettings.copyOf(Blocks.PACKED_ICE)); super(BlocksHelper.copySettingsOf(Blocks.PACKED_ICE));
} }
@Override @Override

View file

@ -8,7 +8,6 @@ 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.BlockPos;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
@ -29,10 +28,11 @@ 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;
public class EmeraldIceBlock extends HalfTransparentBlock implements IRenderTyped, BlockModelProvider { public class EmeraldIceBlock extends HalfTransparentBlock implements IRenderTyped, BlockModelProvider {
public EmeraldIceBlock() { public EmeraldIceBlock() {
super(FabricBlockSettings.copyOf(Blocks.ICE)); super(BlocksHelper.copySettingsOf(Blocks.ICE));
} }
@Override @Override

View file

@ -4,7 +4,6 @@ import java.util.Map;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis; import net.minecraft.core.Direction.Axis;
@ -40,7 +39,7 @@ public class EndLotusStemBlock extends BaseBlock implements SimpleWaterloggedBlo
private static final Map<Axis, VoxelShape> SHAPES = Maps.newEnumMap(Axis.class); private static final Map<Axis, VoxelShape> SHAPES = Maps.newEnumMap(Axis.class);
public EndLotusStemBlock() { public EndLotusStemBlock() {
super(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS)); super(BlocksHelper.copySettingsOf(Blocks.OAK_PLANKS));
this.registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false).setValue(SHAPE, TripleShape.MIDDLE).setValue(LEAF, false).setValue(FACING, Direction.UP)); this.registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false).setValue(SHAPE, TripleShape.MIDDLE).setValue(LEAF, false).setValue(FACING, Direction.UP));
} }

View file

@ -6,7 +6,6 @@ import java.util.Random;
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.color.block.BlockColor; import net.minecraft.client.color.block.BlockColor;
import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.color.item.ItemColor;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -35,6 +34,7 @@ import net.minecraft.world.level.dimension.DimensionType;
import ru.bclib.client.render.BCLRenderLayer; import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IColorProvider; import ru.bclib.interfaces.IColorProvider;
import ru.bclib.interfaces.IRenderTyped; import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.util.BlocksHelper;
import ru.betterend.interfaces.TeleportingEntity; import ru.betterend.interfaces.TeleportingEntity;
import ru.betterend.registry.EndParticles; import ru.betterend.registry.EndParticles;
import ru.betterend.registry.EndPortals; import ru.betterend.registry.EndPortals;
@ -44,7 +44,7 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTyped, I
public static final IntegerProperty PORTAL = EndBlockProperties.PORTAL; public static final IntegerProperty PORTAL = EndBlockProperties.PORTAL;
public EndPortalBlock() { public EndPortalBlock() {
super(FabricBlockSettings.copyOf(Blocks.NETHER_PORTAL).resistance(Blocks.BEDROCK.getExplosionResistance()).luminance(15)); super(BlocksHelper.copySettingsOf(Blocks.NETHER_PORTAL).resistance(Blocks.BEDROCK.getExplosionResistance()).luminance(15));
} }
@Override @Override

View file

@ -1,9 +1,15 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import java.util.List;
import java.util.Random;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
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.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.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
@ -16,7 +22,12 @@ import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
@ -30,14 +41,10 @@ import net.minecraft.world.level.material.MaterialColor;
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 net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import org.jetbrains.annotations.Nullable;
import ru.bclib.blocks.BaseBlockWithEntity; import ru.bclib.blocks.BaseBlockWithEntity;
import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity; import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;
import ru.betterend.registry.EndBlockEntities; import ru.betterend.registry.EndBlockEntities;
import java.util.List;
import java.util.Random;
public class EndStoneSmelter extends BaseBlockWithEntity { public class EndStoneSmelter extends BaseBlockWithEntity {
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
public static final BooleanProperty LIT = BlockStateProperties.LIT; public static final BooleanProperty LIT = BlockStateProperties.LIT;
@ -47,6 +54,7 @@ public class EndStoneSmelter extends BaseBlockWithEntity {
super(FabricBlockSettings.of(Material.STONE, MaterialColor.COLOR_GRAY) super(FabricBlockSettings.of(Material.STONE, MaterialColor.COLOR_GRAY)
.hardness(4F) .hardness(4F)
.resistance(100F) .resistance(100F)
.breakByTool(FabricToolTags.PICKAXES)
.requiresCorrectToolForDrops() .requiresCorrectToolForDrops()
.sound(SoundType.STONE)); .sound(SoundType.STONE));
this.registerDefaultState(this.stateDefinition.any() this.registerDefaultState(this.stateDefinition.any()

View file

@ -3,6 +3,7 @@ package ru.betterend.blocks;
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.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.core.BlockPos;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
@ -17,6 +18,7 @@ public class EnderBlock extends BaseBlock {
super(FabricBlockSettings.of(Material.STONE, MaterialColor.WARPED_WART_BLOCK) super(FabricBlockSettings.of(Material.STONE, MaterialColor.WARPED_WART_BLOCK)
.hardness(5F) .hardness(5F)
.resistance(6F) .resistance(6F)
.breakByTool(FabricToolTags.PICKAXES)
.requiresCorrectToolForDrops() .requiresCorrectToolForDrops()
.sound(SoundType.STONE)); .sound(SoundType.STONE));
} }

View file

@ -5,7 +5,6 @@ import java.util.List;
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.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.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
@ -14,6 +13,7 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.FallingBlock; import net.minecraft.world.level.block.FallingBlock;
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 ru.bclib.util.BlocksHelper;
import ru.bclib.util.ColorUtil; import ru.bclib.util.ColorUtil;
public class EndstoneDustBlock extends FallingBlock { public class EndstoneDustBlock extends FallingBlock {
@ -21,7 +21,7 @@ public class EndstoneDustBlock extends FallingBlock {
private static final int COLOR = ColorUtil.color(226, 239, 168); private static final int COLOR = ColorUtil.color(226, 239, 168);
public EndstoneDustBlock() { public EndstoneDustBlock() {
super(FabricBlockSettings.copyOf(Blocks.SAND) super(BlocksHelper.copySettingsOf(Blocks.SAND)
.breakByTool(FabricToolTags.SHOVELS) .breakByTool(FabricToolTags.SHOVELS)
.materialColor(Blocks.END_STONE.defaultMaterialColor())); .materialColor(Blocks.END_STONE.defaultMaterialColor()));
} }

View file

@ -9,7 +9,6 @@ import com.google.common.collect.Lists;
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.color.block.BlockColor; import net.minecraft.client.color.block.BlockColor;
import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.color.item.ItemColor;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
@ -30,6 +29,7 @@ import ru.bclib.client.models.ModelsHelper;
import ru.bclib.client.render.BCLRenderLayer; import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.IColorProvider; import ru.bclib.interfaces.IColorProvider;
import ru.bclib.interfaces.IRenderTyped; import ru.bclib.interfaces.IRenderTyped;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.ColorUtil; import ru.bclib.util.ColorUtil;
import ru.bclib.util.MHelper; import ru.bclib.util.MHelper;
import ru.betterend.client.models.Patterns; import ru.betterend.client.models.Patterns;
@ -43,7 +43,7 @@ public class JellyshroomCapBlock extends SlimeBlock implements IRenderTyped, Blo
private final int coloritem; private final int coloritem;
public JellyshroomCapBlock(int r1, int g1, int b1, int r2, int g2, int b2) { public JellyshroomCapBlock(int r1, int g1, int b1, int r2, int g2, int b2) {
super(FabricBlockSettings.copyOf(Blocks.SLIME_BLOCK)); super(BlocksHelper.copySettingsOf(Blocks.SLIME_BLOCK));
colorStart = new Vec3i(r1, g1, b1); colorStart = new Vec3i(r1, g1, b1);
colorEnd = new Vec3i(r2, g2, b2); colorEnd = new Vec3i(r2, g2, b2);
coloritem = ColorUtil.color((r1 + r2) >> 1, (g1 + g2) >> 1, (b1 + b2) >> 1); coloritem = ColorUtil.color((r1 + r2) >> 1, (g1 + g2) >> 1, (b1 + b2) >> 1);

View file

@ -4,7 +4,6 @@ import java.util.Queue;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.tags.FluidTags; import net.minecraft.tags.FluidTags;
@ -17,17 +16,17 @@ import net.minecraft.world.level.block.LiquidBlock;
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.material.FluidState; import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import ru.bclib.blocks.BaseBlockNotFull; import ru.bclib.blocks.BaseBlockNotFull;
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.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class MengerSpongeBlock extends BaseBlockNotFull implements IRenderTyped { public class MengerSpongeBlock extends BaseBlockNotFull implements IRenderTyped {
public MengerSpongeBlock() { public MengerSpongeBlock() {
super(FabricBlockSettings.copyOf(Blocks.SPONGE).noOcclusion()); super(BlocksHelper.copySettingsOf(Blocks.SPONGE).noOcclusion());
} }
@Override @Override

View file

@ -4,7 +4,6 @@ import java.util.Random;
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.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
@ -28,7 +27,7 @@ import ru.betterend.registry.EndBlocks;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class MengerSpongeWetBlock extends BaseBlockNotFull implements IRenderTyped { public class MengerSpongeWetBlock extends BaseBlockNotFull implements IRenderTyped {
public MengerSpongeWetBlock() { public MengerSpongeWetBlock() {
super(FabricBlockSettings.copyOf(Blocks.WET_SPONGE).noOcclusion()); super(BlocksHelper.copySettingsOf(Blocks.WET_SPONGE).noOcclusion());
} }
@Override @Override

View file

@ -1,11 +1,11 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import ru.bclib.blocks.BaseBlock; import ru.bclib.blocks.BaseBlock;
import ru.bclib.util.BlocksHelper;
public class MissingTileBlock extends BaseBlock { public class MissingTileBlock extends BaseBlock {
public MissingTileBlock() { public MissingTileBlock() {
super(FabricBlockSettings.copyOf(Blocks.END_STONE)); super(BlocksHelper.copySettingsOf(Blocks.END_STONE));
} }
} }

View file

@ -4,7 +4,6 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
@ -19,12 +18,13 @@ import net.minecraft.world.level.lighting.LayerLightEngine;
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 ru.bclib.blocks.BaseRotatedPillarBlock; import ru.bclib.blocks.BaseRotatedPillarBlock;
import ru.bclib.util.BlocksHelper;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class MossyDragonBoneBlock extends BaseRotatedPillarBlock { public class MossyDragonBoneBlock extends BaseRotatedPillarBlock {
public MossyDragonBoneBlock() { public MossyDragonBoneBlock() {
super(FabricBlockSettings.copyOf(Blocks.BONE_BLOCK).hardness(0.5F).randomTicks()); super(BlocksHelper.copySettingsOf(Blocks.BONE_BLOCK).hardness(0.5F).randomTicks());
} }
@Override @Override

View file

@ -4,7 +4,6 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
@ -19,10 +18,11 @@ import net.minecraft.world.level.lighting.LayerLightEngine;
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 ru.bclib.blocks.BaseBlock; import ru.bclib.blocks.BaseBlock;
import ru.bclib.util.BlocksHelper;
public class MossyObsidian extends BaseBlock { public class MossyObsidian extends BaseBlock {
public MossyObsidian() { public MossyObsidian() {
super(FabricBlockSettings.copyOf(Blocks.OBSIDIAN).hardness(3).randomTicks()); super(BlocksHelper.copySettingsOf(Blocks.OBSIDIAN).hardness(3).randomTicks());
} }
@Override @Override

View file

@ -1,11 +1,11 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import ru.bclib.blocks.BaseRotatedPillarBlock; import ru.bclib.blocks.BaseRotatedPillarBlock;
import ru.bclib.util.BlocksHelper;
public class NeonCactusBlock extends BaseRotatedPillarBlock { public class NeonCactusBlock extends BaseRotatedPillarBlock {
public NeonCactusBlock() { public NeonCactusBlock() {
super(FabricBlockSettings.copyOf(Blocks.CACTUS).luminance(15)); super(BlocksHelper.copySettingsOf(Blocks.CACTUS).luminance(15));
} }
} }

View file

@ -7,7 +7,6 @@ import java.util.Random;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.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;
@ -64,7 +63,7 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
private static final int MAX_LENGTH = 12; private static final int MAX_LENGTH = 12;
public NeonCactusPlantBlock() { public NeonCactusPlantBlock() {
super(FabricBlockSettings.copyOf(Blocks.CACTUS).luminance(15).randomTicks()); super(BlocksHelper.copySettingsOf(Blocks.CACTUS).luminance(15).randomTicks());
registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false).setValue(FACING, Direction.UP).setValue(SHAPE, TripleShape.TOP)); registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false).setValue(FACING, Direction.UP).setValue(SHAPE, TripleShape.TOP));
} }

View file

@ -6,7 +6,6 @@ import org.jetbrains.annotations.Nullable;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.color.block.BlockColor; import net.minecraft.client.color.block.BlockColor;
import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.color.item.ItemColor;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -54,7 +53,7 @@ public class RespawnObeliskBlock extends BaseBlock implements IColorProvider, IR
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE; public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
public RespawnObeliskBlock() { public RespawnObeliskBlock() {
super(FabricBlockSettings.copyOf(Blocks.END_STONE).luminance((state) -> { super(BlocksHelper.copySettingsOf(Blocks.END_STONE).luminance((state) -> {
return (state.getValue(SHAPE) == TripleShape.BOTTOM) ? 0 : 15; return (state.getValue(SHAPE) == TripleShape.BOTTOM) ? 0 : 15;
})); }));
} }

View file

@ -1,6 +1,5 @@
package ru.betterend.blocks; package ru.betterend.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
@ -27,7 +26,7 @@ public class UmbrellaTreeClusterBlock extends BaseBlock {
public static final BooleanProperty NATURAL = BlockProperties.NATURAL; public static final BooleanProperty NATURAL = BlockProperties.NATURAL;
public UmbrellaTreeClusterBlock() { public UmbrellaTreeClusterBlock() {
super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK) super(BlocksHelper.copySettingsOf(Blocks.NETHER_WART_BLOCK)
.materialColor(MaterialColor.COLOR_PURPLE) .materialColor(MaterialColor.COLOR_PURPLE)
.luminance(15)); .luminance(15));
registerDefaultState(stateDefinition.any().setValue(NATURAL, false)); registerDefaultState(stateDefinition.any().setValue(NATURAL, false));

View file

@ -2,7 +2,6 @@ package ru.betterend.blocks;
import java.util.Random; import java.util.Random;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
@ -19,7 +18,7 @@ public class UmbrellaTreeClusterEmptyBlock extends BaseBlock {
public static final BooleanProperty NATURAL = EndBlockProperties.NATURAL; public static final BooleanProperty NATURAL = EndBlockProperties.NATURAL;
public UmbrellaTreeClusterEmptyBlock() { public UmbrellaTreeClusterEmptyBlock() {
super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK) super(BlocksHelper.copySettingsOf(Blocks.NETHER_WART_BLOCK)
.materialColor(MaterialColor.COLOR_PURPLE) .materialColor(MaterialColor.COLOR_PURPLE)
.randomTicks()); .randomTicks());
registerDefaultState(stateDefinition.any().setValue(NATURAL, false)); registerDefaultState(stateDefinition.any().setValue(NATURAL, false));

View file

@ -7,7 +7,6 @@ import com.google.common.collect.Lists;
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.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
@ -25,6 +24,7 @@ import net.minecraft.world.level.storage.loot.LootContext;
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;
import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
@ -34,7 +34,7 @@ public class UmbrellaTreeMembraneBlock extends SlimeBlock implements IRenderType
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0); private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0);
public UmbrellaTreeMembraneBlock() { public UmbrellaTreeMembraneBlock() {
super(FabricBlockSettings.copyOf(Blocks.SLIME_BLOCK)); super(BlocksHelper.copySettingsOf(Blocks.SLIME_BLOCK));
} }
@Override @Override

View file

@ -4,7 +4,6 @@ import java.util.Map;
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.resources.model.UnbakedModel; import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
@ -27,6 +26,7 @@ import net.minecraft.world.level.material.Fluids;
import ru.bclib.blocks.BaseBlockNotFull; import ru.bclib.blocks.BaseBlockNotFull;
import ru.bclib.blocks.BlockProperties; import ru.bclib.blocks.BlockProperties;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.util.BlocksHelper;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class EndLanternBlock extends BaseBlockNotFull implements SimpleWaterloggedBlock, LiquidBlockContainer { public class EndLanternBlock extends BaseBlockNotFull implements SimpleWaterloggedBlock, LiquidBlockContainer {
@ -34,7 +34,7 @@ public class EndLanternBlock extends BaseBlockNotFull implements SimpleWaterlogg
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
public EndLanternBlock(Block source) { public EndLanternBlock(Block source) {
this(FabricBlockSettings.copyOf(source).luminance(15).noOcclusion()); this(BlocksHelper.copySettingsOf(source).luminance(15).noOcclusion());
} }
public EndLanternBlock(Properties settings) { public EndLanternBlock(Properties settings) {

View file

@ -6,15 +6,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import net.minecraft.world.level.block.entity.BlockEntityTicker; import com.google.common.collect.Lists;
import net.minecraft.world.level.block.entity.BlockEntityType;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import com.google.common.collect.Lists;
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.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;
@ -34,6 +28,8 @@ import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.BooleanProperty;
@ -44,9 +40,12 @@ import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import ru.bclib.blocks.BaseBlockNotFull; import ru.bclib.blocks.BaseBlockNotFull;
import ru.bclib.blocks.BlockProperties; import ru.bclib.blocks.BlockProperties;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.util.BlocksHelper;
import ru.betterend.blocks.EndBlockProperties; import ru.betterend.blocks.EndBlockProperties;
import ru.betterend.blocks.EndBlockProperties.PedestalState; import ru.betterend.blocks.EndBlockProperties.PedestalState;
import ru.betterend.blocks.InfusionPedestal; import ru.betterend.blocks.InfusionPedestal;
@ -98,7 +97,7 @@ public class PedestalBlock extends BaseBlockNotFull implements EntityBlock {
protected float height = 1.0F; protected float height = 1.0F;
public PedestalBlock(Block parent) { public PedestalBlock(Block parent) {
super(FabricBlockSettings.copyOf(parent).luminance(state -> state.getValue(HAS_LIGHT) ? 12 : 0)); super(BlocksHelper.copySettingsOf(parent).luminance(state -> state.getValue(HAS_LIGHT) ? 12 : 0));
this.registerDefaultState(stateDefinition.any().setValue(STATE, PedestalState.DEFAULT).setValue(HAS_ITEM, false).setValue(HAS_LIGHT, false)); this.registerDefaultState(stateDefinition.any().setValue(STATE, PedestalState.DEFAULT).setValue(HAS_ITEM, false).setValue(HAS_LIGHT, false));
this.parent = parent; this.parent = parent;
} }

View file

@ -6,7 +6,6 @@ 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.color.block.BlockColor; import net.minecraft.client.color.block.BlockColor;
import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.color.item.ItemColor;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
@ -19,6 +18,7 @@ import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import ru.bclib.client.models.ModelsHelper; import ru.bclib.client.models.ModelsHelper;
import ru.bclib.interfaces.IColorProvider; import ru.bclib.interfaces.IColorProvider;
import ru.bclib.util.BlocksHelper;
import ru.betterend.client.models.Patterns; import ru.betterend.client.models.Patterns;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
@ -27,7 +27,7 @@ public class StoneLanternBlock extends EndLanternBlock implements IColorProvider
private static final VoxelShape SHAPE_FLOOR = Block.box(3, 0, 3, 13, 15, 13); private static final VoxelShape SHAPE_FLOOR = Block.box(3, 0, 3, 13, 15, 13);
public StoneLanternBlock(Block source) { public StoneLanternBlock(Block source) {
super(FabricBlockSettings.copyOf(source).luminance(15)); super(BlocksHelper.copySettingsOf(source).luminance(15));
} }
@Override @Override

View file

@ -31,7 +31,7 @@ public class ColoredMaterial {
String id = Registry.BLOCK.getKey(source).getPath(); String id = Registry.BLOCK.getKey(source).getPath();
colors.forEach((color, name) -> { colors.forEach((color, name) -> {
String blockName = id + "_" + name; String blockName = id + "_" + name;
Block block = constructor.apply(FabricBlockSettings.copyOf(source).materialColor(MaterialColor.COLOR_BLACK)); Block block = constructor.apply(BlocksHelper.copySettingsOf(source).materialColor(MaterialColor.COLOR_BLACK));
EndBlocks.registerBlock(blockName, block); EndBlocks.registerBlock(blockName, block);
if (craftEight) { if (craftEight) {
GridRecipe.make(BetterEnd.MOD_ID, blockName, block).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(8).setShape("###", "#D#", "###").addMaterial('#', source).addMaterial('D', dyes.get(color)).build(); GridRecipe.make(BetterEnd.MOD_ID, blockName, block).checkConfig(Configs.RECIPE_CONFIG).setOutputCount(8).setShape("###", "#D#", "###").addMaterial('#', source).addMaterial('D', dyes.get(color)).build();

View file

@ -10,6 +10,7 @@ import ru.bclib.blocks.BaseSlabBlock;
import ru.bclib.blocks.BaseStairsBlock; import ru.bclib.blocks.BaseStairsBlock;
import ru.bclib.blocks.BaseWallBlock; import ru.bclib.blocks.BaseWallBlock;
import ru.bclib.recipes.GridRecipe; import ru.bclib.recipes.GridRecipe;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.TagHelper; import ru.bclib.util.TagHelper;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.blocks.EndPedestal; import ru.betterend.blocks.EndPedestal;
@ -31,7 +32,7 @@ public class CrystalSubblocksMaterial {
public final Block brick_wall; public final Block brick_wall;
public CrystalSubblocksMaterial(String name, Block source) { public CrystalSubblocksMaterial(String name, Block source) {
FabricBlockSettings material = FabricBlockSettings.copyOf(source); FabricBlockSettings material = BlocksHelper.copySettingsOf(source);
polished = EndBlocks.registerBlock(name + "_polished", new BaseBlock(material)); polished = EndBlocks.registerBlock(name + "_polished", new BaseBlock(material));
tiles = EndBlocks.registerBlock(name + "_tiles", new BaseBlock(material)); tiles = EndBlocks.registerBlock(name + "_tiles", new BaseBlock(material));
pillar = EndBlocks.registerBlock(name + "_pillar", new BaseRotatedPillarBlock(material)); pillar = EndBlocks.registerBlock(name + "_pillar", new BaseRotatedPillarBlock(material));

View file

@ -31,6 +31,7 @@ import ru.bclib.items.tool.BaseSwordItem;
import ru.bclib.recipes.FurnaceRecipe; import ru.bclib.recipes.FurnaceRecipe;
import ru.bclib.recipes.GridRecipe; import ru.bclib.recipes.GridRecipe;
import ru.bclib.recipes.SmithingTableRecipe; import ru.bclib.recipes.SmithingTableRecipe;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.TagHelper; import ru.bclib.util.TagHelper;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.blocks.BulbVineLanternBlock; import ru.betterend.blocks.BulbVineLanternBlock;
@ -90,26 +91,26 @@ public class MetalMaterial {
public final Item boots; public final Item boots;
public static MetalMaterial makeNormal(String name, MaterialColor color, Tier material, ArmorMaterial armor) { public static MetalMaterial makeNormal(String name, MaterialColor color, Tier material, ArmorMaterial armor) {
return new MetalMaterial(name, true, FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).materialColor(color), EndItems.makeEndItemSettings(), material, armor); return new MetalMaterial(name, true, BlocksHelper.copySettingsOf(Blocks.IRON_BLOCK).materialColor(color), EndItems.makeEndItemSettings(), material, armor);
} }
public static MetalMaterial makeNormal(String name, MaterialColor color, float hardness, float resistance, Tier material, ArmorMaterial armor) { public static MetalMaterial makeNormal(String name, MaterialColor color, float hardness, float resistance, Tier material, ArmorMaterial armor) {
return new MetalMaterial(name, true, FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).materialColor(color).hardness(hardness).resistance(resistance), EndItems.makeEndItemSettings(), material, armor); return new MetalMaterial(name, true, BlocksHelper.copySettingsOf(Blocks.IRON_BLOCK).materialColor(color).hardness(hardness).resistance(resistance), EndItems.makeEndItemSettings(), material, armor);
} }
public static MetalMaterial makeOreless(String name, MaterialColor color, Tier material, ArmorMaterial armor) { public static MetalMaterial makeOreless(String name, MaterialColor color, Tier material, ArmorMaterial armor) {
return new MetalMaterial(name, false, FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).materialColor(color), EndItems.makeEndItemSettings(), material, armor); return new MetalMaterial(name, false, BlocksHelper.copySettingsOf(Blocks.IRON_BLOCK).materialColor(color), EndItems.makeEndItemSettings(), material, armor);
} }
public static MetalMaterial makeOreless(String name, MaterialColor color, float hardness, float resistance, Tier material, ArmorMaterial armor) { public static MetalMaterial makeOreless(String name, MaterialColor color, float hardness, float resistance, Tier material, ArmorMaterial armor) {
return new MetalMaterial(name, false, FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).materialColor(color).hardness(hardness).resistance(resistance), EndItems.makeEndItemSettings(), material, armor); return new MetalMaterial(name, false, BlocksHelper.copySettingsOf(Blocks.IRON_BLOCK).materialColor(color).hardness(hardness).resistance(resistance), EndItems.makeEndItemSettings(), material, armor);
} }
private MetalMaterial(String name, boolean hasOre, FabricBlockSettings settings, Properties itemSettings, Tier material, ArmorMaterial armor) { private MetalMaterial(String name, boolean hasOre, FabricBlockSettings settings, Properties itemSettings, Tier material, ArmorMaterial armor) {
BlockBehaviour.Properties lanternProperties = FabricBlockSettings.copyOf(settings).hardness(1).resistance(1).luminance(15).sound(SoundType.LANTERN); BlockBehaviour.Properties lanternProperties = FabricBlockSettings.copyOf(settings).hardness(1).resistance(1).luminance(15).sound(SoundType.LANTERN);
final int level = material.getLevel(); final int level = material.getLevel();
ore = hasOre ? EndBlocks.registerBlock(name + "_ore", new BaseBlock(FabricBlockSettings.copyOf(Blocks.END_STONE))) : null; ore = hasOre ? EndBlocks.registerBlock(name + "_ore", new BaseBlock(BlocksHelper.copySettingsOf(Blocks.END_STONE))) : null;
block = EndBlocks.registerBlock(name + "_block", new BaseBlock(settings)); block = EndBlocks.registerBlock(name + "_block", new BaseBlock(settings));
tile = EndBlocks.registerBlock(name + "_tile", new BaseBlock(settings)); tile = EndBlocks.registerBlock(name + "_tile", new BaseBlock(settings));
stairs = EndBlocks.registerBlock(name + "_stairs", new BaseStairsBlock(tile)); stairs = EndBlocks.registerBlock(name + "_stairs", new BaseStairsBlock(tile));

View file

@ -16,6 +16,7 @@ import ru.bclib.blocks.BaseStoneButtonBlock;
import ru.bclib.blocks.BaseWallBlock; import ru.bclib.blocks.BaseWallBlock;
import ru.bclib.blocks.StonePressurePlateBlock; import ru.bclib.blocks.StonePressurePlateBlock;
import ru.bclib.recipes.GridRecipe; import ru.bclib.recipes.GridRecipe;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.TagHelper; import ru.bclib.util.TagHelper;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.blocks.EndPedestal; import ru.betterend.blocks.EndPedestal;
@ -46,7 +47,7 @@ public class StoneMaterial {
public final Block furnace; public final Block furnace;
public StoneMaterial(String name, MaterialColor color) { public StoneMaterial(String name, MaterialColor color) {
FabricBlockSettings material = FabricBlockSettings.copyOf(Blocks.END_STONE).materialColor(color); FabricBlockSettings material = BlocksHelper.copySettingsOf(Blocks.END_STONE).materialColor(color);
stone = EndBlocks.registerBlock(name, new BaseBlock(material)); stone = EndBlocks.registerBlock(name, new BaseBlock(material));
polished = EndBlocks.registerBlock(name + "_polished", new BaseBlock(material)); polished = EndBlocks.registerBlock(name + "_polished", new BaseBlock(material));

View file

@ -33,6 +33,7 @@ import ru.bclib.blocks.BaseWoodenButtonBlock;
import ru.bclib.blocks.StripableBarkBlock; import ru.bclib.blocks.StripableBarkBlock;
import ru.bclib.blocks.WoodenPressurePlateBlock; import ru.bclib.blocks.WoodenPressurePlateBlock;
import ru.bclib.recipes.GridRecipe; import ru.bclib.recipes.GridRecipe;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.TagHelper; import ru.bclib.util.TagHelper;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.config.Configs; import ru.betterend.config.Configs;
@ -69,7 +70,7 @@ public class WoodenMaterial {
public final Tag.Named<Item> logItemTag; public final Tag.Named<Item> logItemTag;
public WoodenMaterial(String name, MaterialColor woodColor, MaterialColor planksColor) { public WoodenMaterial(String name, MaterialColor woodColor, MaterialColor planksColor) {
FabricBlockSettings materialPlanks = FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).materialColor(planksColor); FabricBlockSettings materialPlanks = BlocksHelper.copySettingsOf(Blocks.OAK_PLANKS).materialColor(planksColor);
log_stripped = EndBlocks.registerBlock(name + "_stripped_log", new BaseRotatedPillarBlock(materialPlanks)); log_stripped = EndBlocks.registerBlock(name + "_stripped_log", new BaseRotatedPillarBlock(materialPlanks));
bark_stripped = EndBlocks.registerBlock(name + "_stripped_bark", new BaseBarkBlock(materialPlanks)); bark_stripped = EndBlocks.registerBlock(name + "_stripped_bark", new BaseBarkBlock(materialPlanks));