feat: complete inventory
This commit is contained in:
parent
e8dc8b2201
commit
4df2505315
|
@ -1,18 +1,33 @@
|
||||||
package me.theclashfruit.cc.mixin;
|
package me.theclashfruit.cc.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.enchantment.Enchantment;
|
||||||
|
import net.minecraft.enchantment.EnchantmentTarget;
|
||||||
import net.minecraft.item.Instrument;
|
import net.minecraft.item.Instrument;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemGroup;
|
import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.item.ItemGroups;
|
import net.minecraft.item.ItemGroups;
|
||||||
|
import net.minecraft.potion.Potion;
|
||||||
import net.minecraft.registry.RegistryWrapper;
|
import net.minecraft.registry.RegistryWrapper;
|
||||||
import net.minecraft.registry.tag.TagKey;
|
import net.minecraft.registry.tag.TagKey;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Mixin(ItemGroups.class)
|
@Mixin(ItemGroups.class)
|
||||||
public interface ItemGroupsInterfaceMixin {
|
public interface ItemGroupsInterfaceMixin {
|
||||||
@Invoker("addInstruments")
|
@Invoker("addInstruments")
|
||||||
static void invokeAddInstruments(ItemGroup.Entries entries, RegistryWrapper<Instrument> registryWrapper, Item item, TagKey<Instrument> instrumentTag, ItemGroup.StackVisibility visibility) {
|
static void invokeAddInstruments(ItemGroup.Entries entries, RegistryWrapper<Instrument> registryWrapper, Item item, TagKey<Instrument> instrumentTag, ItemGroup.StackVisibility visibility) {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Invoker("addPotions")
|
||||||
|
static void invokeAddPotions(ItemGroup.Entries entries, RegistryWrapper<Potion> registryWrapper, Item item, ItemGroup.StackVisibility visibility) {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Invoker("addMaxLevelEnchantedBooks")
|
||||||
|
static void invokeAddMaxLevelEnchantedBooks(ItemGroup.Entries entries, RegistryWrapper<Enchantment> registryWrapper, Set<EnchantmentTarget> enchantmentTargets, ItemGroup.StackVisibility visibility) {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
package me.theclashfruit.cc.mixin;
|
package me.theclashfruit.cc.mixin;
|
||||||
|
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.enchantment.EnchantmentLevelEntry;
|
||||||
|
import net.minecraft.enchantment.EnchantmentTarget;
|
||||||
|
import net.minecraft.enchantment.Enchantments;
|
||||||
import net.minecraft.item.*;
|
import net.minecraft.item.*;
|
||||||
|
import net.minecraft.potion.Potion;
|
||||||
|
import net.minecraft.potion.PotionUtil;
|
||||||
|
import net.minecraft.potion.Potions;
|
||||||
import net.minecraft.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.registry.RegistryKey;
|
import net.minecraft.registry.RegistryKey;
|
||||||
import net.minecraft.registry.RegistryKeys;
|
import net.minecraft.registry.RegistryKeys;
|
||||||
|
@ -13,6 +19,7 @@ import net.minecraft.village.raid.Raid;
|
||||||
import org.spongepowered.asm.mixin.*;
|
import org.spongepowered.asm.mixin.*;
|
||||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static net.minecraft.item.ItemGroups.*;
|
import static net.minecraft.item.ItemGroups.*;
|
||||||
|
@ -1323,6 +1330,43 @@ public class ItemGroupsMixin {
|
||||||
.icon(() -> new ItemStack(Items.APPLE))
|
.icon(() -> new ItemStack(Items.APPLE))
|
||||||
.entries((displayContext, content) -> {
|
.entries((displayContext, content) -> {
|
||||||
content.add(Items.APPLE);
|
content.add(Items.APPLE);
|
||||||
|
content.add(Items.MUSHROOM_STEW);
|
||||||
|
content.add(Items.BREAD);
|
||||||
|
content.add(Items.PORKCHOP);
|
||||||
|
content.add(Items.COOKED_PORKCHOP);
|
||||||
|
content.add(Items.GOLDEN_APPLE);
|
||||||
|
content.add(Items.ENCHANTED_GOLDEN_APPLE);
|
||||||
|
content.add(Items.COD);
|
||||||
|
content.add(Items.SALMON);
|
||||||
|
content.add(Items.TROPICAL_FISH);
|
||||||
|
content.add(Items.PUFFERFISH);
|
||||||
|
content.add(Items.COOKED_COD);
|
||||||
|
content.add(Items.COOKED_SALMON);
|
||||||
|
content.add(Items.CAKE);
|
||||||
|
content.add(Items.COOKIE);
|
||||||
|
content.add(Items.MELON_SLICE);
|
||||||
|
content.add(Items.DRIED_KELP);
|
||||||
|
content.add(Items.BEEF);
|
||||||
|
content.add(Items.COOKED_BEEF);
|
||||||
|
content.add(Items.CHICKEN);
|
||||||
|
content.add(Items.COOKED_CHICKEN);
|
||||||
|
content.add(Items.ROTTEN_FLESH);
|
||||||
|
content.add(Items.SPIDER_EYE);
|
||||||
|
content.add(Items.CARROT);
|
||||||
|
content.add(Items.POTATO);
|
||||||
|
content.add(Items.BAKED_POTATO);
|
||||||
|
content.add(Items.POISONOUS_POTATO);
|
||||||
|
content.add(Items.PUMPKIN_PIE);
|
||||||
|
content.add(Items.RABBIT);
|
||||||
|
content.add(Items.COOKED_RABBIT);
|
||||||
|
content.add(Items.RABBIT_STEW);
|
||||||
|
content.add(Items.MUTTON);
|
||||||
|
content.add(Items.COOKED_MUTTON);
|
||||||
|
content.add(Items.BEETROOT);
|
||||||
|
content.add(Items.BEETROOT_SOUP);
|
||||||
|
content.add(Items.SWEET_BERRIES);
|
||||||
|
content.add(Items.GLOW_BERRIES);
|
||||||
|
content.add(Items.HONEY_BOTTLE);
|
||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
@ -1335,7 +1379,59 @@ public class ItemGroupsMixin {
|
||||||
.displayName(Text.translatable("itemGroup.tools"))
|
.displayName(Text.translatable("itemGroup.tools"))
|
||||||
.icon(() -> new ItemStack(Items.IRON_AXE))
|
.icon(() -> new ItemStack(Items.IRON_AXE))
|
||||||
.entries((displayContext, content) -> {
|
.entries((displayContext, content) -> {
|
||||||
|
content.add(Items.FLINT_AND_STEEL);
|
||||||
|
|
||||||
|
content.add(Items.WOODEN_SHOVEL);
|
||||||
|
content.add(Items.WOODEN_PICKAXE);
|
||||||
|
content.add(Items.WOODEN_AXE);
|
||||||
|
content.add(Items.WOODEN_HOE);
|
||||||
|
|
||||||
|
content.add(Items.STONE_SHOVEL);
|
||||||
|
content.add(Items.STONE_PICKAXE);
|
||||||
|
content.add(Items.STONE_AXE);
|
||||||
|
content.add(Items.STONE_HOE);
|
||||||
|
|
||||||
|
content.add(Items.GOLDEN_SHOVEL);
|
||||||
|
content.add(Items.GOLDEN_PICKAXE);
|
||||||
|
content.add(Items.GOLDEN_AXE);
|
||||||
|
content.add(Items.GOLDEN_HOE);
|
||||||
|
|
||||||
|
content.add(Items.IRON_SHOVEL);
|
||||||
|
content.add(Items.IRON_PICKAXE);
|
||||||
content.add(Items.IRON_AXE);
|
content.add(Items.IRON_AXE);
|
||||||
|
content.add(Items.IRON_HOE);
|
||||||
|
|
||||||
|
content.add(Items.DIAMOND_SHOVEL);
|
||||||
|
content.add(Items.DIAMOND_PICKAXE);
|
||||||
|
content.add(Items.DIAMOND_AXE);
|
||||||
|
content.add(Items.DIAMOND_HOE);
|
||||||
|
|
||||||
|
content.add(Items.NETHERITE_SHOVEL);
|
||||||
|
content.add(Items.NETHERITE_PICKAXE);
|
||||||
|
content.add(Items.NETHERITE_AXE);
|
||||||
|
content.add(Items.NETHERITE_HOE);
|
||||||
|
|
||||||
|
content.add(Items.COMPASS);
|
||||||
|
content.add(Items.RECOVERY_COMPASS);
|
||||||
|
|
||||||
|
content.add(Items.FISHING_ROD);
|
||||||
|
|
||||||
|
content.add(Items.CLOCK);
|
||||||
|
|
||||||
|
content.add(Items.SPYGLASS);
|
||||||
|
content.add(Items.SHEARS);
|
||||||
|
|
||||||
|
content.add(EnchantedBookItem.forEnchantment(new EnchantmentLevelEntry(Enchantments.EFFICIENCY, 5)));
|
||||||
|
content.add(EnchantedBookItem.forEnchantment(new EnchantmentLevelEntry(Enchantments.SILK_TOUCH, 1)));
|
||||||
|
content.add(EnchantedBookItem.forEnchantment(new EnchantmentLevelEntry(Enchantments.UNBREAKING, 3)));
|
||||||
|
content.add(EnchantedBookItem.forEnchantment(new EnchantmentLevelEntry(Enchantments.FORTUNE, 3)));
|
||||||
|
content.add(EnchantedBookItem.forEnchantment(new EnchantmentLevelEntry(Enchantments.LUCK_OF_THE_SEA, 3)));
|
||||||
|
content.add(EnchantedBookItem.forEnchantment(new EnchantmentLevelEntry(Enchantments.LURE, 3)));
|
||||||
|
content.add(EnchantedBookItem.forEnchantment(new EnchantmentLevelEntry(Enchantments.MENDING, 1)));
|
||||||
|
content.add(EnchantedBookItem.forEnchantment(new EnchantmentLevelEntry(Enchantments.VANISHING_CURSE, 1)));
|
||||||
|
|
||||||
|
content.add(Items.LEAD);
|
||||||
|
content.add(Items.NAME_TAG);
|
||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
@ -1348,7 +1444,60 @@ public class ItemGroupsMixin {
|
||||||
.displayName(Text.translatable("itemGroup.combat"))
|
.displayName(Text.translatable("itemGroup.combat"))
|
||||||
.icon(() -> new ItemStack(Items.GOLDEN_SWORD))
|
.icon(() -> new ItemStack(Items.GOLDEN_SWORD))
|
||||||
.entries((displayContext, content) -> {
|
.entries((displayContext, content) -> {
|
||||||
|
content.add(Items.TURTLE_HELMET);
|
||||||
|
content.add(Items.BOW);
|
||||||
|
content.add(Items.ARROW);
|
||||||
|
|
||||||
|
content.add(Items.WOODEN_SWORD);
|
||||||
|
content.add(Items.STONE_SWORD);
|
||||||
content.add(Items.GOLDEN_SWORD);
|
content.add(Items.GOLDEN_SWORD);
|
||||||
|
content.add(Items.IRON_SWORD);
|
||||||
|
content.add(Items.DIAMOND_SWORD);
|
||||||
|
content.add(Items.NETHERITE_SWORD);
|
||||||
|
|
||||||
|
content.add(Items.LEATHER_HELMET);
|
||||||
|
content.add(Items.LEATHER_CHESTPLATE);
|
||||||
|
content.add(Items.LEATHER_LEGGINGS);
|
||||||
|
content.add(Items.LEATHER_BOOTS);
|
||||||
|
|
||||||
|
content.add(Items.CHAINMAIL_HELMET);
|
||||||
|
content.add(Items.CHAINMAIL_CHESTPLATE);
|
||||||
|
content.add(Items.CHAINMAIL_LEGGINGS);
|
||||||
|
content.add(Items.CHAINMAIL_BOOTS);
|
||||||
|
|
||||||
|
content.add(Items.IRON_HELMET);
|
||||||
|
content.add(Items.IRON_CHESTPLATE);
|
||||||
|
content.add(Items.IRON_LEGGINGS);
|
||||||
|
content.add(Items.IRON_BOOTS);
|
||||||
|
|
||||||
|
content.add(Items.DIAMOND_HELMET);
|
||||||
|
content.add(Items.DIAMOND_CHESTPLATE);
|
||||||
|
content.add(Items.DIAMOND_LEGGINGS);
|
||||||
|
content.add(Items.DIAMOND_BOOTS);
|
||||||
|
|
||||||
|
content.add(Items.GOLDEN_HELMET);
|
||||||
|
content.add(Items.GOLDEN_CHESTPLATE);
|
||||||
|
content.add(Items.GOLDEN_LEGGINGS);
|
||||||
|
content.add(Items.GOLDEN_BOOTS);
|
||||||
|
|
||||||
|
content.add(Items.NETHERITE_HELMET);
|
||||||
|
content.add(Items.NETHERITE_CHESTPLATE);
|
||||||
|
content.add(Items.NETHERITE_LEGGINGS);
|
||||||
|
content.add(Items.NETHERITE_BOOTS);
|
||||||
|
|
||||||
|
EnumSet<EnchantmentTarget> set = EnumSet.allOf(EnchantmentTarget.class);
|
||||||
|
|
||||||
|
displayContext.lookup().getOptionalWrapper(RegistryKeys.ENCHANTMENT).ifPresent(wrapper -> {
|
||||||
|
ItemGroupsInterfaceMixin.invokeAddMaxLevelEnchantedBooks(content, wrapper, set, ItemGroup.StackVisibility.PARENT_TAB_ONLY);
|
||||||
|
});
|
||||||
|
|
||||||
|
content.add(Items.SPECTRAL_ARROW);
|
||||||
|
displayContext.lookup().getOptionalWrapper(RegistryKeys.POTION).ifPresent(wrapper -> ItemGroupsInterfaceMixin.invokeAddPotions(content, wrapper, Items.TIPPED_ARROW, ItemGroup.StackVisibility.PARENT_AND_SEARCH_TABS));
|
||||||
|
|
||||||
|
content.add(Items.SHIELD);
|
||||||
|
content.add(Items.TOTEM_OF_UNDYING);
|
||||||
|
content.add(Items.TRIDENT);
|
||||||
|
content.add(Items.CROSSBOW);
|
||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
@ -1359,9 +1508,31 @@ public class ItemGroupsMixin {
|
||||||
ItemGroup
|
ItemGroup
|
||||||
.create(ItemGroup.Row.BOTTOM, 4)
|
.create(ItemGroup.Row.BOTTOM, 4)
|
||||||
.displayName(Text.translatable("itemGroup.brewing"))
|
.displayName(Text.translatable("itemGroup.brewing"))
|
||||||
.icon(() -> new ItemStack(Items.POTION))
|
.icon(() -> new ItemStack(PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.WATER).getItem()))
|
||||||
.entries((displayContext, content) -> {
|
.entries((displayContext, content) -> {
|
||||||
content.add(Items.POTION);
|
content.add(Items.GHAST_TEAR);
|
||||||
|
|
||||||
|
displayContext.lookup().getOptionalWrapper(RegistryKeys.POTION).ifPresent(wrapper -> {
|
||||||
|
ItemGroupsInterfaceMixin.invokeAddPotions(content, wrapper, Items.POTION, ItemGroup.StackVisibility.PARENT_AND_SEARCH_TABS);
|
||||||
|
});
|
||||||
|
|
||||||
|
content.add(Items.GLASS_BOTTLE);
|
||||||
|
content.add(Items.FERMENTED_SPIDER_EYE);
|
||||||
|
content.add(Items.BLAZE_POWDER);
|
||||||
|
content.add(Items.MAGMA_CREAM);
|
||||||
|
content.add(Items.BREWING_STAND);
|
||||||
|
content.add(Items.CAULDRON);
|
||||||
|
content.add(Items.GLISTERING_MELON_SLICE);
|
||||||
|
content.add(Items.GOLDEN_CARROT);
|
||||||
|
content.add(Items.RABBIT_FOOT);
|
||||||
|
content.add(Items.DRAGON_BREATH);
|
||||||
|
|
||||||
|
displayContext.lookup().getOptionalWrapper(RegistryKeys.POTION).ifPresent(wrapper -> {
|
||||||
|
ItemGroupsInterfaceMixin.invokeAddPotions(content, wrapper, Items.SPLASH_POTION, ItemGroup.StackVisibility.PARENT_AND_SEARCH_TABS);
|
||||||
|
ItemGroupsInterfaceMixin.invokeAddPotions(content, wrapper, Items.LINGERING_POTION, ItemGroup.StackVisibility.PARENT_AND_SEARCH_TABS);
|
||||||
|
});
|
||||||
|
|
||||||
|
content.add(Items.PHANTOM_MEMBRANE);
|
||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue