Added Behaviours for all relevant Blocks

This commit is contained in:
Frank 2023-05-23 19:47:00 +02:00
parent 3b2a2d4294
commit 6cb70dd35f
83 changed files with 1317 additions and 395 deletions

View file

@ -2,6 +2,7 @@ package org.betterx.bclib.api.v2;
import org.betterx.bclib.BCLib;
import org.betterx.bclib.api.v2.levelgen.biomes.InternalBiomeAPI;
import org.betterx.bclib.behaviours.interfaces.*;
import org.betterx.bclib.blocks.BaseBarrelBlock;
import org.betterx.bclib.blocks.BaseChestBlock;
import org.betterx.bclib.blocks.BaseFurnaceBlock;
@ -12,9 +13,6 @@ import org.betterx.bclib.interfaces.Fuel;
import org.betterx.bclib.interfaces.PostInitable;
import org.betterx.bclib.interfaces.RenderLayerProvider;
import org.betterx.bclib.interfaces.TagProvider;
import org.betterx.bclib.interfaces.behaviours.BehaviourClimable;
import org.betterx.bclib.interfaces.behaviours.BehaviourCompostable;
import org.betterx.bclib.interfaces.behaviours.BehaviourLeaves;
import org.betterx.bclib.interfaces.tools.*;
import org.betterx.bclib.networking.VersionChecker;
import org.betterx.bclib.registry.BaseBlockEntities;
@ -116,6 +114,16 @@ public class PostInitAPI {
if (block instanceof PostInitable) {
((PostInitable) block).postInit();
}
if (block instanceof TagProvider) {
((TagProvider) block).addTags(blockTags, itemTags);
blockTags.forEach(tag -> TagManager.BLOCKS.add(tag, block));
if (item != null && item != Items.AIR)
itemTags.forEach(tag -> TagManager.ITEMS.add(tag, item));
blockTags.clear();
itemTags.clear();
}
if (block instanceof BaseChestBlock) {
BaseBlockEntities.CHEST.registerBlock(block);
} else if (block instanceof BaseBarrelBlock) {
@ -128,7 +136,27 @@ public class PostInitAPI {
TagManager.BLOCKS.add(block, MineableTags.SHEARS);
}
if (block instanceof AddMineableAxe) {
TagManager.BLOCKS.add(block, MineableTags.AXE);
if (!TagManager.BLOCKS.contains(BlockTags.WOODEN_DOORS, block)
&& !TagManager.BLOCKS.contains(BlockTags.WOODEN_BUTTONS, block)
&& !TagManager.BLOCKS.contains(BlockTags.WOODEN_SLABS, block)
&& !TagManager.BLOCKS.contains(BlockTags.WOODEN_FENCES, block)
&& !TagManager.BLOCKS.contains(BlockTags.WOODEN_STAIRS, block)
&& !TagManager.BLOCKS.contains(BlockTags.WOODEN_PRESSURE_PLATES, block)
&& !TagManager.BLOCKS.contains(BlockTags.WOODEN_TRAPDOORS, block)
&& !TagManager.BLOCKS.contains(CommonBlockTags.WOODEN_BARREL, block)
&& !TagManager.BLOCKS.contains(CommonBlockTags.WOODEN_CHEST, block)
&& !TagManager.BLOCKS.contains(CommonBlockTags.WOODEN_COMPOSTER, block)
&& !TagManager.BLOCKS.contains(CommonBlockTags.WORKBENCHES, block)
&& !TagManager.BLOCKS.contains(BlockTags.SIGNS, block)
&& !TagManager.BLOCKS.contains(BlockTags.PLANKS, block)
&& !TagManager.BLOCKS.contains(BlockTags.LOGS, block)
&& !TagManager.BLOCKS.contains(BlockTags.FENCE_GATES, block)
&& !TagManager.BLOCKS.contains(BlockTags.ALL_HANGING_SIGNS, block)
&& !TagManager.BLOCKS.contains(CommonBlockTags.WORKBENCHES, block)
&& !TagManager.BLOCKS.contains(CommonBlockTags.BOOKSHELVES, block)
) {
TagManager.BLOCKS.add(block, MineableTags.AXE);
}
}
if (block instanceof AddMineablePickaxe) {
TagManager.BLOCKS.add(block, MineableTags.PICKAXE);
@ -166,15 +194,22 @@ public class PostInitAPI {
TagManager.ITEMS.add(item, ItemTags.LEAVES, CommonItemTags.LEAVES);
}
if (block instanceof TagProvider) {
((TagProvider) block).addTags(blockTags, itemTags);
blockTags.forEach(tag -> TagManager.BLOCKS.add(tag, block));
if (item != null && item != Items.AIR)
itemTags.forEach(tag -> TagManager.ITEMS.add(tag, item));
blockTags.clear();
itemTags.clear();
if (block instanceof BehaviourImmobile) {
TagManager.BLOCKS.add(block, CommonBlockTags.IMMOBILE);
}
if (block instanceof BehaviourObsidian) {
TagManager.BLOCKS.add(block, CommonBlockTags.IS_OBSIDIAN);
}
if (block instanceof BehaviourPortalFrame) {
TagManager.BLOCKS.add(block, CommonBlockTags.NETHER_PORTAL_FRAME);
}
if (block instanceof BehaviourOre) {
TagManager.BLOCKS.add(block, CommonBlockTags.ORES);
}
if (block instanceof Fuel fl) {
FuelRegistry.INSTANCE.add(block, fl.getFuelTime());
}

View file

@ -1,4 +1,4 @@
package org.betterx.bclib.complexmaterials;
package org.betterx.bclib.behaviours;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
@ -152,7 +152,20 @@ public class BehaviourBuilders {
public static BlockBehaviour.Properties createWallSign(MapColor color, Block dropBlock, boolean flammable) {
return createSign(color, flammable).dropsLike(dropBlock);
}
public static BlockBehaviour.Properties createTrapDoor(MapColor color, boolean flammable) {
final BlockBehaviour.Properties p = BlockBehaviour.Properties
.of()
.mapColor(color)
.instrument(NoteBlockInstrument.BASS)
.strength(3.0F)
.noOcclusion()
.isValidSpawn(Blocks::never);
if (flammable) {
p.ignitedByLava();
}
return p;
}
public static BlockBehaviour.Properties applyBasePlantSettings() {

View file

@ -0,0 +1,129 @@
package org.betterx.bclib.behaviours;
import org.betterx.bclib.behaviours.interfaces.*;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.properties.BlockSetType;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import java.util.function.BiFunction;
import java.util.function.Function;
public class BehaviourHelper {
public static boolean isStone(Block source) {
return source instanceof BehaviourStone || source.defaultBlockState()
.instrument()
.equals(NoteBlockInstrument.BASEDRUM);
}
public static boolean isStone(BlockSetType type) {
return type.soundType() == SoundType.STONE;
}
public static boolean isMetal(Block source) {
return source instanceof BehaviourMetal;
}
public static boolean isMetal(BlockSetType type) {
return type.soundType() == SoundType.METAL;
}
public static boolean isWood(Block source) {
return source instanceof BehaviourWood;
}
public static boolean isWood(BlockSetType type) {
return type.soundType() == SoundType.WOOD;
}
public static boolean isObsidian(Block source) {
return source instanceof BehaviourObsidian;
}
public static boolean isGlass(Block source) {
return source instanceof BehaviourGlass;
}
public static <T> T from(
Block source,
Function<Block, T> woodSupplier,
Function<Block, T> stoneSupplier
) {
return from(source, woodSupplier, stoneSupplier, null, null, null);
}
public static <T> T from(
Block source,
Function<Block, T> woodSupplier,
Function<Block, T> stoneSupplier,
Function<Block, T> metalSupplier
) {
return from(source, woodSupplier, stoneSupplier, metalSupplier, null, null);
}
public static <T> T from(
Block source,
Function<Block, T> woodSupplier,
Function<Block, T> stoneSupplier,
Function<Block, T> metalSupplier,
Function<Block, T> obsidianSupplier,
Function<Block, T> glassSupplier
) {
if (metalSupplier != null && BehaviourHelper.isMetal(source))
return metalSupplier.apply(source);
if (stoneSupplier != null && BehaviourHelper.isStone(source))
return stoneSupplier.apply(source);
if (glassSupplier != null && BehaviourHelper.isGlass(source))
return glassSupplier.apply(source);
if (obsidianSupplier != null && BehaviourHelper.isObsidian(source))
return obsidianSupplier.apply(source);
if (woodSupplier != null)
return woodSupplier.apply(source);
//fallback if no wood supplier is present
if (stoneSupplier != null)
return stoneSupplier.apply(source);
//fallback if neither wood or stone suppliers are present
if (metalSupplier != null)
return metalSupplier.apply(source);
if (glassSupplier != null)
return glassSupplier.apply(source);
if (obsidianSupplier != null)
return obsidianSupplier.apply(source);
return null;
}
public static <T> T from(
Block source,
BlockSetType type,
BiFunction<Block, BlockSetType, T> woodSupplier,
BiFunction<Block, BlockSetType, T> stoneSupplier
) {
return from(source, type, woodSupplier, stoneSupplier, null);
}
public static <T> T from(
Block source,
BlockSetType type,
BiFunction<Block, BlockSetType, T> woodSupplier,
BiFunction<Block, BlockSetType, T> stoneSupplier,
BiFunction<Block, BlockSetType, T> metalSupplier
) {
if (metalSupplier != null && BehaviourHelper.isMetal(type))
return metalSupplier.apply(source, type);
if (stoneSupplier != null && BehaviourHelper.isStone(type))
return stoneSupplier.apply(source, type);
if (woodSupplier != null)
return woodSupplier.apply(source, type);
//fallback if no wood supplier is present
if (stoneSupplier != null)
return stoneSupplier.apply(source, type);
//fallback if neither wood or stone suppliers are present
if (metalSupplier != null)
return metalSupplier.apply(source, type);
return null;
}
}

View file

@ -1,4 +1,4 @@
package org.betterx.bclib.interfaces.behaviours;
package org.betterx.bclib.behaviours.interfaces;
/**
* Interface for blocks that can be climbed.

View file

@ -1,4 +1,4 @@
package org.betterx.bclib.interfaces.behaviours;
package org.betterx.bclib.behaviours.interfaces;
/**
* Interface for blocks that can be climbed and are vines.

View file

@ -1,4 +1,4 @@
package org.betterx.bclib.interfaces.behaviours;
package org.betterx.bclib.behaviours.interfaces;
/**
* Interface for blocks that can be composted.

View file

@ -0,0 +1,6 @@
package org.betterx.bclib.behaviours.interfaces;
import org.betterx.bclib.interfaces.tools.AddMineablePickaxe;
public interface BehaviourGlass extends AddMineablePickaxe {
}

View file

@ -0,0 +1,4 @@
package org.betterx.bclib.behaviours.interfaces;
public interface BehaviourImmobile {
}

View file

@ -1,4 +1,4 @@
package org.betterx.bclib.interfaces.behaviours;
package org.betterx.bclib.behaviours.interfaces;
import org.betterx.bclib.interfaces.tools.AddMineableHoe;
import org.betterx.bclib.interfaces.tools.AddMineableShears;

View file

@ -0,0 +1,6 @@
package org.betterx.bclib.behaviours.interfaces;
import org.betterx.bclib.interfaces.tools.AddMineablePickaxe;
public interface BehaviourMetal extends AddMineablePickaxe {
}

View file

@ -0,0 +1,6 @@
package org.betterx.bclib.behaviours.interfaces;
import org.betterx.bclib.interfaces.tools.AddMineablePickaxe;
public interface BehaviourObsidian extends AddMineablePickaxe, BehaviourImmobile {
}

View file

@ -0,0 +1,5 @@
package org.betterx.bclib.behaviours.interfaces;
public interface BehaviourObsidianPortalFrame extends BehaviourObsidian, BehaviourPortalFrame {
}

View file

@ -0,0 +1,6 @@
package org.betterx.bclib.behaviours.interfaces;
import org.betterx.bclib.interfaces.tools.AddMineablePickaxe;
public interface BehaviourOre extends AddMineablePickaxe {
}

View file

@ -0,0 +1,4 @@
package org.betterx.bclib.behaviours.interfaces;
public interface BehaviourPortalFrame {
}

View file

@ -0,0 +1,6 @@
package org.betterx.bclib.behaviours.interfaces;
import org.betterx.bclib.interfaces.tools.AddMineableShovel;
public interface BehaviourSand extends AddMineableShovel {
}

View file

@ -0,0 +1,6 @@
package org.betterx.bclib.behaviours.interfaces;
import org.betterx.bclib.interfaces.tools.AddMineablePickaxe;
public interface BehaviourStone extends AddMineablePickaxe {
}

View file

@ -1,4 +1,4 @@
package org.betterx.bclib.interfaces.behaviours;
package org.betterx.bclib.behaviours.interfaces;
import org.betterx.bclib.interfaces.tools.AddMineableHoe;
import org.betterx.bclib.interfaces.tools.AddMineableShears;

View file

@ -0,0 +1,6 @@
package org.betterx.bclib.behaviours.interfaces;
import org.betterx.bclib.interfaces.tools.AddMineableAxe;
public interface BehaviourWood extends AddMineableAxe {
}

View file

@ -1,15 +1,23 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.PatternsHelper;
import org.betterx.bclib.interfaces.TagProvider;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import java.util.List;
import java.util.Optional;
public class BaseBarkBlock extends BaseRotatedPillarBlock {
public BaseBarkBlock(Properties settings) {
public abstract class BaseBarkBlock extends BaseRotatedPillarBlock {
protected BaseBarkBlock(Properties settings) {
super(settings);
}
@ -23,4 +31,24 @@ public class BaseBarkBlock extends BaseRotatedPillarBlock {
String newPath = blockId.getPath().replace("_bark", "_log_side");
return new ResourceLocation(blockId.getNamespace(), newPath);
}
public static class Wood extends BaseBarkBlock implements BehaviourWood, TagProvider {
private final boolean flammable;
public Wood(Properties settings, boolean flammable) {
super(flammable ? settings.ignitedByLava() : settings);
this.flammable = flammable;
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(BlockTags.LOGS);
itemTags.add(ItemTags.LOGS);
if (flammable) {
blockTags.add(BlockTags.LOGS_THAT_BURN);
itemTags.add(ItemTags.LOGS_THAT_BURN);
}
}
}
}

View file

@ -1,11 +1,15 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.blockentities.BaseBarrelBlockEntity;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
import org.betterx.bclib.interfaces.BlockModelProvider;
import org.betterx.bclib.interfaces.TagProvider;
import org.betterx.bclib.registry.BaseBlockEntities;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import org.betterx.worlds.together.tag.v3.CommonItemTags;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.BlockModelRotation;
@ -15,12 +19,14 @@ import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.stats.Stats;
import net.minecraft.tags.TagKey;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.monster.piglin.PiglinAi;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BarrelBlock;
@ -40,12 +46,12 @@ import java.util.Map;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public class BaseBarrelBlock extends BarrelBlock implements BlockModelProvider {
public BaseBarrelBlock(Block source) {
public abstract class BaseBarrelBlock extends BarrelBlock implements BlockModelProvider, TagProvider {
BaseBarrelBlock(Block source) {
this(Properties.copy(source).noOcclusion());
}
public BaseBarrelBlock(BlockBehaviour.Properties properties) {
BaseBarrelBlock(BlockBehaviour.Properties properties) {
super(properties);
}
@ -159,4 +165,31 @@ public class BaseBarrelBlock extends BarrelBlock implements BlockModelProvider {
}
return ModelsHelper.createMultiVariant(modelId, rotation.getRotation(), false);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(CommonBlockTags.BARREL);
itemTags.add(CommonItemTags.BARREL);
}
public static class Wood extends BaseBarrelBlock implements BehaviourWood {
public Wood(Block source) {
super(source);
}
public Wood(Properties properties) {
super(properties);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
super.addTags(blockTags, itemTags);
blockTags.add(CommonBlockTags.WOODEN_BARREL);
itemTags.add(CommonItemTags.WOODEN_BARREL);
}
}
public static BaseBarrelBlock from(Block source) {
return new Wood(source);
}
}

View file

@ -1,5 +1,8 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourMetal;
import org.betterx.bclib.behaviours.interfaces.BehaviourStone;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.interfaces.BlockModelProvider;
import net.minecraft.client.renderer.block.model.BlockModel;
@ -73,4 +76,22 @@ public class BaseBlock extends Block implements BlockModelProvider {
customizeProperties.accept(settings);
return settings;
}
public static class Wood extends BaseBlock implements BehaviourWood {
public Wood(Properties settings) {
super(settings);
}
}
public static class Stone extends BaseBlock implements BehaviourStone {
public Stone(Properties settings) {
super(settings);
}
}
public static class Metal extends BaseBlock implements BehaviourMetal {
public Metal(Properties settings) {
super(settings);
}
}
}

View file

@ -1,11 +1,16 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
import org.betterx.bclib.interfaces.TagProvider;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
@ -24,28 +29,12 @@ import java.util.List;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public class BaseBookshelfBlock extends BaseBlock {
public static class WithVanillaWood extends BaseBookshelfBlock {
public WithVanillaWood(Block source) {
super(source);
}
@Override
@Environment(EnvType.CLIENT)
public @Nullable BlockModel getBlockModel(ResourceLocation blockId, BlockState blockState) {
Optional<String> pattern = PatternsHelper.createJson(
BasePatterns.VANILLA_WOOD_BOOKSHELF,
replacePath(blockId)
);
return ModelsHelper.fromPattern(pattern);
}
}
public BaseBookshelfBlock(Block source) {
public abstract class BaseBookshelfBlock extends BaseBlock implements TagProvider {
protected BaseBookshelfBlock(Block source) {
this(Properties.copy(source));
}
public BaseBookshelfBlock(BlockBehaviour.Properties properties) {
protected BaseBookshelfBlock(BlockBehaviour.Properties properties) {
super(properties);
}
@ -72,4 +61,39 @@ public class BaseBookshelfBlock extends BaseBlock {
String newPath = blockId.getPath().replace("_bookshelf", "");
return new ResourceLocation(blockId.getNamespace(), newPath);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(CommonBlockTags.BOOKSHELVES);
}
public static class Wood extends BaseBookshelfBlock implements BehaviourWood {
public Wood(Block source) {
super(source);
}
public Wood(Properties properties) {
super(properties);
}
}
public static class VanillaWood extends Wood {
public VanillaWood(Block source) {
super(source);
}
@Override
@Environment(EnvType.CLIENT)
public @Nullable BlockModel getBlockModel(ResourceLocation blockId, BlockState blockState) {
Optional<String> pattern = PatternsHelper.createJson(
BasePatterns.VANILLA_WOOD_BOOKSHELF,
replacePath(blockId)
);
return ModelsHelper.fromPattern(pattern);
}
}
public static BaseBookshelfBlock from(Block source) {
return new BaseBookshelfBlock.Wood(source);
}
}

View file

@ -1,15 +1,24 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.BehaviourHelper;
import org.betterx.bclib.behaviours.interfaces.BehaviourMetal;
import org.betterx.bclib.behaviours.interfaces.BehaviourStone;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
import org.betterx.bclib.interfaces.BlockModelProvider;
import org.betterx.bclib.interfaces.TagProvider;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.BlockModelRotation;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.ButtonBlock;
@ -27,7 +36,7 @@ import java.util.Map;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public abstract class BaseButtonBlock extends ButtonBlock implements BlockModelProvider {
public abstract class BaseButtonBlock extends ButtonBlock implements BlockModelProvider, TagProvider {
private final Block parent;
protected BaseButtonBlock(Block parent, Properties properties, boolean sensitive, BlockSetType type) {
@ -120,4 +129,47 @@ public abstract class BaseButtonBlock extends ButtonBlock implements BlockModelP
BlockModelRotation rotation = BlockModelRotation.by(x, y);
return ModelsHelper.createMultiVariant(modelId, rotation.getRotation(), face == AttachFace.WALL);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(BlockTags.BUTTONS);
itemTags.add(ItemTags.BUTTONS);
}
public static class Metal extends BaseButtonBlock implements BehaviourMetal {
public Metal(Block source, BlockSetType type) {
super(source, Properties.copy(source).noOcclusion(), false, type);
}
}
public static class Stone extends BaseButtonBlock implements BehaviourStone {
public Stone(Block source, BlockSetType type) {
super(source, Properties.copy(source).noOcclusion(), false, type);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
super.addTags(blockTags, itemTags);
blockTags.add(BlockTags.STONE_BUTTONS);
itemTags.add(ItemTags.STONE_BUTTONS);
}
}
public static class Wood extends BaseButtonBlock implements BehaviourWood {
public Wood(Block source, BlockSetType type) {
super(source, Properties.copy(source).strength(0.5F, 0.5F).noOcclusion(), true, type);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
super.addTags(blockTags, itemTags);
blockTags.add(BlockTags.WOODEN_BUTTONS);
itemTags.add(ItemTags.WOODEN_BUTTONS);
}
}
public static BaseButtonBlock from(Block source, BlockSetType type) {
return BehaviourHelper.from(source, type, Wood::new, Stone::new, Metal::new);
}
}

View file

@ -1,15 +1,21 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
import org.betterx.bclib.interfaces.BlockModelProvider;
import org.betterx.bclib.interfaces.TagProvider;
import org.betterx.bclib.registry.BaseBlockEntities;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import org.betterx.worlds.together.tag.v3.CommonItemTags;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.ChestBlock;
@ -24,10 +30,10 @@ import java.util.List;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public class BaseChestBlock extends ChestBlock implements BlockModelProvider {
public abstract class BaseChestBlock extends ChestBlock implements BlockModelProvider, TagProvider {
private final Block parent;
public BaseChestBlock(Block source) {
protected BaseChestBlock(Block source) {
super(Properties.copy(source).noOcclusion(), () -> BaseBlockEntities.CHEST);
this.parent = source;
}
@ -58,4 +64,27 @@ public class BaseChestBlock extends ChestBlock implements BlockModelProvider {
ResourceLocation parentId = BuiltInRegistries.BLOCK.getKey(parent);
return ModelsHelper.createBlockEmpty(parentId);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(CommonBlockTags.CHEST);
itemTags.add(CommonItemTags.CHEST);
}
public static class Wood extends BaseChestBlock implements BehaviourWood {
public Wood(Block source) {
super(source);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
super.addTags(blockTags, itemTags);
blockTags.add(CommonBlockTags.WOODEN_CHEST);
itemTags.add(CommonItemTags.WOODEN_CHEST);
}
}
public static BaseChestBlock from(Block source) {
return new BaseChestBlock.Wood(source);
}
}

View file

@ -1,13 +1,19 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
import org.betterx.bclib.interfaces.BlockModelProvider;
import org.betterx.bclib.interfaces.TagProvider;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import org.betterx.worlds.together.tag.v3.CommonPoiTags;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.ComposterBlock;
@ -23,8 +29,8 @@ import java.util.Map;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public class BaseComposterBlock extends ComposterBlock implements BlockModelProvider {
public BaseComposterBlock(Block source) {
public abstract class BaseComposterBlock extends ComposterBlock implements BlockModelProvider, TagProvider {
protected BaseComposterBlock(Block source) {
super(Properties.copy(source));
}
@ -73,4 +79,26 @@ public class BaseComposterBlock extends ComposterBlock implements BlockModelProv
return builder.build();
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(CommonBlockTags.COMPOSTER);
blockTags.add(CommonPoiTags.FARMER_WORKSTATION);
}
public static class Wood extends BaseComposterBlock implements BehaviourWood {
public Wood(Block source) {
super(source);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
super.addTags(blockTags, itemTags);
blockTags.add(CommonBlockTags.WOODEN_COMPOSTER);
}
}
public static BaseComposterBlock from(Block source) {
return new BaseComposterBlock.Wood(source);
}
}

View file

@ -1,12 +1,18 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
import org.betterx.bclib.interfaces.BlockModelProvider;
import org.betterx.bclib.interfaces.TagProvider;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import org.betterx.worlds.together.tag.v3.CommonItemTags;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.CraftingTableBlock;
@ -23,12 +29,12 @@ import java.util.List;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public class BaseCraftingTableBlock extends CraftingTableBlock implements BlockModelProvider {
public BaseCraftingTableBlock(Block source) {
public abstract class BaseCraftingTableBlock extends CraftingTableBlock implements BlockModelProvider, TagProvider {
protected BaseCraftingTableBlock(Block source) {
this(Properties.copy(source));
}
public BaseCraftingTableBlock(BlockBehaviour.Properties properties) {
protected BaseCraftingTableBlock(BlockBehaviour.Properties properties) {
super(properties);
}
@ -64,4 +70,24 @@ public class BaseCraftingTableBlock extends CraftingTableBlock implements BlockM
});
return ModelsHelper.fromPattern(pattern);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(CommonBlockTags.WORKBENCHES);
itemTags.add(CommonItemTags.WORKBENCHES);
}
public static class Wood extends BaseCraftingTableBlock implements BehaviourWood {
public Wood(Block source) {
super(source);
}
public Wood(BlockBehaviour.Properties properties) {
super(properties);
}
}
public static BaseCraftingTableBlock from(Block source) {
return new BaseCraftingTableBlock.Wood(source);
}
}

View file

@ -1,6 +1,6 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.complexmaterials.BehaviourBuilders;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.util.BlocksHelper;
import org.betterx.bclib.util.MHelper;

View file

@ -1,5 +1,9 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.BehaviourHelper;
import org.betterx.bclib.behaviours.interfaces.BehaviourMetal;
import org.betterx.bclib.behaviours.interfaces.BehaviourStone;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
@ -37,12 +41,12 @@ import java.util.Map;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public class BaseDoorBlock extends DoorBlock implements RenderLayerProvider, BlockModelProvider, TagProvider {
public BaseDoorBlock(Block source, BlockSetType type) {
public abstract class BaseDoorBlock extends DoorBlock implements RenderLayerProvider, BlockModelProvider, TagProvider {
protected BaseDoorBlock(Block source, BlockSetType type) {
this(Properties.copy(source).strength(3F, 3F).noOcclusion(), type);
}
public BaseDoorBlock(BlockBehaviour.Properties properties, BlockSetType type) {
protected BaseDoorBlock(BlockBehaviour.Properties properties, BlockSetType type) {
super(properties, type);
}
@ -180,4 +184,46 @@ public class BaseDoorBlock extends DoorBlock implements RenderLayerProvider, Blo
return name;
}
}
public static class Wood extends BaseDoorBlock implements BehaviourWood {
public Wood(Block source, BlockSetType type) {
super(source, type);
}
public Wood(Properties properties, BlockSetType type) {
super(properties, type);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
super.addTags(blockTags, itemTags);
blockTags.add(BlockTags.WOODEN_DOORS);
itemTags.add(ItemTags.WOODEN_DOORS);
}
}
public static class Metal extends BaseDoorBlock implements BehaviourMetal {
public Metal(Block source, BlockSetType type) {
super(source, type);
}
public Metal(Properties properties, BlockSetType type) {
super(properties, type);
}
}
public static class Stone extends BaseDoorBlock implements BehaviourStone {
public Stone(Block source, BlockSetType type) {
super(source, type);
}
public Stone(Properties properties, BlockSetType type) {
super(properties, type);
}
}
public static BaseDoorBlock from(Block source, BlockSetType type) {
return BehaviourHelper.from(source, type, Wood::new, Stone::new, Metal::new);
}
}

View file

@ -1,7 +1,7 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.client.render.BCLRenderLayer;
import org.betterx.bclib.complexmaterials.BehaviourBuilders;
import org.betterx.bclib.interfaces.RenderLayerProvider;
import org.betterx.bclib.items.tool.BaseShearsItem;
import org.betterx.bclib.util.BlocksHelper;

View file

@ -1,19 +1,26 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
import org.betterx.bclib.interfaces.BlockModelProvider;
import org.betterx.bclib.interfaces.TagProvider;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.BlockModelRotation;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.FenceBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockSetType;
import net.minecraft.world.level.storage.loot.LootParams;
import net.fabricmc.api.EnvType;
@ -25,10 +32,10 @@ import java.util.Map;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public class BaseFenceBlock extends FenceBlock implements BlockModelProvider {
public abstract class BaseFenceBlock extends FenceBlock implements BlockModelProvider, TagProvider {
private final Block parent;
public BaseFenceBlock(Block source) {
protected BaseFenceBlock(Block source) {
super(Properties.copy(source).noOcclusion());
this.parent = source;
}
@ -95,4 +102,27 @@ public class BaseFenceBlock extends FenceBlock implements BlockModelProvider {
return builder.build();
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(BlockTags.FENCES);
itemTags.add(ItemTags.FENCES);
}
public static class Wood extends BaseFenceBlock implements BehaviourWood {
public Wood(Block source, BlockSetType type) {
super(source);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
super.addTags(blockTags, itemTags);
blockTags.add(BlockTags.WOODEN_FENCES);
itemTags.add(ItemTags.WOODEN_FENCES);
}
}
public static BaseFenceBlock from(Block source, BlockSetType type) {
return new BaseFenceBlock.Wood(source, type);
}
}

View file

@ -1,14 +1,19 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
import org.betterx.bclib.interfaces.BlockModelProvider;
import org.betterx.bclib.interfaces.TagProvider;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.FenceGateBlock;
@ -25,10 +30,10 @@ import java.util.Map;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public class BaseGateBlock extends FenceGateBlock implements BlockModelProvider {
public abstract class BaseGateBlock extends FenceGateBlock implements BlockModelProvider, TagProvider {
private final Block parent;
public BaseGateBlock(Block source, WoodType type) {
protected BaseGateBlock(Block source, WoodType type) {
super(Properties.copy(source).noOcclusion(), type);
this.parent = source;
}
@ -84,4 +89,19 @@ public class BaseGateBlock extends FenceGateBlock implements BlockModelProvider
registerBlockModel(stateId, modelId, blockState, modelCache);
return ModelsHelper.createFacingModel(modelId, blockState.getValue(FACING), true, false);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(BlockTags.FENCE_GATES);
}
public static class Wood extends BaseGateBlock implements BehaviourWood {
public Wood(Block source, WoodType type) {
super(source, type);
}
}
public static BaseGateBlock from(Block source, WoodType type) {
return new BaseGateBlock.Wood(source, type);
}
}

View file

@ -1,12 +1,15 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.BehaviourHelper;
import org.betterx.bclib.behaviours.interfaces.BehaviourClimable;
import org.betterx.bclib.behaviours.interfaces.BehaviourMetal;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
import org.betterx.bclib.client.render.BCLRenderLayer;
import org.betterx.bclib.interfaces.BlockModelProvider;
import org.betterx.bclib.interfaces.RenderLayerProvider;
import org.betterx.bclib.interfaces.behaviours.BehaviourClimable;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.UnbakedModel;
@ -27,8 +30,8 @@ import java.util.Map;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public class BaseLadderBlock extends LadderBlock implements RenderLayerProvider, BlockModelProvider, BehaviourClimable {
public BaseLadderBlock(Block block) {
public abstract class BaseLadderBlock extends LadderBlock implements RenderLayerProvider, BlockModelProvider, BehaviourClimable {
protected BaseLadderBlock(Block block) {
this(Properties.copy(block).noOcclusion());
}
@ -71,4 +74,30 @@ public class BaseLadderBlock extends LadderBlock implements RenderLayerProvider,
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder) {
return Collections.singletonList(new ItemStack(this));
}
public static class Wood extends BaseLadderBlock implements BehaviourWood {
public Wood(Block block) {
super(block);
}
public Wood(Properties properties) {
super(properties);
}
}
public static class Metal extends BaseLadderBlock implements BehaviourMetal {
public Metal(Block block) {
super(block);
}
public Metal(Properties properties) {
super(properties);
}
}
public static BaseLadderBlock from(Block source) {
return BehaviourHelper.from(source,
Wood::new, null, Metal::new
);
}
}

View file

@ -1,10 +1,10 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourLeaves;
import org.betterx.bclib.client.render.BCLRenderLayer;
import org.betterx.bclib.complexmaterials.BehaviourBuilders;
import org.betterx.bclib.interfaces.BlockModelProvider;
import org.betterx.bclib.interfaces.RenderLayerProvider;
import org.betterx.bclib.interfaces.behaviours.BehaviourLeaves;
import org.betterx.bclib.items.tool.BaseShearsItem;
import org.betterx.bclib.util.MHelper;

View file

@ -1,11 +1,11 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.complexmaterials.BehaviourBuilders;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourOre;
import org.betterx.bclib.interfaces.BlockModelProvider;
import org.betterx.bclib.interfaces.TagProvider;
import org.betterx.bclib.util.LootUtil;
import org.betterx.bclib.util.MHelper;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import org.betterx.worlds.together.tag.v3.MineableTags;
import net.minecraft.client.renderer.block.model.BlockModel;
@ -33,7 +33,7 @@ import java.util.Collections;
import java.util.List;
import java.util.function.Supplier;
public class BaseOreBlock extends DropExperienceBlock implements BlockModelProvider, TagProvider {
public class BaseOreBlock extends DropExperienceBlock implements BlockModelProvider, TagProvider, BehaviourOre {
private final Supplier<Item> dropItem;
private final int minCount;
private final int maxCount;
@ -136,8 +136,6 @@ public class BaseOreBlock extends DropExperienceBlock implements BlockModelProvi
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(CommonBlockTags.ORES);
if (this.miningLevel == Tiers.STONE.getLevel()) {
blockTags.add(BlockTags.NEEDS_STONE_TOOL);
} else if (this.miningLevel == Tiers.IRON.getLevel()) {

View file

@ -0,0 +1,40 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.interfaces.TagProvider;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import java.util.List;
public abstract class BasePlanks extends BaseBlock implements TagProvider {
/**
* Creates a new Block with the passed properties
*
* @param settings The properties of the Block.
*/
protected BasePlanks(Properties settings) {
super(settings);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(BlockTags.PLANKS);
itemTags.add(ItemTags.PLANKS);
}
public static class Wood extends BasePlanks implements BehaviourWood {
/**
* Creates a new Block with the passed properties
*
* @param settings The properties of the Block.
*/
public Wood(Properties settings) {
super(settings);
}
}
}

View file

@ -1,10 +1,10 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
import org.betterx.bclib.client.render.BCLRenderLayer;
import org.betterx.bclib.complexmaterials.BehaviourBuilders;
import org.betterx.bclib.interfaces.RenderLayerProvider;
import org.betterx.bclib.interfaces.SettingsExtender;
import org.betterx.bclib.items.tool.BaseShearsItem;

View file

@ -1,6 +1,6 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.complexmaterials.BehaviourBuilders;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;

View file

@ -1,14 +1,23 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.BehaviourHelper;
import org.betterx.bclib.behaviours.interfaces.BehaviourMetal;
import org.betterx.bclib.behaviours.interfaces.BehaviourStone;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
import org.betterx.bclib.interfaces.BlockModelProvider;
import org.betterx.bclib.interfaces.TagProvider;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.PressurePlateBlock;
@ -25,10 +34,10 @@ import java.util.Map;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public class BasePressurePlateBlock extends PressurePlateBlock implements BlockModelProvider {
public abstract class BasePressurePlateBlock extends PressurePlateBlock implements BlockModelProvider, TagProvider {
private final Block parent;
public BasePressurePlateBlock(Sensitivity rule, Block source, BlockSetType type) {
protected BasePressurePlateBlock(Sensitivity rule, Block source, BlockSetType type) {
super(
rule, Properties.copy(source).noCollission().noOcclusion().strength(0.5F),
type
@ -73,4 +82,40 @@ public class BasePressurePlateBlock extends PressurePlateBlock implements BlockM
registerBlockModel(stateId, modelId, blockState, modelCache);
return ModelsHelper.createBlockSimple(modelId);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(BlockTags.PRESSURE_PLATES);
}
public static class Wood extends BasePressurePlateBlock implements BehaviourWood {
public Wood(Block source, BlockSetType type) {
super(Sensitivity.EVERYTHING, source, type);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
super.addTags(blockTags, itemTags);
blockTags.add(BlockTags.WOODEN_PRESSURE_PLATES);
itemTags.add(ItemTags.WOODEN_PRESSURE_PLATES);
}
}
public static class Stone extends BasePressurePlateBlock implements BehaviourStone {
public Stone(Block source, BlockSetType type) {
super(Sensitivity.MOBS, source, type);
}
}
public static class Metal extends BasePressurePlateBlock implements BehaviourMetal {
public Metal(Block source, BlockSetType type) {
super(Sensitivity.MOBS, source, type);
}
}
public static BasePressurePlateBlock from(Block source, BlockSetType type) {
return BehaviourHelper.from(source, type,
Wood::new, Stone::new, Metal::new
);
}
}

View file

@ -1,5 +1,9 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.BehaviourHelper;
import org.betterx.bclib.behaviours.interfaces.BehaviourMetal;
import org.betterx.bclib.behaviours.interfaces.BehaviourStone;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
import org.betterx.bclib.interfaces.BlockModelProvider;
@ -22,12 +26,12 @@ import java.util.Map;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public class BaseRotatedPillarBlock extends RotatedPillarBlock implements BlockModelProvider {
public BaseRotatedPillarBlock(Properties settings) {
public abstract class BaseRotatedPillarBlock extends RotatedPillarBlock implements BlockModelProvider {
protected BaseRotatedPillarBlock(Properties settings) {
super(settings);
}
public BaseRotatedPillarBlock(Block block) {
protected BaseRotatedPillarBlock(Block block) {
this(Properties.copy(block));
}
@ -65,4 +69,46 @@ public class BaseRotatedPillarBlock extends RotatedPillarBlock implements BlockM
protected Optional<String> createBlockPattern(ResourceLocation blockId) {
return PatternsHelper.createBlockPillar(blockId);
}
public static class Wood extends BaseRotatedPillarBlock implements BehaviourWood {
protected final boolean flammable;
public Wood(Properties settings, boolean flammable) {
super(flammable ? settings.ignitedByLava() : settings);
this.flammable = flammable;
}
public Wood(Block block, boolean flammable) {
this(Properties.copy(block), flammable);
}
}
public static class Stone extends BaseRotatedPillarBlock implements BehaviourStone {
public Stone(Properties settings) {
super(settings);
}
public Stone(Block block) {
super(block);
}
}
public static class Metal extends BaseRotatedPillarBlock implements BehaviourMetal {
public Metal(Properties settings) {
super(settings);
}
public Metal(Block block) {
super(block);
}
}
public static BaseRotatedPillarBlock from(Block source, boolean flammable) {
return BehaviourHelper.from(
source,
(s) -> new Wood(s, flammable),
Stone::new,
Metal::new
);
}
}

View file

@ -1,16 +1,25 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.BehaviourHelper;
import org.betterx.bclib.behaviours.interfaces.BehaviourMetal;
import org.betterx.bclib.behaviours.interfaces.BehaviourObsidian;
import org.betterx.bclib.behaviours.interfaces.BehaviourStone;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
import org.betterx.bclib.interfaces.BlockModelProvider;
import org.betterx.bclib.interfaces.CustomItemProvider;
import org.betterx.bclib.interfaces.TagProvider;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.BlockModelRotation;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
@ -29,15 +38,11 @@ import java.util.Map;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public class BaseSlabBlock extends SlabBlock implements BlockModelProvider, CustomItemProvider {
public abstract class BaseSlabBlock extends SlabBlock implements BlockModelProvider, CustomItemProvider, TagProvider {
private final Block parent;
public final boolean fireproof;
public BaseSlabBlock(Block source) {
this(source, false);
}
public BaseSlabBlock(Block source, boolean fireproof) {
protected BaseSlabBlock(Block source, boolean fireproof) {
super(Properties.copy(source));
this.parent = source;
this.fireproof = fireproof;
@ -88,9 +93,73 @@ public class BaseSlabBlock extends SlabBlock implements BlockModelProvider, Cust
return ModelsHelper.createBlockSimple(modelId);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(BlockTags.SLABS);
itemTags.add(ItemTags.SLABS);
}
@Override
public BlockItem getCustomItem(ResourceLocation blockID, Item.Properties settings) {
if (fireproof) settings = settings.fireResistant();
return new BlockItem(this, settings);
}
public static class Stone extends BaseSlabBlock implements BehaviourStone {
public Stone(Block source) {
this(source, true);
}
public Stone(Block source, boolean fireproof) {
super(source, fireproof);
}
}
public static class Metal extends BaseSlabBlock implements BehaviourMetal {
public Metal(Block source) {
this(source, true);
}
public Metal(Block source, boolean fireproof) {
super(source, fireproof);
}
}
public static class Wood extends BaseSlabBlock implements BehaviourWood {
public Wood(Block source) {
this(source, false);
}
public Wood(Block source, boolean fireproof) {
super(source, fireproof);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
super.addTags(blockTags, itemTags);
blockTags.add(BlockTags.WOODEN_SLABS);
itemTags.add(ItemTags.WOODEN_SLABS);
}
}
public static class Obsidian extends BaseSlabBlock implements BehaviourObsidian {
public Obsidian(Block source) {
super(source, true);
}
public Obsidian(Block source, boolean fireproof) {
super(source, fireproof);
}
}
public static BaseSlabBlock from(Block source, boolean flammable) {
return BehaviourHelper.from(
source,
(s) -> new BaseSlabBlock.Wood(s, !flammable),
(s) -> new BaseSlabBlock.Stone(s, !flammable),
(s) -> new BaseSlabBlock.Metal(s, !flammable),
(s) -> new BaseSlabBlock.Obsidian(s, !flammable),
null
);
}
}

View file

@ -1,16 +1,25 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.BehaviourHelper;
import org.betterx.bclib.behaviours.interfaces.BehaviourMetal;
import org.betterx.bclib.behaviours.interfaces.BehaviourObsidian;
import org.betterx.bclib.behaviours.interfaces.BehaviourStone;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
import org.betterx.bclib.interfaces.BlockModelProvider;
import org.betterx.bclib.interfaces.CustomItemProvider;
import org.betterx.bclib.interfaces.TagProvider;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.BlockModelRotation;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
@ -30,15 +39,13 @@ import java.util.Map;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public class BaseStairsBlock extends StairBlock implements BlockModelProvider, CustomItemProvider {
public abstract class BaseStairsBlock extends StairBlock implements BlockModelProvider, CustomItemProvider, TagProvider {
private final Block parent;
public final boolean fireproof;
public BaseStairsBlock(Block source) {
this(source, false);
}
public BaseStairsBlock(Block source, boolean fireproof) {
protected BaseStairsBlock(Block source, boolean fireproof) {
super(source.defaultBlockState(), Properties.copy(source));
this.parent = source;
this.fireproof = fireproof;
@ -117,4 +124,69 @@ public class BaseStairsBlock extends StairBlock implements BlockModelProvider, C
if (fireproof) settings = settings.fireResistant();
return new BlockItem(this, settings);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(BlockTags.STAIRS);
itemTags.add(ItemTags.STAIRS);
}
public static class Stone extends BaseStairsBlock implements BehaviourStone {
public Stone(Block source) {
this(source, true);
}
public Stone(Block source, boolean fireproof) {
super(source, fireproof);
}
}
public static class Metal extends BaseStairsBlock implements BehaviourMetal {
public Metal(Block source) {
this(source, true);
}
public Metal(Block source, boolean fireproof) {
super(source, fireproof);
}
}
public static class Wood extends BaseStairsBlock implements BehaviourWood {
public Wood(Block source) {
this(source, false);
}
public Wood(Block source, boolean fireproof) {
super(source, fireproof);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
super.addTags(blockTags, itemTags);
blockTags.add(BlockTags.WOODEN_STAIRS);
itemTags.add(ItemTags.WOODEN_STAIRS);
}
}
public static class Obsidian extends BaseStairsBlock implements BehaviourObsidian {
public Obsidian(Block source) {
this(source, true);
}
public Obsidian(Block source, boolean fireproof) {
super(source, fireproof);
}
}
public static BaseStairsBlock from(Block source, boolean flammable) {
return BehaviourHelper.from(
source,
(block) -> new Wood(block, flammable),
(block) -> new Stone(block, !flammable),
(block) -> new Metal(block, !flammable),
(block) -> new Obsidian(block, !flammable),
null
);
}
}

View file

@ -1,18 +0,0 @@
package org.betterx.bclib.blocks;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.properties.BlockSetType;
public class BaseStoneButtonBlock extends BaseButtonBlock {
public BaseStoneButtonBlock(Block source, BlockSetType type) {
super(source, Properties.copy(source).noOcclusion(), false, type);
}
@Override
protected SoundEvent getSound(boolean clicked) {
return clicked ? SoundEvents.STONE_BUTTON_CLICK_ON : SoundEvents.STONE_BUTTON_CLICK_OFF;
}
}

View file

@ -1,5 +1,7 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.interfaces.TagProvider;
import org.betterx.worlds.together.tag.v3.MineableTags;
import org.betterx.worlds.together.tag.v3.TagManager;
@ -7,22 +9,28 @@ import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.phys.BlockHitResult;
import java.util.List;
public class StripableBarkBlock extends BaseBarkBlock {
private final Block striped;
public StripableBarkBlock(MapColor color, Block striped) {
super(Properties.copy(striped).mapColor(color));
this.striped = striped;
public abstract class BaseStripableBarkBlock extends BaseBarkBlock {
private final Block stripedBlock;
protected BaseStripableBarkBlock(Block stripedBlock, Properties settings) {
super(settings);
this.stripedBlock = stripedBlock;
}
@Override
@ -40,8 +48,8 @@ public class StripableBarkBlock extends BaseBarkBlock {
if (!world.isClientSide) {
world.setBlock(
pos,
striped.defaultBlockState()
.setValue(AXIS, state.getValue(AXIS)),
stripedBlock.defaultBlockState()
.setValue(AXIS, state.getValue(AXIS)),
11
);
if (!player.isCreative()) {
@ -52,4 +60,30 @@ public class StripableBarkBlock extends BaseBarkBlock {
}
return InteractionResult.FAIL;
}
public static class Wood extends BaseStripableBarkBlock implements BehaviourWood, TagProvider {
private final boolean flammable;
public Wood(MapColor color, Block stripedBlock, boolean flammable) {
super(
stripedBlock,
(flammable
? Properties.copy(stripedBlock).ignitedByLava()
: Properties.copy(stripedBlock)).mapColor(color)
);
this.flammable = flammable;
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(BlockTags.LOGS);
itemTags.add(ItemTags.LOGS);
if (flammable) {
blockTags.add(BlockTags.LOGS_THAT_BURN);
itemTags.add(ItemTags.LOGS_THAT_BURN);
}
}
}
}

View file

@ -1,5 +1,7 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.interfaces.TagProvider;
import org.betterx.worlds.together.tag.v3.MineableTags;
import org.betterx.worlds.together.tag.v3.TagManager;
@ -7,9 +9,13 @@ import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.RotatedPillarBlock;
@ -17,12 +23,14 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.phys.BlockHitResult;
import java.util.List;
public class BaseStripableLogBlock extends BaseRotatedPillarBlock {
public abstract class BaseStripableLogBlock extends BaseRotatedPillarBlock {
private final Block striped;
public BaseStripableLogBlock(MapColor color, Block striped) {
super(Properties.copy(striped).mapColor(color));
protected BaseStripableLogBlock(Block striped, Properties settings) {
super(settings);
this.striped = striped;
}
@ -53,4 +61,27 @@ public class BaseStripableLogBlock extends BaseRotatedPillarBlock {
}
return InteractionResult.FAIL;
}
public static class Wood extends BaseStripableLogBlock implements BehaviourWood, TagProvider {
private final boolean flammable;
public Wood(MapColor color, Block striped, boolean flammable) {
super(
striped,
(flammable ? Properties.copy(striped).ignitedByLava() : Properties.copy(striped)).mapColor(color)
);
this.flammable = flammable;
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(BlockTags.LOGS);
itemTags.add(ItemTags.LOGS);
if (flammable) {
blockTags.add(BlockTags.LOGS_THAT_BURN);
itemTags.add(ItemTags.LOGS_THAT_BURN);
}
}
}
}

View file

@ -1,18 +1,29 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.BehaviourHelper;
import org.betterx.bclib.behaviours.interfaces.BehaviourMetal;
import org.betterx.bclib.behaviours.interfaces.BehaviourStone;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
import org.betterx.bclib.client.render.BCLRenderLayer;
import org.betterx.bclib.interfaces.BlockModelProvider;
import org.betterx.bclib.interfaces.RenderLayerProvider;
import org.betterx.bclib.interfaces.TagProvider;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.BlockModelRotation;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.TrapDoorBlock;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
@ -26,12 +37,8 @@ import net.fabricmc.api.Environment;
import java.util.*;
import org.jetbrains.annotations.Nullable;
public class BaseTrapdoorBlock extends TrapDoorBlock implements RenderLayerProvider, BlockModelProvider {
public BaseTrapdoorBlock(Block source, BlockSetType type) {
this(Properties.copy(source).strength(3.0F, 3.0F).noOcclusion(), type);
}
public BaseTrapdoorBlock(BlockBehaviour.Properties properties, BlockSetType type) {
public abstract class BaseTrapdoorBlock extends TrapDoorBlock implements RenderLayerProvider, BlockModelProvider, TagProvider {
protected BaseTrapdoorBlock(BlockBehaviour.Properties properties, BlockSetType type) {
super(properties, type);
}
@ -103,4 +110,55 @@ public class BaseTrapdoorBlock extends TrapDoorBlock implements RenderLayerProvi
BlockModelRotation rotation = BlockModelRotation.by(x, y);
return ModelsHelper.createMultiVariant(modelId, rotation.getRotation(), false);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(BlockTags.TRAPDOORS);
itemTags.add(ItemTags.TRAPDOORS);
}
public static class Wood extends BaseTrapdoorBlock implements BehaviourWood {
public Wood(Block source, BlockSetType type, boolean flammable) {
this(BehaviourBuilders.createTrapDoor(source.defaultMapColor(), flammable).sound(SoundType.WOOD), type);
}
public Wood(Properties properties, BlockSetType type) {
super(properties, type);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
super.addTags(blockTags, itemTags);
blockTags.add(BlockTags.WOODEN_TRAPDOORS);
itemTags.add(ItemTags.WOODEN_TRAPDOORS);
}
}
public static class Stone extends BaseTrapdoorBlock implements BehaviourStone {
public Stone(Block source, BlockSetType type) {
this(BehaviourBuilders.createTrapDoor(source.defaultMapColor(), false).sound(SoundType.STONE), type);
}
public Stone(Properties properties, BlockSetType type) {
super(properties, type);
}
}
public static class Metal extends BaseTrapdoorBlock implements BehaviourMetal {
public Metal(Block source, BlockSetType type) {
this(BehaviourBuilders.createTrapDoor(source.defaultMapColor(), false).sound(SoundType.METAL), type);
}
public Metal(Properties properties, BlockSetType type) {
super(properties, type);
}
}
public static BaseTrapdoorBlock from(Block source, BlockSetType type, boolean flammable) {
return BehaviourHelper.from(source, type,
(s, t) -> new Wood(s, t, flammable),
Stone::new,
Metal::new
);
}
}

View file

@ -1,8 +1,8 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.blocks.BlockProperties.TripleShape;
import org.betterx.bclib.client.render.BCLRenderLayer;
import org.betterx.bclib.complexmaterials.BehaviourBuilders;
import org.betterx.bclib.interfaces.RenderLayerProvider;
import org.betterx.bclib.items.tool.BaseShearsItem;
import org.betterx.bclib.util.BlocksHelper;

View file

@ -1,6 +1,6 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.complexmaterials.BehaviourBuilders;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.util.BlocksHelper;
import net.minecraft.core.BlockPos;

View file

@ -1,18 +0,0 @@
package org.betterx.bclib.blocks;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.properties.BlockSetType;
public class BaseWoodenButtonBlock extends BaseButtonBlock {
public BaseWoodenButtonBlock(Block source, BlockSetType type) {
super(source, Properties.copy(source).strength(0.5F, 0.5F).noOcclusion(), true, type);
}
@Override
protected SoundEvent getSound(boolean clicked) {
return clicked ? SoundEvents.WOODEN_BUTTON_CLICK_ON : SoundEvents.WOODEN_BUTTON_CLICK_OFF;
}
}

View file

@ -1,11 +1,11 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.api.v3.levelgen.features.BCLConfigureFeature;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
import org.betterx.bclib.client.render.BCLRenderLayer;
import org.betterx.bclib.complexmaterials.BehaviourBuilders;
import org.betterx.bclib.interfaces.BlockModelProvider;
import org.betterx.bclib.interfaces.RenderLayerProvider;

View file

@ -1,9 +1,9 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourLeaves;
import org.betterx.bclib.client.render.BCLRenderLayer;
import org.betterx.bclib.complexmaterials.BehaviourBuilders;
import org.betterx.bclib.interfaces.RenderLayerProvider;
import org.betterx.bclib.interfaces.behaviours.BehaviourLeaves;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;

View file

@ -1,10 +0,0 @@
package org.betterx.bclib.blocks;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.properties.BlockSetType;
public class StonePressurePlateBlock extends BasePressurePlateBlock {
public StonePressurePlateBlock(Block source, BlockSetType type) {
super(Sensitivity.MOBS, source, type);
}
}

View file

@ -1,7 +1,7 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.client.render.BCLRenderLayer;
import org.betterx.bclib.complexmaterials.BehaviourBuilders;
import org.betterx.bclib.interfaces.RenderLayerProvider;
import org.betterx.bclib.items.tool.BaseShearsItem;

View file

@ -1,9 +1,9 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourCompostable;
import org.betterx.bclib.client.render.BCLRenderLayer;
import org.betterx.bclib.complexmaterials.BehaviourBuilders;
import org.betterx.bclib.interfaces.RenderLayerProvider;
import org.betterx.bclib.interfaces.behaviours.BehaviourCompostable;
import org.betterx.bclib.interfaces.tools.AddMineableHoe;
import org.betterx.bclib.interfaces.tools.AddMineableShears;
import org.betterx.bclib.items.tool.BaseShearsItem;

View file

@ -1,6 +1,6 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.complexmaterials.BehaviourBuilders;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;

View file

@ -1,10 +0,0 @@
package org.betterx.bclib.blocks;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.properties.BlockSetType;
public class WoodenPressurePlateBlock extends BasePressurePlateBlock {
public WoodenPressurePlateBlock(Block source, BlockSetType type) {
super(Sensitivity.EVERYTHING, source, type);
}
}

View file

@ -1,14 +1,20 @@
package org.betterx.bclib.blocks.signs;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.complexmaterials.BCLWoodTypeWrapper;
import org.betterx.bclib.complexmaterials.BehaviourBuilders;
import org.betterx.bclib.interfaces.BlockModelProvider;
import org.betterx.bclib.interfaces.CustomItemProvider;
import org.betterx.bclib.interfaces.TagProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.HangingSignItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.CeilingHangingSignBlock;
import net.minecraft.world.level.block.StandingSignBlock;
import net.minecraft.world.level.block.state.BlockState;
@ -16,20 +22,19 @@ import net.minecraft.world.level.block.state.properties.RotationSegment;
import net.minecraft.world.level.block.state.properties.WoodType;
import net.minecraft.world.level.material.MapColor;
public class BaseHangingSignBlock extends CeilingHangingSignBlock implements BlockModelProvider, CustomItemProvider {
import java.util.List;
public abstract class BaseHangingSignBlock extends CeilingHangingSignBlock implements BlockModelProvider, CustomItemProvider, TagProvider {
public final BaseWallHangingSignBlock wallSign;
public BaseHangingSignBlock(WoodType type) {
this(type, MapColor.WOOD, true);
@FunctionalInterface
public interface WallSignProvider {
BaseWallHangingSignBlock create(Properties properties, WoodType woodType);
}
public BaseHangingSignBlock(BCLWoodTypeWrapper type) {
this(type.type, type.color, type.flammable);
}
public BaseHangingSignBlock(WoodType type, MapColor color, boolean flammable) {
protected BaseHangingSignBlock(WoodType type, MapColor color, boolean flammable, WallSignProvider provider) {
super(BehaviourBuilders.createSign(color, flammable), type);
this.wallSign = new BaseWallHangingSignBlock(BehaviourBuilders.createWallSign(color, this, flammable), type);
this.wallSign = provider.create(BehaviourBuilders.createWallSign(color, this, flammable), type);
}
@ -42,4 +47,28 @@ public class BaseHangingSignBlock extends CeilingHangingSignBlock implements Blo
public BlockItem getCustomItem(ResourceLocation blockID, Item.Properties settings) {
return new HangingSignItem(this, wallSign, settings.stacksTo(16));
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(BlockTags.CEILING_HANGING_SIGNS);
itemTags.add(ItemTags.HANGING_SIGNS);
}
public static class Wood extends BaseHangingSignBlock implements BehaviourWood {
public Wood(WoodType type) {
this(type, MapColor.WOOD, true);
}
public Wood(BCLWoodTypeWrapper type) {
this(type.type, type.color, type.flammable);
}
public Wood(WoodType type, MapColor color, boolean flammable) {
super(type, color, flammable, BaseWallHangingSignBlock.Wood::new);
}
}
public static BaseHangingSignBlock from(WoodType type) {
return new BaseHangingSignBlock.Wood(type);
}
}

View file

@ -1,35 +1,40 @@
package org.betterx.bclib.blocks.signs;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.complexmaterials.BCLWoodTypeWrapper;
import org.betterx.bclib.complexmaterials.BehaviourBuilders;
import org.betterx.bclib.interfaces.BlockModelProvider;
import org.betterx.bclib.interfaces.CustomItemProvider;
import org.betterx.bclib.interfaces.TagProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.SignItem;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.StandingSignBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.RotationSegment;
import net.minecraft.world.level.block.state.properties.WoodType;
import net.minecraft.world.level.material.MapColor;
import java.util.List;
@SuppressWarnings("deprecation")
public class BaseSignBlock extends StandingSignBlock implements BlockModelProvider, CustomItemProvider {
public abstract class BaseSignBlock extends StandingSignBlock implements BlockModelProvider, CustomItemProvider, TagProvider {
public final BaseWallSignBlock wallSign;
public BaseSignBlock(WoodType type) {
this(type, MapColor.WOOD, true);
@FunctionalInterface
public interface WallSignProvider {
BaseWallSignBlock create(Properties properties, WoodType woodType);
}
public BaseSignBlock(BCLWoodTypeWrapper type) {
this(type.type, type.color, type.flammable);
}
public BaseSignBlock(WoodType type, MapColor color, boolean flammable) {
protected BaseSignBlock(WoodType type, MapColor color, boolean flammable, WallSignProvider provider) {
super(BehaviourBuilders.createSign(color, flammable), type);
this.wallSign = new BaseWallSignBlock(BehaviourBuilders.createWallSign(color, this, flammable), type);
this.wallSign = provider.create(BehaviourBuilders.createWallSign(color, this, flammable), type);
}
@ -42,4 +47,28 @@ public class BaseSignBlock extends StandingSignBlock implements BlockModelProvid
public BlockItem getCustomItem(ResourceLocation blockID, Item.Properties settings) {
return new SignItem(settings.stacksTo(16), this, wallSign);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(BlockTags.STANDING_SIGNS);
itemTags.add(ItemTags.SIGNS);
}
public static class Wood extends BaseSignBlock implements BehaviourWood {
public Wood(WoodType type) {
this(type, MapColor.WOOD, true);
}
public Wood(BCLWoodTypeWrapper type) {
this(type.type, type.color, type.flammable);
}
public Wood(WoodType type, MapColor color, boolean flammable) {
super(type, color, flammable, BaseWallSignBlock.Wood::new);
}
}
public static BaseSignBlock from(BCLWoodTypeWrapper type) {
return new BaseSignBlock.Wood(type);
}
}

View file

@ -1,13 +1,33 @@
package org.betterx.bclib.blocks.signs;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.interfaces.TagProvider;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.WallHangingSignBlock;
import net.minecraft.world.level.block.state.properties.WoodType;
public class BaseWallHangingSignBlock extends WallHangingSignBlock {
public BaseWallHangingSignBlock(
import java.util.List;
public abstract class BaseWallHangingSignBlock extends WallHangingSignBlock implements TagProvider {
protected BaseWallHangingSignBlock(
Properties properties,
WoodType woodType
) {
super(properties, woodType);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(BlockTags.WALL_HANGING_SIGNS);
}
public static class Wood extends BaseWallHangingSignBlock implements BehaviourWood {
public Wood(Properties properties, WoodType woodType) {
super(properties, woodType);
}
}
}

View file

@ -1,10 +1,29 @@
package org.betterx.bclib.blocks.signs;
import org.betterx.bclib.interfaces.TagProvider;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.WallSignBlock;
import net.minecraft.world.level.block.state.properties.WoodType;
public class BaseWallSignBlock extends WallSignBlock {
public BaseWallSignBlock(Properties properties, WoodType woodType) {
import java.util.List;
public abstract class BaseWallSignBlock extends WallSignBlock implements TagProvider {
protected BaseWallSignBlock(Properties properties, WoodType woodType) {
super(properties, woodType);
}
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(BlockTags.WALL_SIGNS);
}
public static class Wood extends BaseWallSignBlock {
public Wood(Properties properties, WoodType woodType) {
super(properties, woodType);
}
}
}

View file

@ -74,10 +74,14 @@ public class WoodenComplexMaterial extends ComplexMaterialSet<WoodenComplexMater
super(modID, baseName, receipGroupPrefix);
this.planksColor = planksColor;
this.woodColor = woodColor;
this.woodType = BCLWoodTypeWrapper.create(modID, baseName).setColor(planksColor).build();
this.woodType = createWoodTypeBuilder().build();
this.boatType = null;
}
protected BCLWoodTypeWrapper.Builder createWoodTypeBuilder() {
return BCLWoodTypeWrapper.create(getModID(), getBaseName()).setColor(planksColor);
}
@Override
protected FabricBlockSettings getBlockSettings() {
return FabricBlockSettings.copyOf(Blocks.OAK_PLANKS)
@ -133,7 +137,7 @@ public class WoodenComplexMaterial extends ComplexMaterialSet<WoodenComplexMater
ifBlockPresent(WoodSlots.STRIPPED_LOG, addFlammableHardWood);
ifBlockPresent(WoodSlots.STRIPPED_BARK, addFlammableHardWood);
}
public void initBoatType() {
if (getBoatType() == null) {

View file

@ -1,6 +1,6 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.StripableBarkBlock;
import org.betterx.bclib.blocks.BaseStripableBarkBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
@ -9,8 +9,6 @@ import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -26,9 +24,10 @@ public class Bark extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new StripableBarkBlock(
return new BaseStripableBarkBlock.Wood(
parentMaterial.woodColor,
parentMaterial.getBlock(WoodSlots.STRIPPED_BARK)
parentMaterial.getBlock(WoodSlots.STRIPPED_BARK),
parentMaterial.woodType.flammable
);
}
@ -37,13 +36,9 @@ public class Bark extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry
.setBlockTags(
BlockTags.LOGS,
BlockTags.LOGS_THAT_BURN,
parentMaterial.getBlockTag(WoodenComplexMaterial.TAG_LOGS)
)
.setItemTags(
ItemTags.LOGS,
ItemTags.LOGS_THAT_BURN,
parentMaterial.getItemTag(WoodenComplexMaterial.TAG_LOGS)
);
}

View file

@ -3,15 +3,11 @@ package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseBarrelBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import org.betterx.worlds.together.tag.v3.CommonItemTags;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -27,13 +23,7 @@ public class Barrel extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseBarrelBlock(parentMaterial.getBlock(WoodSlots.PLANKS));
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.MINEABLE_WITH_AXE, CommonBlockTags.BARREL, CommonBlockTags.WOODEN_BARREL)
.setItemTags(CommonItemTags.BARREL, CommonItemTags.WOODEN_BARREL);
return new BaseBarrelBlock.Wood(parentMaterial.getBlock(WoodSlots.PLANKS));
}
@Override

View file

@ -3,14 +3,11 @@ package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseBookshelfBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -27,12 +24,7 @@ public class Bookshelf extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseBookshelfBlock(parentMaterial.getBlock(WoodSlots.PLANKS));
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.MINEABLE_WITH_AXE, CommonBlockTags.BOOKSHELVES);
return new BaseBookshelfBlock.Wood(parentMaterial.getBlock(WoodSlots.PLANKS));
}
@Override

View file

@ -1,16 +1,13 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseWoodenButtonBlock;
import org.betterx.bclib.blocks.BaseButtonBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -26,18 +23,12 @@ public class Button extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseWoodenButtonBlock(
return new BaseButtonBlock.Wood(
parentMaterial.getBlock(WoodSlots.PLANKS),
parentMaterial.woodType.setType()
);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.BUTTONS, BlockTags.WOODEN_BUTTONS)
.setItemTags(ItemTags.BUTTONS, ItemTags.WOODEN_BUTTONS);
}
@Override
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder

View file

@ -3,15 +3,11 @@ package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseChestBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import org.betterx.worlds.together.tag.v3.CommonItemTags;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -27,13 +23,7 @@ public class Chest extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseChestBlock(parentMaterial.getBlock(WoodSlots.PLANKS));
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.MINEABLE_WITH_AXE, CommonBlockTags.CHEST, CommonBlockTags.WOODEN_CHEST)
.setItemTags(CommonItemTags.CHEST, CommonItemTags.WOODEN_CHEST);
return new BaseChestBlock.Wood(parentMaterial.getBlock(WoodSlots.PLANKS));
}
@Override

View file

@ -3,14 +3,11 @@ package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseComposterBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import org.betterx.worlds.together.tag.v3.CommonPoiTags;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -26,12 +23,7 @@ public class Composter extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseComposterBlock(parentMaterial.getBlock(WoodSlots.PLANKS));
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.MINEABLE_WITH_AXE, CommonPoiTags.FARMER_WORKSTATION);
return new BaseComposterBlock.Wood(parentMaterial.getBlock(WoodSlots.PLANKS));
}
@Override

View file

@ -3,15 +3,11 @@ package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseCraftingTableBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import org.betterx.worlds.together.tag.v3.CommonItemTags;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -27,13 +23,7 @@ public class CraftingTable extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseCraftingTableBlock(parentMaterial.getBlock(WoodSlots.PLANKS));
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.MINEABLE_WITH_AXE, CommonBlockTags.WORKBENCHES)
.setItemTags(CommonItemTags.WORKBENCHES);
return new BaseCraftingTableBlock.Wood(parentMaterial.getBlock(WoodSlots.PLANKS));
}
@Override

View file

@ -3,14 +3,11 @@ package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseDoorBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -26,18 +23,12 @@ public class Door extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseDoorBlock(
return new BaseDoorBlock.Wood(
parentMaterial.getBlock(WoodSlots.PLANKS),
parentMaterial.woodType.setType()
);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.DOORS, BlockTags.WOODEN_DOORS)
.setItemTags(ItemTags.DOORS, ItemTags.WOODEN_DOORS);
}
@Override
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder

View file

@ -3,14 +3,11 @@ package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseFenceBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -27,13 +24,7 @@ public class Fence extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseFenceBlock(parentMaterial.getBlock(WoodSlots.PLANKS));
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.FENCES, BlockTags.WOODEN_FENCES)
.setItemTags(ItemTags.FENCES, ItemTags.WOODEN_FENCES);
return new BaseFenceBlock.Wood(parentMaterial.getBlock(WoodSlots.PLANKS), parentMaterial.woodType.setType());
}
@Override

View file

@ -3,13 +3,11 @@ package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseGateBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -26,16 +24,12 @@ public class Gate extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseGateBlock(
return new BaseGateBlock.Wood(
parentMaterial.getBlock(WoodSlots.PLANKS),
parentMaterial.woodType.type()
);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.FENCE_GATES);
}
@Override
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {

View file

@ -8,8 +8,6 @@ import org.betterx.bclib.complexmaterials.entry.RecipeEntry;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Items;
import java.util.function.Consumer;
@ -27,9 +25,8 @@ public class HangingSign extends MaterialSlot<WoodenComplexMaterial> {
public void addBlockEntry(WoodenComplexMaterial parentMaterial, Consumer<BlockEntry> adder) {
var signEntry = new BlockEntry(
suffix,
(complexMaterial, settings) -> new BaseHangingSignBlock(parentMaterial.woodType)
).setBlockTags(BlockTags.CEILING_HANGING_SIGNS)
.setItemTags(ItemTags.HANGING_SIGNS);
(complexMaterial, settings) -> new BaseHangingSignBlock.Wood(parentMaterial.woodType)
);
var wallSignEntry = new BlockEntry(
WALL_SUFFFIX,
@ -40,7 +37,8 @@ public class HangingSign extends MaterialSlot<WoodenComplexMaterial> {
}
return null;
}
).setBlockTags(BlockTags.WALL_HANGING_SIGNS);
);
adder.accept(signEntry);
adder.accept(wallSignEntry);
}

View file

@ -3,19 +3,16 @@ package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseLadderBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Ladder extends SimpleMaterialSlot<WoodenComplexMaterial> {
public Ladder() {
@ -26,16 +23,11 @@ public class Ladder extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseLadderBlock(parentMaterial.getBlock(WoodSlots.PLANKS));
return new BaseLadderBlock.Wood(parentMaterial.getBlock(WoodSlots.PLANKS));
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.MINEABLE_WITH_AXE);
}
@Override
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
protected void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix))
.setOutputCount(3)

View file

@ -9,8 +9,6 @@ import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -26,9 +24,10 @@ public class Log extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseStripableLogBlock(
return new BaseStripableLogBlock.Wood(
parentMaterial.woodColor,
parentMaterial.getBlock(WoodSlots.STRIPPED_LOG)
parentMaterial.getBlock(WoodSlots.STRIPPED_LOG),
parentMaterial.woodType.flammable
);
}
@ -36,13 +35,9 @@ public class Log extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry
.setBlockTags(
BlockTags.LOGS,
BlockTags.LOGS_THAT_BURN,
parentMaterial.getBlockTag(WoodenComplexMaterial.TAG_LOGS)
)
.setItemTags(
ItemTags.LOGS,
ItemTags.LOGS_THAT_BURN,
parentMaterial.getItemTag(WoodenComplexMaterial.TAG_LOGS)
);
}

View file

@ -1,16 +1,13 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseBlock;
import org.betterx.bclib.blocks.BasePlanks;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -26,14 +23,7 @@ public class Planks extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseBlock(settings);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry
.setBlockTags(BlockTags.PLANKS)
.setItemTags(ItemTags.PLANKS);
return new BasePlanks.Wood(settings);
}
@Override

View file

@ -1,16 +1,13 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.WoodenPressurePlateBlock;
import org.betterx.bclib.blocks.BasePressurePlateBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -26,18 +23,12 @@ public class PressurePlate extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new WoodenPressurePlateBlock(
return new BasePressurePlateBlock.Wood(
parentMaterial.getBlock(WoodSlots.PLANKS),
parentMaterial.woodType.setType()
);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.PRESSURE_PLATES, BlockTags.WOODEN_PRESSURE_PLATES)
.setItemTags(ItemTags.WOODEN_PRESSURE_PLATES);
}
@Override
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder

View file

@ -8,8 +8,6 @@ import org.betterx.bclib.complexmaterials.entry.RecipeEntry;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Items;
import java.util.function.Consumer;
@ -27,9 +25,8 @@ public class Sign extends MaterialSlot<WoodenComplexMaterial> {
public void addBlockEntry(WoodenComplexMaterial parentMaterial, Consumer<BlockEntry> adder) {
var signEntry = new BlockEntry(
suffix,
(complexMaterial, settings) -> new BaseSignBlock(parentMaterial.woodType)
).setBlockTags(BlockTags.STANDING_SIGNS)
.setItemTags(ItemTags.SIGNS);
(complexMaterial, settings) -> new BaseSignBlock.Wood(parentMaterial.woodType)
);
var wallSignEntry = new BlockEntry(
WALL_SUFFFIX,
@ -40,7 +37,7 @@ public class Sign extends MaterialSlot<WoodenComplexMaterial> {
}
return null;
}
).setBlockTags(BlockTags.WALL_SIGNS);
);
adder.accept(signEntry);
adder.accept(wallSignEntry);
}

View file

@ -3,14 +3,11 @@ package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseSlabBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -26,13 +23,7 @@ public class Slab extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseSlabBlock(parentMaterial.getBlock(WoodSlots.PLANKS), false);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.WOODEN_SLABS, BlockTags.SLABS)
.setItemTags(ItemTags.WOODEN_SLABS, ItemTags.SLABS);
return new BaseSlabBlock.Wood(parentMaterial.getBlock(WoodSlots.PLANKS), !parentMaterial.woodType.flammable);
}
@Override

View file

@ -3,14 +3,11 @@ package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseStairsBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -26,13 +23,7 @@ public class Stairs extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseStairsBlock(parentMaterial.getBlock(WoodSlots.PLANKS), false);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.WOODEN_STAIRS, BlockTags.STAIRS)
.setItemTags(ItemTags.WOODEN_STAIRS, ItemTags.STAIRS);
return new BaseStairsBlock.Wood(parentMaterial.getBlock(WoodSlots.PLANKS), !parentMaterial.woodType.flammable);
}
@Override

View file

@ -9,8 +9,6 @@ import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -26,20 +24,16 @@ public class StrippedBark extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseBarkBlock(settings);
return new BaseBarkBlock.Wood(settings, parentMaterial.woodType.flammable);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry
.setBlockTags(
BlockTags.LOGS,
BlockTags.LOGS_THAT_BURN,
parentMaterial.getBlockTag(WoodenComplexMaterial.TAG_LOGS)
)
.setItemTags(
ItemTags.LOGS,
ItemTags.LOGS_THAT_BURN,
parentMaterial.getItemTag(WoodenComplexMaterial.TAG_LOGS)
);
}

View file

@ -26,22 +26,34 @@ public class StrippedLog extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseRotatedPillarBlock(settings);
return new BaseRotatedPillarBlock.Wood(settings, parentMaterial.woodType.flammable);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry
.setBlockTags(
BlockTags.LOGS,
BlockTags.LOGS_THAT_BURN,
parentMaterial.getBlockTag(WoodenComplexMaterial.TAG_LOGS)
)
.setItemTags(
ItemTags.LOGS,
ItemTags.LOGS_THAT_BURN,
parentMaterial.getItemTag(WoodenComplexMaterial.TAG_LOGS)
);
if (parentMaterial.woodType.flammable) {
entry
.setBlockTags(
BlockTags.LOGS,
BlockTags.LOGS_THAT_BURN,
parentMaterial.getBlockTag(WoodenComplexMaterial.TAG_LOGS)
)
.setItemTags(
ItemTags.LOGS,
ItemTags.LOGS_THAT_BURN,
parentMaterial.getItemTag(WoodenComplexMaterial.TAG_LOGS)
);
} else {
entry
.setBlockTags(
BlockTags.LOGS,
parentMaterial.getBlockTag(WoodenComplexMaterial.TAG_LOGS)
)
.setItemTags(
ItemTags.LOGS,
parentMaterial.getItemTag(WoodenComplexMaterial.TAG_LOGS)
);
}
}
@Override

View file

@ -3,14 +3,11 @@ package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseTrapdoorBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
@ -25,18 +22,13 @@ public class Trapdoor extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseTrapdoorBlock(
return new BaseTrapdoorBlock.Wood(
parentMaterial.getBlock(WoodSlots.PLANKS),
parentMaterial.woodType.setType()
parentMaterial.woodType.setType(),
parentMaterial.woodType.flammable
);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.TRAPDOORS, BlockTags.WOODEN_TRAPDOORS)
.setItemTags(ItemTags.TRAPDOORS, ItemTags.WOODEN_TRAPDOORS);
}
@Override
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder.crafting(id, parentMaterial.getBlock(suffix))

