[Fix] Missing mineable definition for base block types (quiqueck/BetterEnd#224)

This commit is contained in:
Frank 2023-06-17 12:23:01 +02:00
parent bb64e86754
commit 835f134329
14 changed files with 193 additions and 14 deletions

View file

@ -1,5 +1,6 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourMetal;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
@ -29,12 +30,12 @@ import java.util.Map;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public class BaseMetalBarsBlock extends IronBarsBlock implements BlockModelProvider, RenderLayerProvider {
public BaseMetalBarsBlock(Block source) {
public abstract class BaseBarsBlock extends IronBarsBlock implements BlockModelProvider, RenderLayerProvider, BehaviourMetal {
public BaseBarsBlock(Block source) {
this(Properties.copy(source).strength(5.0F, 6.0F).noOcclusion());
}
public BaseMetalBarsBlock(BlockBehaviour.Properties properties) {
public BaseBarsBlock(BlockBehaviour.Properties properties) {
super(properties);
}
@ -126,4 +127,15 @@ public class BaseMetalBarsBlock extends IronBarsBlock implements BlockModelProvi
public BCLRenderLayer getRenderLayer() {
return BCLRenderLayer.CUTOUT;
}
public static class Metal extends BaseBarsBlock implements BehaviourMetal {
public Metal(Block source) {
super(source);
}
public Metal(Properties properties) {
super(properties);
}
}
}

View file

@ -1,5 +1,6 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourMetal;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
@ -28,7 +29,7 @@ import java.util.Map;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public class BaseChainBlock extends ChainBlock implements BlockModelProvider, RenderLayerProvider {
public abstract class BaseChainBlock extends ChainBlock implements BlockModelProvider, RenderLayerProvider {
public BaseChainBlock(MapColor color) {
this(Properties.copy(Blocks.CHAIN).mapColor(color));
}
@ -73,4 +74,15 @@ public class BaseChainBlock extends ChainBlock implements BlockModelProvider, Re
public BCLRenderLayer getRenderLayer() {
return BCLRenderLayer.CUTOUT;
}
public static class Metal extends BaseChainBlock implements BehaviourMetal {
public Metal(MapColor color) {
super(color);
}
public Metal(Properties properties) {
super(properties);
}
}
}

View file

@ -1,5 +1,6 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourStone;
import org.betterx.bclib.blockentities.BaseFurnaceBlockEntity;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
@ -40,7 +41,7 @@ import java.util.Map;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public class BaseFurnaceBlock extends FurnaceBlock implements BlockModelProvider, RenderLayerProvider {
public abstract class BaseFurnaceBlock extends FurnaceBlock implements BlockModelProvider, RenderLayerProvider {
public BaseFurnaceBlock(Block source) {
this(Properties.copy(source).lightLevel(state -> state.getValue(LIT) ? 13 : 0));
}
@ -143,4 +144,14 @@ public class BaseFurnaceBlock extends FurnaceBlock implements BlockModelProvider
AbstractFurnaceBlockEntity::serverTick
);
}
public static class Stone extends BaseFurnaceBlock implements BehaviourStone {
public Stone(Block source) {
super(source);
}
public Stone(BlockBehaviour.Properties properties) {
super(properties);
}
}
}

View file

@ -1,5 +1,6 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourStone;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
@ -32,7 +33,7 @@ import java.util.Map;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public class BasePathBlock extends BaseBlockNotFull {
public abstract class BasePathBlock extends BaseBlockNotFull {
private static final VoxelShape SHAPE = box(0, 0, 0, 16, 15, 16);
private Block baseBlock;
@ -100,4 +101,10 @@ public class BasePathBlock extends BaseBlockNotFull {
registerBlockModel(stateId, modelId, blockState, modelCache);
return ModelsHelper.createRandomTopModel(modelId);
}
public static class Stone extends BasePathBlock implements BehaviourStone {
public Stone(Block source) {
super(source);
}
}
}

View file

@ -1,5 +1,6 @@
package org.betterx.bclib.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourStone;
import org.betterx.bclib.client.models.BasePatterns;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
@ -45,7 +46,7 @@ import java.util.Optional;
import org.jetbrains.annotations.Nullable;
@SuppressWarnings("deprecation")
public class StalactiteBlock extends BaseBlockNotFull implements SimpleWaterloggedBlock, LiquidBlockContainer, RenderLayerProvider {
public abstract class StalactiteBlock extends BaseBlockNotFull implements SimpleWaterloggedBlock, LiquidBlockContainer, RenderLayerProvider {
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
public static final BooleanProperty IS_FLOOR = BlockProperties.IS_FLOOR;
public static final IntegerProperty SIZE = BlockProperties.SIZE;
@ -251,6 +252,17 @@ public class StalactiteBlock extends BaseBlockNotFull implements SimpleWaterlogg
return BCLRenderLayer.CUTOUT;
}
public static class Stone extends StalactiteBlock implements BehaviourStone {
public Stone(Block source) {
super(source);
}
public Stone(Properties properties) {
super(properties);
}
}
static {
float end = 2F / 8F;
float start = 5F / 8F;

View file

@ -1,6 +1,8 @@
package org.betterx.bclib.blocks.signs;
import org.betterx.bclib.behaviours.BehaviourBuilders;
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.complexmaterials.BCLWoodTypeWrapper;
import org.betterx.bclib.interfaces.BlockModelProvider;
@ -68,6 +70,34 @@ public abstract class BaseHangingSignBlock extends CeilingHangingSignBlock imple
}
}
public static class Stone extends BaseHangingSignBlock implements BehaviourStone {
public Stone(WoodType type) {
this(type, MapColor.WOOD, true);
}
public Stone(BCLWoodTypeWrapper type) {
this(type.type, type.color, type.flammable);
}
public Stone(WoodType type, MapColor color, boolean flammable) {
super(type, color, flammable, BaseWallHangingSignBlock.Stone::new);
}
}
public static class Metal extends BaseHangingSignBlock implements BehaviourMetal {
public Metal(WoodType type) {
this(type, MapColor.WOOD, true);
}
public Metal(BCLWoodTypeWrapper type) {
this(type.type, type.color, type.flammable);
}
public Metal(WoodType type, MapColor color, boolean flammable) {
super(type, color, flammable, BaseWallHangingSignBlock.Stone::new);
}
}
public static BaseHangingSignBlock from(WoodType type) {
return new BaseHangingSignBlock.Wood(type);
}

View file

@ -1,5 +1,7 @@
package org.betterx.bclib.blocks.signs;
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.TagProvider;
@ -30,4 +32,16 @@ public abstract class BaseWallHangingSignBlock extends WallHangingSignBlock impl
super(properties, woodType);
}
}
public static class Stone extends BaseWallHangingSignBlock implements BehaviourStone {
public Stone(Properties properties, WoodType woodType) {
super(properties, woodType);
}
}
public static class Metal extends BaseWallHangingSignBlock implements BehaviourMetal {
public Metal(Properties properties, WoodType woodType) {
super(properties, woodType);
}
}
}

View file

@ -1,5 +1,6 @@
package org.betterx.bclib.blocks.signs;
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
import org.betterx.bclib.interfaces.TagProvider;
import net.minecraft.tags.BlockTags;
@ -21,7 +22,7 @@ public abstract class BaseWallSignBlock extends WallSignBlock implements TagProv
blockTags.add(BlockTags.WALL_SIGNS);
}
public static class Wood extends BaseWallSignBlock {
public static class Wood extends BaseWallSignBlock implements BehaviourWood {
public Wood(Properties properties, WoodType woodType) {
super(properties, woodType);
}

View file

@ -36,7 +36,7 @@ public class BarStool extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseBarStool(parentMaterial.getBlock(WoodSlots.SLAB));
return new BaseBarStool.Wood(parentMaterial.getBlock(WoodSlots.SLAB));
}
@Override

View file

@ -41,7 +41,7 @@ public class Chair extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseChair(parentMaterial.getBlock(WoodSlots.SLAB));
return new BaseChair.Wood(parentMaterial.getBlock(WoodSlots.SLAB));
}
@Override

View file

@ -41,7 +41,7 @@ public class Taburet extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) {
return new BaseTaburet(parentMaterial.getBlock(WoodSlots.SLAB));
return new BaseTaburet.Wood(parentMaterial.getBlock(WoodSlots.SLAB));
}
@Override

