Skip to content

Commit

Permalink
🎨 change creative tab format in preparation for porting
Browse files Browse the repository at this point in the history
Signed-off-by: LocusAzzurro <[email protected]>
  • Loading branch information
LocusAzzurro committed Jul 30, 2023
1 parent 7834c8b commit 3a03899
Show file tree
Hide file tree
Showing 5 changed files with 492 additions and 438 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;

public class CreativeTabs {
public class CreativeTabDefinitions {

public static final CreativeModeTab MATERIALS = new CreativeModeTab(Ultramarine.MOD_ID + ".materials") {
@Override public ItemStack makeIcon() {
Expand Down
44 changes: 44 additions & 0 deletions src/main/java/com/voxelutopia/ultramarine/data/ModCreativeTab.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.voxelutopia.ultramarine.data;

import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraftforge.registries.RegistryObject;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public enum ModCreativeTab {
MATERIALS(CreativeTabDefinitions.MATERIALS),
TOOLS(CreativeTabDefinitions.TOOLS),
BUILDING_BLOCKS(CreativeTabDefinitions.BUILDING_BLOCKS),
DECORATIVE_BLOCKS(CreativeTabDefinitions.DECORATIVE_BLOCKS),
DECORATIONS(CreativeTabDefinitions.DECORATIONS),
FURNITURE(CreativeTabDefinitions.FURNITURE),
WINDOWS_AND_DOORS(CreativeTabDefinitions.WINDOWS_AND_DOORS),
LAMPS(CreativeTabDefinitions.LAMPS);

final CreativeModeTab tab;

static final Map<ModCreativeTab, Set<RegistryObject<Item>>> itemSets = Map.of(
MATERIALS, new HashSet<>(),
TOOLS, new HashSet<>(),
BUILDING_BLOCKS, new HashSet<>(),
DECORATIVE_BLOCKS, new HashSet<>(),
DECORATIONS, new HashSet<>(),
FURNITURE, new HashSet<>(),
WINDOWS_AND_DOORS, new HashSet<>(),
LAMPS, new HashSet<>()
);
ModCreativeTab(CreativeModeTab tab){
this.tab = tab;
}

public CreativeModeTab getTab() {
return tab;
}

public static void putItemInSet(RegistryObject<Item> item, ModCreativeTab tab){
itemSets.get(tab).add(item);
}
}
Loading

0 comments on commit 3a03899

Please sign in to comment.