added slab mode to BlockBuilder

This commit is contained in:
DaniTheSkunk 2022-10-30 01:50:46 +00:00
parent 878f0bfb40
commit 03af07cb04
1 changed files with 15 additions and 1 deletions

View File

@ -3,17 +3,20 @@ package com.danitheskunk.skunkstuff;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SlabBlock;
import net.minecraft.world.level.material.Material;
import org.quiltmc.qsl.block.extensions.api.QuiltBlockSettings;
public class BlockBuilder extends QuiltBlockSettings {
public String name;
public CreativeModeTab creativeModeTab = CreativeModeTab.TAB_MISC;
public BlockType blockType;
public Block block;
public BlockBuilder() {
super(QuiltBlockSettings.of(Material.WOOD));
strength(2);
opaque(false);
blockType = BlockType.Full;
}
public BlockBuilder name(String name) {
@ -26,9 +29,20 @@ public class BlockBuilder extends QuiltBlockSettings {
return this;
}
public BlockBuilder slab() {
blockType = BlockType.Slab;
return this;
}
public Block build() {
block = new Block(this);
block = switch(blockType) {
case Full -> new Block(this);
case Slab -> new SlabBlock(this);
};
Blocks.addToDeffered(this);
return block;
}
private enum BlockType {
Full, Slab
}
}