View file

@ -1,5 +1,10 @@
package org.betterx.bclib.furniture.block;
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 net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
@ -7,7 +12,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
public class BaseBarStool extends AbstractChair {
public abstract class BaseBarStool extends AbstractChair {
private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 16, 12);
public BaseBarStool(Block block) {
@ -18,4 +23,26 @@ public class BaseBarStool extends AbstractChair {
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
return SHAPE;
}
public static class Wood extends BaseBarStool implements BehaviourWood {
public Wood(Block block) {
super(block);
}
}
public static class Stone extends BaseBarStool implements BehaviourStone {
public Stone(Block block) {
super(block);
}
}
public static class Metal extends BaseBarStool implements BehaviourMetal {
public Metal(Block block) {
super(block);
}
}
public static BaseBarStool from(Block source) {
return BehaviourHelper.from(source, Wood::new, Stone::new, Metal::new);
}
}

View file

@ -1,5 +1,9 @@
package org.betterx.bclib.furniture.block;
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.util.BlocksHelper;
import net.minecraft.core.BlockPos;
@ -27,7 +31,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
import java.util.Collections;
import java.util.List;
public class BaseChair extends AbstractChair {
public abstract class BaseChair extends AbstractChair {
private static final VoxelShape SHAPE_BOTTOM = box(3, 0, 3, 13, 16, 13);
private static final VoxelShape SHAPE_TOP = box(3, 0, 3, 13, 6, 13);
private static final VoxelShape COLLIDER = box(3, 0, 3, 13, 10, 13);
@ -114,4 +118,26 @@ public class BaseChair extends AbstractChair {
}
super.playerWillDestroy(world, pos, state, player);
}
public static class Wood extends BaseChair implements BehaviourWood {
public Wood(Block block) {
super(block);
}
}
public static class Stone extends BaseChair implements BehaviourStone {
public Stone(Block block) {
super(block);
}
}
public static class Metal extends BaseChair implements BehaviourMetal {
public Metal(Block block) {
super(block);
}
}
public static BaseChair from(Block source) {
return BehaviourHelper.from(source, Wood::new, Stone::new, Metal::new);
}
}

View file

@ -1,5 +1,10 @@
package org.betterx.bclib.furniture.block;
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 net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
@ -7,7 +12,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
public class BaseTaburet extends AbstractChair {
public abstract class BaseTaburet extends AbstractChair {
private static final VoxelShape SHAPE = Block.box(2, 0, 2, 14, 10, 14);
public BaseTaburet(Block block) {
@ -18,4 +23,26 @@ public class BaseTaburet extends AbstractChair {
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
return SHAPE;
}
public static class Wood extends BaseTaburet implements BehaviourWood {
public Wood(Block block) {
super(block);
}
}
public static class Stone extends BaseTaburet implements BehaviourStone {
public Stone(Block block) {
super(block);
}
}
public static class Metal extends BaseTaburet implements BehaviourMetal {
public Metal(Block block) {
super(block);
}
}
public static BaseTaburet from(Block source) {
return BehaviourHelper.from(source, Wood::new, Stone::new, Metal::new);
}
}