Skip to content

Commit

Permalink
Add tags to more of the creative mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
rtm516 committed Apr 6, 2024
1 parent 9b3916a commit 2205149
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ private void onDefineCustomBlocks(PackEventContext<GeyserDefineCustomBlocksEvent
CustomBlockData.Builder builder = NonVanillaCustomBlockData.builder()
.name(blockLocation.getPath())
.namespace(blockLocation.getNamespace())
.includedInCreativeInventory(true)
.creativeCategory(CreativeCategory.ITEMS);
.includedInCreativeInventory(true);

CreativeMappings.setupBlock(block, builder);

Expand Down Expand Up @@ -518,7 +517,7 @@ private boolean isUnitCube(Key parent) {
if (parent == null) {
return false;
}
return parent.namespace().equals("minecraft") && parent.value().startsWith("block/cube");
return parent.namespace().equals("minecraft") && (parent.value().startsWith("block/cube") || parent.value().startsWith("block/orientable"));
}

/**
Expand Down
104 changes: 63 additions & 41 deletions shared/src/main/java/org/geysermc/hydraulic/item/CreativeMappings.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.geysermc.hydraulic.item;

import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
Expand All @@ -24,51 +25,58 @@ public class CreativeMappings {
// region --- Construction ---
put(new CreativeMappingTarget(
List.of(),
List.of(),
List.of(SlabBlock.class),
List.of()
), new CreativeMapping(ItemGroup.SLABS, CreativeCategory.CONSTRUCTION));

put(new CreativeMappingTarget(
List.of(),
List.of(),
List.of(FenceGateBlock.class),
List.of()
), new CreativeMapping(ItemGroup.FENCE_GATES, CreativeCategory.CONSTRUCTION));
List.of(ItemTags.DOORS),
List.of(DoorBlock.class),
List.of(BlockTags.DOORS)
), new CreativeMapping(ItemGroup.DOORS, CreativeCategory.CONSTRUCTION));

put(new CreativeMappingTarget(
List.of(),
List.of(),
List.of(ItemTags.FENCES),
List.of(FenceBlock.class),
List.of()
List.of(BlockTags.FENCES)
), new CreativeMapping(ItemGroup.FENCES, CreativeCategory.CONSTRUCTION));

put(new CreativeMappingTarget(
List.of(),
List.of(),
List.of(DoorBlock.class),
List.of()
), new CreativeMapping(ItemGroup.DOORS, CreativeCategory.CONSTRUCTION));
List.of(ItemTags.FENCE_GATES),
List.of(FenceGateBlock.class),
List.of(BlockTags.FENCE_GATES)
), new CreativeMapping(ItemGroup.FENCE_GATES, CreativeCategory.CONSTRUCTION));

put(new CreativeMappingTarget(
List.of(),
List.of(ItemTags.PLANKS),
List.of(),
List.of(TrapDoorBlock.class),
List.of()
), new CreativeMapping(ItemGroup.TRAPDOORS, CreativeCategory.CONSTRUCTION));
List.of(BlockTags.PLANKS)
), new CreativeMapping(ItemGroup.PLANKS, CreativeCategory.CONSTRUCTION));

put(new CreativeMappingTarget(
List.of(),
List.of(ItemTags.SLABS),
List.of(SlabBlock.class),
List.of(BlockTags.SLABS)
), new CreativeMapping(ItemGroup.SLABS, CreativeCategory.CONSTRUCTION));

put(new CreativeMappingTarget(
List.of(),
List.of(ItemTags.STAIRS),
List.of(StairBlock.class),
List.of()
List.of(BlockTags.STAIRS)
), new CreativeMapping(ItemGroup.STAIRS, CreativeCategory.CONSTRUCTION));

put(new CreativeMappingTarget(
List.of(),
List.of(ItemTags.TRAPDOORS),
List.of(TrapDoorBlock.class),
List.of(BlockTags.TRAPDOORS)
), new CreativeMapping(ItemGroup.TRAPDOORS, CreativeCategory.CONSTRUCTION));

put(new CreativeMappingTarget(
List.of(),
List.of(ItemTags.WALLS),
List.of(WallBlock.class),
List.of()
List.of(BlockTags.WALLS)
), new CreativeMapping(ItemGroup.WALLS, CreativeCategory.CONSTRUCTION));
// endregion

Expand All @@ -82,18 +90,25 @@ public class CreativeMappings {

put(new CreativeMappingTarget(
List.of(),
List.of(),
List.of(ItemTags.FLOWERS, ItemTags.SMALL_FLOWERS, ItemTags.TALL_FLOWERS),
List.of(FlowerBlock.class, PinkPetalsBlock.class, TallFlowerBlock.class),
List.of()
List.of(BlockTags.FLOWERS, BlockTags.SMALL_FLOWERS, BlockTags.TALL_FLOWERS)
), new CreativeMapping(ItemGroup.FLOWERS, CreativeCategory.NATURE));

put(new CreativeMappingTarget(
List.of(),
List.of(),
List.of(ItemTags.LEAVES),
List.of(LeavesBlock.class),
List.of()
List.of(BlockTags.LEAVES)
), new CreativeMapping(ItemGroup.LEAVES, CreativeCategory.NATURE));

put(new CreativeMappingTarget(
List.of(),
List.of(ItemTags.LOGS),
List.of(),
List.of(BlockTags.LOGS)
), new CreativeMapping(ItemGroup.LOGS, CreativeCategory.NATURE));

// TODO Remove, these are added differently to bedrock https://wiki.bedrock.dev/visuals/retexturing-spawn-eggs.html
put(new CreativeMappingTarget(
List.of(SpawnEggItem.class),
Expand All @@ -111,30 +126,30 @@ public class CreativeMappings {

put(new CreativeMappingTarget(
List.of(),
List.of(),
List.of(ItemTags.SAPLINGS),
List.of(SaplingBlock.class),
List.of()
List.of(BlockTags.SAPLINGS)
), new CreativeMapping(ItemGroup.SAPLINGS, CreativeCategory.NATURE));
// endregion

// region --- Equipment ---
put(new CreativeMappingTarget(
List.of(ArrowItem.class),
List.of(),
List.of(ItemTags.ARROWS),
List.of(),
List.of()
), new CreativeMapping(ItemGroup.ARROWS, CreativeCategory.EQUIPMENT));

put(new CreativeMappingTarget(
List.of(AxeItem.class),
List.of(),
List.of(ItemTags.AXES),
List.of(),
List.of()
), new CreativeMapping(ItemGroup.AXES, CreativeCategory.EQUIPMENT));

put(new CreativeMappingTarget(
List.of(HoeItem.class),
List.of(),
List.of(ItemTags.HOES),
List.of(),
List.of()
), new CreativeMapping(ItemGroup.HOES, CreativeCategory.EQUIPMENT));
Expand All @@ -148,21 +163,21 @@ public class CreativeMappings {

put(new CreativeMappingTarget(
List.of(PickaxeItem.class),
List.of(),
List.of(ItemTags.PICKAXES),
List.of(),
List.of()
), new CreativeMapping(ItemGroup.PICKAXES, CreativeCategory.EQUIPMENT));

put(new CreativeMappingTarget(
List.of(ShovelItem.class),
List.of(),
List.of(ItemTags.SHOVELS),
List.of(),
List.of()
), new CreativeMapping(ItemGroup.SHOVELS, CreativeCategory.EQUIPMENT));

put(new CreativeMappingTarget(
List.of(SwordItem.class),
List.of(),
List.of(ItemTags.SWORDS),
List.of(),
List.of()
), new CreativeMapping(ItemGroup.SWORDS, CreativeCategory.EQUIPMENT));
Expand All @@ -171,9 +186,9 @@ public class CreativeMappings {
// region --- Items ---
put(new CreativeMappingTarget(
List.of(),
List.of(),
List.of(ItemTags.ANVIL),
List.of(AnvilBlock.class),
List.of()
List.of(BlockTags.ANVIL)
), new CreativeMapping(ItemGroup.ANVILS, CreativeCategory.ITEMS));

put(new CreativeMappingTarget(
Expand All @@ -199,9 +214,9 @@ public class CreativeMappings {

put(new CreativeMappingTarget(
List.of(),
List.of(),
List.of(ItemTags.BUTTONS),
List.of(ButtonBlock.class),
List.of()
List.of(BlockTags.BUTTONS)
), new CreativeMapping(ItemGroup.BUTTONS, CreativeCategory.ITEMS));

put(new CreativeMappingTarget(
Expand All @@ -222,12 +237,12 @@ public class CreativeMappings {
List.of(),
List.of(),
List.of(PressurePlateBlock.class),
List.of()
List.of(BlockTags.PRESSURE_PLATES)
), new CreativeMapping(ItemGroup.PRESSURE_PLATES, CreativeCategory.ITEMS));

put(new CreativeMappingTarget(
List.of(RecordItem.class),
List.of(),
List.of(ItemTags.MUSIC_DISCS),
List.of(),
List.of()
), new CreativeMapping(ItemGroup.RECORDS, CreativeCategory.ITEMS));
Expand All @@ -241,7 +256,7 @@ public class CreativeMappings {

put(new CreativeMappingTarget(
List.of(SmithingTemplateItem.class),
List.of(),
List.of(ItemTags.TRIM_TEMPLATES),
List.of(),
List.of()
), new CreativeMapping(ItemGroup.SMITHING_TEMPLATES, CreativeCategory.ITEMS));
Expand All @@ -261,6 +276,13 @@ public class CreativeMappings {
List.of(),
List.of()
), new CreativeMapping(CreativeCategory.EQUIPMENT));

put(new CreativeMappingTarget(
List.of(Item.class),
List.of(),
List.of(Block.class),
List.of()
), new CreativeMapping(CreativeCategory.ITEMS));
// endregion
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ private void onDefineCustomItems(PackEventContext<GeyserDefineCustomItemsEvent,
.stackSize(item.getMaxStackSize())
.maxDamage(item.getMaxDamage())
.allowOffhand(true)
.creativeCategory(CreativeCategory.ITEMS.id())
.maxDamage(item.getMaxDamage())
.stackSize(item.getMaxStackSize());

Expand Down

0 comments on commit 2205149

Please sign in to comment.