View file

@ -9,6 +9,7 @@ public class CommonBlockTags {
public static final TagKey<Block> BARREL = TagManager.BLOCKS.makeCommonTag("barrel");
public static final TagKey<Block> BOOKSHELVES = TagManager.BLOCKS.makeCommonTag("bookshelves");
public static final TagKey<Block> CHEST = TagManager.BLOCKS.makeCommonTag("chest");
public static final TagKey<Block> COMPOSTER = TagManager.BLOCKS.makeCommonTag("composter");
public static final TagKey<Block> END_STONES = TagManager.BLOCKS.makeCommonTag("end_stones");
public static final TagKey<Block> GEN_END_STONES = END_STONES;
public static final TagKey<Block> IMMOBILE = TagManager.BLOCKS.makeCommonTag("immobile");
@ -26,6 +27,7 @@ public class CommonBlockTags {
public static final TagKey<Block> SCULK_LIKE = TagManager.BLOCKS.makeCommonTag("sculk_like");
public static final TagKey<Block> WOODEN_BARREL = TagManager.BLOCKS.makeCommonTag("wooden_barrels");
public static final TagKey<Block> WOODEN_CHEST = TagManager.BLOCKS.makeCommonTag("wooden_chests");
public static final TagKey<Block> WOODEN_COMPOSTER = TagManager.BLOCKS.makeCommonTag("wooden_composter");
public static final TagKey<Block> WORKBENCHES = TagManager.BLOCKS.makeCommonTag("workbench");
public static final TagKey<Block> DRAGON_IMMUNE = TagManager.BLOCKS.makeCommonTag("dragon_immune");
@ -115,5 +117,13 @@ public class CommonBlockTags {
CommonBlockTags.NETHER_STONES,
CommonBlockTags.NETHERRACK
);
TagManager.BLOCKS.addOtherTags(
BlockTags.MINEABLE_WITH_AXE,
WOODEN_BARREL,
WOODEN_COMPOSTER,
WOODEN_CHEST,
WORKBENCHES
);
}
}

View file

@ -78,6 +78,10 @@ public class TagRegistry<T> {
public final void add(T element, TagKey<T>... tagIDs) {
super.add(element, tagIDs);
}
public final boolean contains(TagKey<T> tagID, T element) {
return super.contains(tagID, element);
}
}
public static class Biomes extends Simple<Biome> {
@ -254,6 +258,19 @@ public class TagRegistry<T> {
}
}
protected boolean contains(TagKey<T> tagID, T element) {
final Set<TagEntry> set = getSetForTag(tagID);
final ResourceLocation id = locationProvider.apply(element);
if (id != null) {
for (var entry : set)
if (!entry.elementOrTag().tag()) {
if (id.equals(entry.elementOrTag().id()))
return true;
}
}
return false;
}
protected void add(T element, TagKey<T>... tagIDs) {
for (TagKey<T> tagID : tagIDs) {
add(tagID, element);