added slab mode to BlockBuilder
This commit is contained in:
parent
878f0bfb40
commit
03af07cb04
|
@ -3,17 +3,20 @@ package com.danitheskunk.skunkstuff;
|
||||||
|
|
||||||
import net.minecraft.world.item.CreativeModeTab;
|
import net.minecraft.world.item.CreativeModeTab;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.SlabBlock;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import org.quiltmc.qsl.block.extensions.api.QuiltBlockSettings;
|
import org.quiltmc.qsl.block.extensions.api.QuiltBlockSettings;
|
||||||
|
|
||||||
public class BlockBuilder extends QuiltBlockSettings {
|
public class BlockBuilder extends QuiltBlockSettings {
|
||||||
public String name;
|
public String name;
|
||||||
public CreativeModeTab creativeModeTab = CreativeModeTab.TAB_MISC;
|
public CreativeModeTab creativeModeTab = CreativeModeTab.TAB_MISC;
|
||||||
|
public BlockType blockType;
|
||||||
public Block block;
|
public Block block;
|
||||||
public BlockBuilder() {
|
public BlockBuilder() {
|
||||||
super(QuiltBlockSettings.of(Material.WOOD));
|
super(QuiltBlockSettings.of(Material.WOOD));
|
||||||
strength(2);
|
strength(2);
|
||||||
opaque(false);
|
opaque(false);
|
||||||
|
blockType = BlockType.Full;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockBuilder name(String name) {
|
public BlockBuilder name(String name) {
|
||||||
|
@ -26,9 +29,20 @@ public class BlockBuilder extends QuiltBlockSettings {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BlockBuilder slab() {
|
||||||
|
blockType = BlockType.Slab;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Block build() {
|
public Block build() {
|
||||||
block = new Block(this);
|
block = switch(blockType) {
|
||||||
|
case Full -> new Block(this);
|
||||||
|
case Slab -> new SlabBlock(this);
|
||||||
|
};
|
||||||
Blocks.addToDeffered(this);
|
Blocks.addToDeffered(this);
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
private enum BlockType {
|
||||||
|
Full, Slab
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue