TheBrokenRail
7f813582c1
All checks were successful
EnergonRelics/pipeline/head This commit looks good
35 lines
1.1 KiB
Java
35 lines
1.1 KiB
Java
package com.thebrokenrail.energonrelics.block.util;
|
|
|
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
|
import net.fabricmc.loader.api.FabricLoader;
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.item.BlockItem;
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.util.Identifier;
|
|
import net.minecraft.util.registry.Registry;
|
|
|
|
public class SimpleBlock extends Block {
|
|
public SimpleBlock(Settings settings) {
|
|
super(settings);
|
|
}
|
|
|
|
public void register(String name) {
|
|
Registry.register(Registry.BLOCK, new Identifier(EnergonRelics.NAMESPACE, name), this);
|
|
if (registerItem()) {
|
|
Item.Settings settings = new Item.Settings();
|
|
if (addToItemGroup() || FabricLoader.getInstance().isDevelopmentEnvironment()) {
|
|
settings.group(EnergonRelics.ITEM_GROUP);
|
|
}
|
|
Registry.register(Registry.ITEM, new Identifier(EnergonRelics.NAMESPACE, name), new BlockItem(this, settings));
|
|
}
|
|
}
|
|
|
|
protected boolean addToItemGroup() {
|
|
return true;
|
|
}
|
|
|
|
protected boolean registerItem() {
|
|
return true;
|
|
}
|
|
}
|