[Change] Use new CreativeTab API
This commit is contained in:
parent
66ed66c04a
commit
7468307b2c
3 changed files with 34 additions and 108 deletions
|
@ -1,115 +1,30 @@
|
||||||
package org.betterx.betterend.tab;
|
package org.betterx.betterend.tab;
|
||||||
|
|
||||||
import org.betterx.bclib.behaviours.interfaces.*;
|
import org.betterx.bclib.creativetab.BCLCreativeTab;
|
||||||
|
import org.betterx.bclib.creativetab.BCLCreativeTabManager;
|
||||||
import org.betterx.betterend.BetterEnd;
|
import org.betterx.betterend.BetterEnd;
|
||||||
import org.betterx.betterend.registry.EndBlocks;
|
import org.betterx.betterend.registry.EndBlocks;
|
||||||
import org.betterx.betterend.registry.EndItems;
|
import org.betterx.betterend.registry.EndItems;
|
||||||
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
|
|
||||||
import org.betterx.worlds.together.tag.v3.CommonItemTags;
|
|
||||||
|
|
||||||
import net.minecraft.core.Registry;
|
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
|
||||||
import net.minecraft.core.registries.Registries;
|
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
import net.minecraft.resources.ResourceKey;
|
|
||||||
import net.minecraft.world.item.CreativeModeTab;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
import net.minecraft.world.item.Items;
|
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
|
|
||||||
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class CreativeTabs {
|
public class CreativeTabs {
|
||||||
public static final CreativeModeTab TAB_BLOCKS;
|
|
||||||
public static final CreativeModeTab TAB_ITEMS;
|
|
||||||
public static final CreativeModeTab TAB_PLANTS;
|
|
||||||
|
|
||||||
public static final ResourceKey<CreativeModeTab> TAB_ITEMS_KEY = ResourceKey.create(
|
|
||||||
Registries.CREATIVE_MODE_TAB,
|
|
||||||
BetterEnd.makeID("item_tab")
|
|
||||||
);
|
|
||||||
public static final ResourceKey<CreativeModeTab> TAB_BLOCKS_KEY = ResourceKey.create(
|
|
||||||
Registries.CREATIVE_MODE_TAB,
|
|
||||||
BetterEnd.makeID("block_tab")
|
|
||||||
);
|
|
||||||
public static final ResourceKey<CreativeModeTab> TAB_PLANTS_KEY = ResourceKey.create(
|
|
||||||
Registries.CREATIVE_MODE_TAB,
|
|
||||||
BetterEnd.makeID("plant_tab")
|
|
||||||
);
|
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
Registry.register(
|
BCLCreativeTabManager.create(BetterEnd.MOD_ID)
|
||||||
BuiltInRegistries.CREATIVE_MODE_TAB,
|
.createTab("nature")
|
||||||
TAB_ITEMS_KEY,
|
.setPredicate(item -> BCLCreativeTab.NATURE.contains(item)
|
||||||
TAB_ITEMS
|
// || item == NetherItems.AGAVE_LEAF
|
||||||
);
|
// || item == NetherItems.BLACK_APPLE
|
||||||
|
// || item == NetherBlocks.MAGMA_FLOWER.asItem()
|
||||||
Registry.register(
|
// || item == NetherBlocks.MAT_RUBEUS.getBlockItem(NetherSlots.CONE)
|
||||||
BuiltInRegistries.CREATIVE_MODE_TAB,
|
// || item == NetherBlocks.MAT_WILLOW.getBlockItem(WillowMaterial.BLOCK_TORCH)
|
||||||
TAB_BLOCKS_KEY,
|
)
|
||||||
TAB_BLOCKS
|
.setIcon(EndBlocks.FILALUX_LANTERN)
|
||||||
);
|
.build()
|
||||||
|
.createBlockTab(EndBlocks.END_MYCELIUM)
|
||||||
Registry.register(
|
.build()
|
||||||
BuiltInRegistries.CREATIVE_MODE_TAB,
|
.createItemsTab(EndItems.ETERNAL_CRYSTAL)
|
||||||
TAB_PLANTS_KEY,
|
.build()
|
||||||
TAB_PLANTS
|
.processBCLRegistry()
|
||||||
);
|
.register();
|
||||||
}
|
|
||||||
|
|
||||||
static {
|
|
||||||
TAB_BLOCKS = FabricItemGroup
|
|
||||||
.builder()
|
|
||||||
.icon(() -> new ItemStack(EndBlocks.END_MYCELIUM))
|
|
||||||
.title(Component.translatable("itemGroup.betterend.blocks"))
|
|
||||||
.displayItems((featureFlagSet, output) -> output.acceptAll(EndBlocks.getModBlockItems()
|
|
||||||
.stream()
|
|
||||||
.map(b -> new ItemStack(b, 1))
|
|
||||||
.collect(Collectors.toList())))
|
|
||||||
.build();
|
|
||||||
TAB_ITEMS = FabricItemGroup
|
|
||||||
.builder()
|
|
||||||
.title(Component.translatable("itemGroup.betterend.items"))
|
|
||||||
.icon(() -> new ItemStack(EndItems.ETERNAL_CRYSTAL))
|
|
||||||
.displayItems((featureFlagSet, output) -> output.acceptAll(EndItems.getModItems()
|
|
||||||
.stream()
|
|
||||||
.map(b -> new ItemStack(b, 1))
|
|
||||||
.collect(Collectors.toList())))
|
|
||||||
.build();
|
|
||||||
TAB_PLANTS = FabricItemGroup
|
|
||||||
.builder()
|
|
||||||
.title(Component.translatable("itemGroup.betterend.plants"))
|
|
||||||
.icon(() -> new ItemStack(EndBlocks.FILALUX_LANTERN))
|
|
||||||
.displayItems((featureFlagSet, output) -> {
|
|
||||||
output.acceptAll(EndItems.getModItems()
|
|
||||||
.stream()
|
|
||||||
.map(b -> new ItemStack(b, 1))
|
|
||||||
.filter(s -> s.is(CommonItemTags.COMPOSTABLE)
|
|
||||||
|| s.is(CommonItemTags.LEAVES)
|
|
||||||
|| s.is(CommonItemTags.SAPLINGS)
|
|
||||||
|| s.is(CommonItemTags.SEEDS))
|
|
||||||
.collect(Collectors.toList()));
|
|
||||||
|
|
||||||
output.acceptAll(EndBlocks.getModBlocks()
|
|
||||||
.stream()
|
|
||||||
.filter(b -> b.asItem() != null && b.asItem() != Items.AIR)
|
|
||||||
.filter(b -> b instanceof BehaviourVine
|
|
||||||
|| b instanceof BehaviourLeaves
|
|
||||||
|| b instanceof BehaviourPlant
|
|
||||||
|| b instanceof BehaviourWaterPlant
|
|
||||||
|| b instanceof BehaviourSeed
|
|
||||||
|| b instanceof BehaviourSapling
|
|
||||||
|| b instanceof BehaviourCompostable
|
|
||||||
|| b.defaultBlockState().is(CommonBlockTags.WATER_PLANT)
|
|
||||||
|| b.defaultBlockState().is(CommonBlockTags.PLANT)
|
|
||||||
|| b.defaultBlockState().is(CommonBlockTags.SEEDS)
|
|
||||||
|| b.defaultBlockState().is(CommonBlockTags.SAPLINGS)
|
|
||||||
|| b.defaultBlockState().is(CommonBlockTags.LEAVES))
|
|
||||||
.map(b -> new ItemStack(b, 1))
|
|
||||||
|
|
||||||
.collect(Collectors.toList()));
|
|
||||||
})
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -642,8 +642,9 @@
|
||||||
"item.minecraft.splash_potion.effect.long_end_veil": "Wurftrank des Endschleiers",
|
"item.minecraft.splash_potion.effect.long_end_veil": "Wurftrank des Endschleiers",
|
||||||
"item.minecraft.tipped_arrow.effect.end_veil": "Pfeil des Endschleiers",
|
"item.minecraft.tipped_arrow.effect.end_veil": "Pfeil des Endschleiers",
|
||||||
"item.minecraft.tipped_arrow.effect.long_end_veil": "Pfeil des Endschleiers",
|
"item.minecraft.tipped_arrow.effect.long_end_veil": "Pfeil des Endschleiers",
|
||||||
"itemGroup.betterend.end_blocks": "Better End: Blöcke",
|
"itemGroup.betterend.blocks": "Better End: Blöcke",
|
||||||
"itemGroup.betterend.end_items": "Better End: Items",
|
"itemGroup.betterend.items": "Better End: Gegenstände",
|
||||||
|
"itemGroup.betterend.plants": "Better End: Pflanzen",
|
||||||
"message.betterend.fail_spawn": "§c§lDu musst 6 Bernsteinjuwele in der Hand halten, um deinen Einstiegspunkt zu setzen.",
|
"message.betterend.fail_spawn": "§c§lDu musst 6 Bernsteinjuwele in der Hand halten, um deinen Einstiegspunkt zu setzen.",
|
||||||
"message.betterend.set_spawn": "§b§lWiedereinstiegspunkt gesetzt",
|
"message.betterend.set_spawn": "§b§lWiedereinstiegspunkt gesetzt",
|
||||||
"tag.betterend.alloying_copper": "Kupfererze",
|
"tag.betterend.alloying_copper": "Kupfererze",
|
||||||
|
@ -659,5 +660,15 @@
|
||||||
"tag.betterend.pythadendron_logs": "Pythadendronstämme",
|
"tag.betterend.pythadendron_logs": "Pythadendronstämme",
|
||||||
"tag.betterend.tenanea_logs": "Tenaneastämme",
|
"tag.betterend.tenanea_logs": "Tenaneastämme",
|
||||||
"tag.betterend.thallasium_alloying": "Thallasiumerze",
|
"tag.betterend.thallasium_alloying": "Thallasiumerze",
|
||||||
"tag.betterend.umbrella_tree_logs": "Schirmbaumstämme"
|
"tag.betterend.umbrella_tree_logs": "Schirmbaumstämme",
|
||||||
|
"item.betterend.debug.village_loot": "Einfache Schätze [dev]",
|
||||||
|
"item.betterend.debug.village_bonus": "Super Schätze [dev]",
|
||||||
|
"item.betterend.debug.village_template": "Schätze mit Schmiedevorlagen [dev]",
|
||||||
|
"item.betterend.debug.jigsaw_entrance": "Hauseingang [dev]",
|
||||||
|
"item.betterend.debug.jigsaw_street_entrance": "Platzhalter - Hauseingang [dev]",
|
||||||
|
"item.betterend.debug.jigsaw_street": "Straßenstück [dev]",
|
||||||
|
"item.betterend.debug.jigsaw_street_deco": "Platzhalter - kleine Deko [dev]",
|
||||||
|
"item.betterend.debug.jigsaw_street_big_deco": "Platzhalter - große Deko [dev]",
|
||||||
|
"item.betterend.debug.jigsaw_big_deco": "Große Deko [dev]",
|
||||||
|
"item.betterend.debug.jigsaw_deco": "Kleine Deko [dev]"
|
||||||
}
|
}
|
|
@ -873,7 +873,7 @@
|
||||||
"item.minecraft.tipped_arrow.effect.long_end_veil": "Arrow Of End Veil",
|
"item.minecraft.tipped_arrow.effect.long_end_veil": "Arrow Of End Veil",
|
||||||
"itemGroup.betterend.blocks": "BetterEnd: Blocks",
|
"itemGroup.betterend.blocks": "BetterEnd: Blocks",
|
||||||
"itemGroup.betterend.items": "BetterEnd: Items",
|
"itemGroup.betterend.items": "BetterEnd: Items",
|
||||||
"itemGroup.betterend.plants": "BetterEnd: Plants",
|
"itemGroup.betterend.nature": "BetterEnd: Plants",
|
||||||
"message.betterend.anvil_damage": "§cDamage",
|
"message.betterend.anvil_damage": "§cDamage",
|
||||||
"message.betterend.fail_spawn": "§c§lYou need to hold 6 Amber Gems to set your spawn point",
|
"message.betterend.fail_spawn": "§c§lYou need to hold 6 Amber Gems to set your spawn point",
|
||||||
"message.betterend.set_spawn": "§b§lYour spawn point is set here",
|
"message.betterend.set_spawn": "§b§lYour spawn point is set here",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue