2020-07-13 20:37:21 +00:00
|
|
|
package com.thebrokenrail.energonrelics.block.util;
|
|
|
|
|
|
|
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
2020-07-22 18:07:29 +00:00
|
|
|
import net.fabricmc.loader.api.FabricLoader;
|
2020-07-13 20:37:21 +00:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.item.BlockItem;
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.util.Identifier;
|
2020-08-03 23:48:02 +00:00
|
|
|
import net.minecraft.util.Rarity;
|
2020-07-13 20:37:21 +00:00
|
|
|
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);
|
2020-07-23 23:31:02 +00:00
|
|
|
if (registerItem()) {
|
|
|
|
Item.Settings settings = new Item.Settings();
|
|
|
|
if (addToItemGroup() || FabricLoader.getInstance().isDevelopmentEnvironment()) {
|
|
|
|
settings.group(EnergonRelics.ITEM_GROUP);
|
|
|
|
}
|
2020-08-03 23:48:02 +00:00
|
|
|
if (isEpic()) {
|
|
|
|
settings.rarity(Rarity.EPIC);
|
|
|
|
}
|
2020-07-30 19:49:18 +00:00
|
|
|
settings.maxCount(getMaxCount());
|
2020-07-23 23:31:02 +00:00
|
|
|
Registry.register(Registry.ITEM, new Identifier(EnergonRelics.NAMESPACE, name), new BlockItem(this, settings));
|
2020-07-21 02:39:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-22 18:07:29 +00:00
|
|
|
protected boolean addToItemGroup() {
|
2020-07-21 02:39:30 +00:00
|
|
|
return true;
|
2020-07-13 20:37:21 +00:00
|
|
|
}
|
2020-07-23 23:31:02 +00:00
|
|
|
|
|
|
|
protected boolean registerItem() {
|
|
|
|
return true;
|
|
|
|
}
|
2020-07-30 19:49:18 +00:00
|
|
|
|
|
|
|
protected int getMaxCount() {
|
|
|
|
return 64;
|
|
|
|
}
|
2020-08-03 23:48:02 +00:00
|
|
|
|
|
|
|
protected boolean isEpic() {
|
|
|
|
return false;
|
|
|
|
}
|
2020-07-13 20:37:21 +00:00
|
|
|
}
|