Custom creative tab

This commit is contained in:
DBotThePony 2021-08-17 19:16:56 +07:00
parent 69a67012c4
commit ac3204b2f3
Signed by: DBot
GPG Key ID: DCC23B5715498507
7 changed files with 32 additions and 15 deletions

View File

@ -1,7 +1,9 @@
package ru.dbotthepony.mc.otm; package ru.dbotthepony.mc.otm;
import net.minecraft.world.inventory.MenuType; import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
@ -36,6 +38,8 @@ public class OverdriveThatMatters {
public static AndroidGui ANDROID_GUI; public static AndroidGui ANDROID_GUI;
public static CreativeModeTab CREATIVE_TAB;
public OverdriveThatMatters() { public OverdriveThatMatters() {
// Register the setup method for modloading // Register the setup method for modloading
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
@ -52,6 +56,13 @@ public class OverdriveThatMatters {
MinecraftForge.EVENT_BUS.register(MatterGrid.class); MinecraftForge.EVENT_BUS.register(MatterGrid.class);
// LOGGER.info("Registered event handlers"); // LOGGER.info("Registered event handlers");
CREATIVE_TAB = new CreativeModeTab("otm") {
@Override
public ItemStack makeIcon() {
return new ItemStack(Registry.Items.BATTERY_CREATIVE, 1);
}
};
} }
private void setup(final FMLCommonSetupEvent event) { private void setup(final FMLCommonSetupEvent event) {

View File

@ -99,15 +99,15 @@ public class Registry {
} }
public static class Items { public static class Items {
public static final Item ANDROID_STATION = new BlockItem(Blocks.ANDROID_STATION, new Item.Properties().stacksTo(64).tab(CreativeModeTab.TAB_MISC)); public static final Item ANDROID_STATION = new BlockItem(Blocks.ANDROID_STATION, new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
public static final Item BATTERY_BANK = new BlockItem(Blocks.BATTERY_BANK, new Item.Properties().stacksTo(64).tab(CreativeModeTab.TAB_MISC)); public static final Item BATTERY_BANK = new BlockItem(Blocks.BATTERY_BANK, new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
public static final Item MATTER_DECOMPOSER = new BlockItem(Blocks.MATTER_DECOMPOSER, new Item.Properties().stacksTo(64).tab(CreativeModeTab.TAB_MISC)); public static final Item MATTER_DECOMPOSER = new BlockItem(Blocks.MATTER_DECOMPOSER, new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
public static final Item MATTER_CAPACITOR_BANK = new BlockItem(Blocks.MATTER_CAPACITOR_BANK, new Item.Properties().stacksTo(64).tab(CreativeModeTab.TAB_MISC)); public static final Item MATTER_CAPACITOR_BANK = new BlockItem(Blocks.MATTER_CAPACITOR_BANK, new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
public static final Item MATTER_CABLE = new BlockItem(Blocks.MATTER_CABLE, new Item.Properties().stacksTo(64).tab(CreativeModeTab.TAB_MISC)); public static final Item MATTER_CABLE = new BlockItem(Blocks.MATTER_CABLE, new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
public static final Item PATTERN_STORAGE = new BlockItem(Blocks.PATTERN_STORAGE, new Item.Properties().stacksTo(64).tab(CreativeModeTab.TAB_MISC)); public static final Item PATTERN_STORAGE = new BlockItem(Blocks.PATTERN_STORAGE, new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
public static final Item MATTER_SCANNER = new BlockItem(Blocks.MATTER_SCANNER, new Item.Properties().stacksTo(64).tab(CreativeModeTab.TAB_MISC)); public static final Item MATTER_SCANNER = new BlockItem(Blocks.MATTER_SCANNER, new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
public static final Item MATTER_PANEL = new BlockItem(Blocks.MATTER_PANEL, new Item.Properties().stacksTo(64).tab(CreativeModeTab.TAB_MISC)); public static final Item MATTER_PANEL = new BlockItem(Blocks.MATTER_PANEL, new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
public static final Item MATTER_REPLICATOR = new BlockItem(Blocks.MATTER_REPLICATOR, new Item.Properties().stacksTo(64).tab(CreativeModeTab.TAB_MISC)); public static final Item MATTER_REPLICATOR = new BlockItem(Blocks.MATTER_REPLICATOR, new Item.Properties().stacksTo(64).tab(OverdriveThatMatters.CREATIVE_TAB));
public static final ItemPill PILL_ANDROID = new ItemPill(ItemPill.PillType.BECOME_ANDROID); public static final ItemPill PILL_ANDROID = new ItemPill(ItemPill.PillType.BECOME_ANDROID);
public static final ItemPill PILL_HUMANE = new ItemPill(ItemPill.PillType.BECOME_HUMANE); public static final ItemPill PILL_HUMANE = new ItemPill(ItemPill.PillType.BECOME_HUMANE);

View File

@ -13,6 +13,7 @@ import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.fml.loading.FMLEnvironment; import net.minecraftforge.fml.loading.FMLEnvironment;
import ru.dbotthepony.mc.otm.OverdriveThatMatters;
import ru.dbotthepony.mc.otm.capability.IMatteryEnergyStorage; import ru.dbotthepony.mc.otm.capability.IMatteryEnergyStorage;
import ru.dbotthepony.mc.otm.capability.MatteryCapability; import ru.dbotthepony.mc.otm.capability.MatteryCapability;
import ru.dbotthepony.mc.otm.menu.FormattingHelper; import ru.dbotthepony.mc.otm.menu.FormattingHelper;
@ -176,7 +177,7 @@ public class ItemBattery extends Item {
private static final Component INFINITE_STORAGE = new TranslatableComponent("otm.item.power.infinite.storage").withStyle(ChatFormatting.GRAY); private static final Component INFINITE_STORAGE = new TranslatableComponent("otm.item.power.infinite.storage").withStyle(ChatFormatting.GRAY);
public ItemBattery(BigDecimal storage, BigDecimal receive, BigDecimal extract) { public ItemBattery(BigDecimal storage, BigDecimal receive, BigDecimal extract) {
super(new Properties().stacksTo(1).tab(CreativeModeTab.TAB_MISC)); super(new Properties().stacksTo(1).tab(OverdriveThatMatters.CREATIVE_TAB));
is_creative = false; is_creative = false;
this.storage = storage; this.storage = storage;
this.receive = receive; this.receive = receive;
@ -185,7 +186,7 @@ public class ItemBattery extends Item {
} }
public ItemBattery() { public ItemBattery() {
super(new Properties().stacksTo(1).rarity(Rarity.EPIC).tab(CreativeModeTab.TAB_MISC)); super(new Properties().stacksTo(1).rarity(Rarity.EPIC).tab(OverdriveThatMatters.CREATIVE_TAB));
is_creative = true; is_creative = true;
this.storage = MatteryCapability.LONG_MAX_VALUE; this.storage = MatteryCapability.LONG_MAX_VALUE;
this.receive = MatteryCapability.LONG_MAX_VALUE; this.receive = MatteryCapability.LONG_MAX_VALUE;

View File

@ -10,6 +10,7 @@ import net.minecraft.world.level.Level;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import ru.dbotthepony.mc.otm.OverdriveThatMatters;
import ru.dbotthepony.mc.otm.capability.IMatterHandler; import ru.dbotthepony.mc.otm.capability.IMatterHandler;
import ru.dbotthepony.mc.otm.capability.MatteryCapability; import ru.dbotthepony.mc.otm.capability.MatteryCapability;
import ru.dbotthepony.mc.otm.menu.FormattingHelper; import ru.dbotthepony.mc.otm.menu.FormattingHelper;
@ -175,13 +176,13 @@ public class ItemMatterCapacitor extends Item {
private final boolean is_creative; private final boolean is_creative;
public ItemMatterCapacitor(BigDecimal storage) { public ItemMatterCapacitor(BigDecimal storage) {
super(new Properties().stacksTo(1).tab(CreativeModeTab.TAB_MISC)); super(new Properties().stacksTo(1).tab(OverdriveThatMatters.CREATIVE_TAB));
is_creative = false; is_creative = false;
this.storage = storage; this.storage = storage;
} }
public ItemMatterCapacitor() { public ItemMatterCapacitor() {
super(new Properties().stacksTo(1).tab(CreativeModeTab.TAB_MISC).rarity(Rarity.EPIC)); super(new Properties().stacksTo(1).tab(OverdriveThatMatters.CREATIVE_TAB).rarity(Rarity.EPIC));
is_creative = true; is_creative = true;
storage = MatteryCapability.LONG_MAX_VALUE; storage = MatteryCapability.LONG_MAX_VALUE;
} }

View File

@ -16,6 +16,7 @@ import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.registries.RegistryManager; import net.minecraftforge.registries.RegistryManager;
import ru.dbotthepony.mc.otm.OverdriveThatMatters;
import ru.dbotthepony.mc.otm.capability.IPatternStorage; import ru.dbotthepony.mc.otm.capability.IPatternStorage;
import ru.dbotthepony.mc.otm.capability.MatteryCapability; import ru.dbotthepony.mc.otm.capability.MatteryCapability;
import ru.dbotthepony.mc.otm.capability.PatternInsertStatus; import ru.dbotthepony.mc.otm.capability.PatternInsertStatus;
@ -29,7 +30,7 @@ public class ItemPatternStorage extends Item {
public final int capacity; public final int capacity;
public ItemPatternStorage(int capacity) { public ItemPatternStorage(int capacity) {
super(new Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(1)); super(new Properties().tab(OverdriveThatMatters.CREATIVE_TAB).stacksTo(1));
this.capacity = capacity; this.capacity = capacity;
} }

View File

@ -13,6 +13,7 @@ import net.minecraft.world.item.*;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.FakePlayer;
import org.apache.logging.log4j.core.jmx.Server; import org.apache.logging.log4j.core.jmx.Server;
import ru.dbotthepony.mc.otm.OverdriveThatMatters;
import ru.dbotthepony.mc.otm.capability.AndroidCapabilityPlayer; import ru.dbotthepony.mc.otm.capability.AndroidCapabilityPlayer;
import ru.dbotthepony.mc.otm.capability.IAndroidCapability; import ru.dbotthepony.mc.otm.capability.IAndroidCapability;
import ru.dbotthepony.mc.otm.capability.MatteryCapability; import ru.dbotthepony.mc.otm.capability.MatteryCapability;
@ -30,7 +31,7 @@ public class ItemPill extends Item {
public final PillType pill_type; public final PillType pill_type;
public ItemPill(PillType type) { public ItemPill(PillType type) {
super(new Properties().stacksTo(64).rarity(Rarity.UNCOMMON).tab(CreativeModeTab.TAB_MISC)); super(new Properties().stacksTo(64).rarity(Rarity.UNCOMMON).tab(OverdriveThatMatters.CREATIVE_TAB));
this.pill_type = type; this.pill_type = type;
} }

View File

@ -1,4 +1,6 @@
{ {
"itemGroup.otm": "Overdrive That Matters",
"otm.pill.warning": "WARNING: This will INSTANTLY kill you upon ingestion!", "otm.pill.warning": "WARNING: This will INSTANTLY kill you upon ingestion!",
"otm.pill.android": "Take this pill and lose what is holding you back.", "otm.pill.android": "Take this pill and lose what is holding you back.",
"otm.pill.humane": "Take this pill and wake up in bed none the wiser.", "otm.pill.humane": "Take this pill and wake up in bed none the wiser.",