feat: finish multi version except 1.20.5
Some checks failed
Build Project / build (pull_request) Failing after 4m33s

This commit is contained in:
TheClashFruit 2024-07-13 15:49:33 +02:00
parent 9f850881b3
commit a98760f350
Signed by: TheClashFruit
GPG key ID: 09BB24C34C2F3204
9 changed files with 188 additions and 77 deletions

View file

@ -1,4 +1,4 @@
import dev.deftu.gradle.utils.ModLoader
import dev.deftu.gradle.utils.*
import dev.deftu.gradle.tools.minecraft.CurseRelation
import dev.deftu.gradle.tools.minecraft.CurseRelationType
@ -32,6 +32,22 @@ loom {
accessWidenerPath = file("../../src/main/resources/cc.accesswidener")
}
java {
base.archivesName.set(modData.id)
tasks {
if (isLoomPresent()) {
named<org.gradle.jvm.tasks.Jar>("remapJar") {
archiveBaseName.set(modData.id)
}
} else {
named<Jar>("jar") {
archiveBaseName.set(modData.id)
}
}
}
}
/*
minecraft {
accessTransformer = file("../../src/main/resources/META-INF/accesstransformer.cfg")

12
changelogs/2.0.0-rc.1.md Normal file
View file

@ -0,0 +1,12 @@
The mod has been revived from the dead!
### New
* 1.21 Support
* !! Enchantment books are missing from the tools tab.
### Fixes
1. Added Missing Items
* Pottery Sherds
* Smithing Templates
2. Fixed The Brewing Tab Icon

View file

@ -1,6 +0,0 @@
The mod has been revived from the dead!
* Added Missing Items
* Pottery Sherds
* Smithing Templates
* Fixed The Brewing Tab Icon

View file

@ -3,5 +3,5 @@ org.gradle.jvmargs=-Xmx2G
mod.name=Cluttered Creative
mod.id=cc
mod.version=2.0.0
mod.version=2.0.0-rc.1
mod.group=me.theclashfruit

View file

@ -3,36 +3,21 @@ plugins {
}
preprocess {
//val neoforge_1_21 = createNode("1.21-neoforge", 1210, "srg")
//val fabric_1_21 = createNode("1.21-fabric", 1210, "yarn")
//val neoforge_1_20_5 = createNode("1.20.5-neoforge", 1205, "srg")
val fabric_1_21 = createNode("1.21-fabric", 1210, "yarn")
val fabric_1_20_6 = createNode("1.20.6-fabric", 1206, "yarn")
val fabric_1_20_5 = createNode("1.20.5-fabric", 1205, "yarn")
//val forge_1_20_3 = createNode("1.20.3-forge", 1203, "srg")
//val neoforge_1_20_3 = createNode("1.20.3-neoforge", 1203, "srg")
val fabric_1_20_4 = createNode("1.20.4-fabric", 1204, "yarn")
val fabric_1_20_3 = createNode("1.20.3-fabric", 1203, "yarn")
//val forge_1_20_2 = createNode("1.20.2-forge", 1202, "srg")
//val neoforge_1_20_2 = createNode("1.20.2-neoforge", 1202, "srg")
val fabric_1_20_2 = createNode("1.20.2-fabric", 1202, "yarn")
val fabric_1_20_1 = createNode("1.20.1-fabric", 1201, "yarn")
val fabric_1_20 = createNode("1.20-fabric", 1200, "yarn")
// val forge_1_20 = createNode("1.20-forge", 1200, "srg")
val fabric_1_20 = createNode("1.20-fabric", 1200, "yarn")
//fabric_1_21.link(neoforge_1_21)
//fabric_1_21.link(fabric_1_20_3)
//fabric_1_20_5.link(neoforge_1_20_5)
fabric_1_20_5.link(fabric_1_20_3)
//forge_1_20_3.link(fabric_1_20_3)
//neoforge_1_20_3.link(fabric_1_20_3)
fabric_1_21.link(fabric_1_20_6)
//fabric_1_20_6.link(fabric_1_20_5)
fabric_1_20_6.link(fabric_1_20_4)
//fabric_1_20_5.link(fabric_1_20_4)
fabric_1_20_4.link(fabric_1_20_3)
fabric_1_20_3.link(fabric_1_20_2)
//forge_1_20_2.link(fabric_1_20_2) //file("versions/forge.txt")
//neoforge_1_20_2.link(fabric_1_20_2)
fabric_1_20_2.link(fabric_1_20)
// forge_1_20.link(fabric_1_20)
fabric_1_20_2.link(fabric_1_20_1)
fabric_1_20_1.link(fabric_1_20)
}

View file

@ -27,22 +27,14 @@ rootProject.name = projectName
rootProject.buildFileName = "root.gradle.kts"
listOf(
// "1.20-forge",
"1.20-fabric",
//"1.20.2-forge",
//"1.20.2-neoforge",
"1.20.1-fabric",
"1.20.2-fabric",
//"1.20.3-forge",
//"1.20.3-neoforge",
"1.20.3-fabric",
//"1.20.5-neoforge",
"1.20.4-fabric",
//"1.20.5-fabric",
//"1.21-neoforge",
//"1.21-fabric"
"1.20.6-fabric",
"1.21-fabric",
).forEach { version ->
include(":$version")
project(":$version").apply {

View file

@ -1,7 +1,6 @@
package me.theclashfruit.cc.mixin;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentTarget;
import net.minecraft.item.Instrument;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
@ -12,6 +11,12 @@ import net.minecraft.registry.tag.TagKey;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
//#if MC >= 1.20.6
import net.minecraft.resource.featuretoggle.FeatureSet;
//#elseif MC < 1.20.5
//$$ import net.minecraft.enchantment.EnchantmentTarget;
//#endif
import java.util.Set;
@Mixin(ItemGroups.class)
@ -21,13 +26,42 @@ public interface ItemGroupsInterfaceMixin {
throw new AssertionError();
}
//#if MC >= 1.20.6
@Invoker("addPotions")
static void invokeAddPotions(ItemGroup.Entries entries, RegistryWrapper<Potion> registryWrapper, Item item, ItemGroup.StackVisibility visibility) {
static void invokeAddPotions(ItemGroup.Entries entries, RegistryWrapper<Potion> registryWrapper, Item item, ItemGroup.StackVisibility stackVisibility, FeatureSet featureSet) {
throw new AssertionError();
}
//#elseif MC >= 1.20.5
//$$ @Invoker("addPotions")
//$$ static void invokeAddPotions(ItemGroup.Entries entries, RegistryWrapper<Potion> registryWrapper, Item item, ItemGroup.StackVisibility visibility) {
//$$ throw new AssertionError();
//$$ }
//#else
//$$ @Invoker("addPotions")
//$$ static void invokeAddPotions(ItemGroup.Entries entries, RegistryWrapper<Potion> registryWrapper, Item item, ItemGroup.StackVisibility visibility) {
//$$ throw new AssertionError();
//$$ }
//#endif
//#if MC >= 1.21
@Invoker("addMaxLevelEnchantedBooks")
static void invokeAddMaxLevelEnchantedBooks(ItemGroup.Entries entries, RegistryWrapper<Enchantment> registryWrapper, Set<EnchantmentTarget> enchantmentTargets, ItemGroup.StackVisibility visibility) {
static void invokeAddMaxLevelEnchantedBooks(ItemGroup.Entries entries, RegistryWrapper<Enchantment> registryWrapper, ItemGroup.StackVisibility visibility) {
throw new AssertionError();
}
//#elseif MC >= 1.20.6
//$$ @Invoker("addMaxLevelEnchantedBooks")
//$$ static void invokeAddMaxLevelEnchantedBooks(ItemGroup.Entries entries, RegistryWrapper<Enchantment> registryWrapper, Set<TagKey<Item>> set, ItemGroup.StackVisibility stackVisibility, FeatureSet featureSet) {
//$$ throw new AssertionError();
//$$ }
//#elseif MC >= 1.20.5
//$$ @Invoker("addMaxLevelEnchantedBooks")
//$$ static void invokeAddMaxLevelEnchantedBooks(ItemGroup.Entries entries, RegistryWrapper<Enchantment> registryWrapper, Set<TagKey<Item>> enchantmentTargets, ItemGroup.StackVisibility visibility) {
//$$ throw new AssertionError();
//$$ }
//#else
//$$ @Invoker("addMaxLevelEnchantedBooks")
//$$ static void invokeAddMaxLevelEnchantedBooks(ItemGroup.Entries entries, RegistryWrapper<Enchantment> registryWrapper, Set<EnchantmentTarget> enchantmentTargets, ItemGroup.StackVisibility visibility) {
//$$ throw new AssertionError();
//$$ }
//#endif
}

View file

@ -2,20 +2,28 @@ package me.theclashfruit.cc.mixin;
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.potion.PotionUtil;
import net.minecraft.potion.Potions;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.InstrumentTags;
import net.minecraft.registry.tag.ItemTags;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.text.Text;
import net.minecraft.village.raid.Raid;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.gen.Invoker;
//#if MC >= 1.20.6
import net.minecraft.util.Identifier;
import net.minecraft.component.type.PotionContentsComponent;
//#else
//$$ import net.minecraft.enchantment.EnchantmentTarget;
//$$ import net.minecraft.potion.PotionUtil;
//#endif
import java.util.EnumSet;
import java.util.Set;
@ -56,12 +64,25 @@ public class ItemGroupsMixin {
.type(ItemGroup.Type.HOTBAR)
.build();
//#if MC >= 1.21
@Unique
private static final Identifier INVENTORY_TAB_TEXTURE_ID = ItemGroup.getTabTextureId("inventory");
@Unique
private static final Identifier ITEM_SEARCH_TAB_TEXTURE_ID = ItemGroup.getTabTextureId("item_search");
//#endif
@Unique
private static final ItemGroup inventoryGroup = ItemGroup
.create(ItemGroup.Row.BOTTOM, 6)
.displayName(Text.translatable("itemGroup.inventory"))
.icon(() -> new ItemStack(Blocks.CHEST))
.texture("inventory.png")
.texture(
//#if MC >= 1.21
INVENTORY_TAB_TEXTURE_ID
//#else
//$$ "inventory.png"
//#endif
)
.noRenderedName()
.special()
.type(ItemGroup.Type.INVENTORY)
@ -89,7 +110,13 @@ public class ItemGroupsMixin {
content.addAll(itemGroupSet);
})
.texture("item_search.png")
.texture(
//#if MC >= 1.21
ITEM_SEARCH_TAB_TEXTURE_ID
//#else
//$$ "item_search.png"
//#endif
)
.special()
.type(ItemGroup.Type.SEARCH)
.build();
@ -900,7 +927,12 @@ public class ItemGroupsMixin {
content.add(Items.GREEN_BANNER);
content.add(Items.RED_BANNER);
content.add(Items.BLACK_BANNER);
content.add(Raid.getOminousBanner());
//#if MC >= 1.20.6
content.add(Raid.getOminousBanner(displayContext.lookup().getWrapperOrThrow(RegistryKeys.BANNER_PATTERN)));
//#else
//$$ content.add(Raid.getOminousBanner());
//#endif
content.add(Items.END_CRYSTAL);
@ -1130,7 +1162,12 @@ public class ItemGroupsMixin {
content.add(Items.BEACON);
content.add(Items.TURTLE_EGG);
content.add(Items.CONDUIT);
content.add(Items.SCUTE);
//#if MC >= 1.20
content.add(Items.TURTLE_SCUTE);
//#else
//$$ content.add(Items.SCUTE);
//#endif
content.add(Items.COAL);
content.add(Items.CHARCOAL);
@ -1487,14 +1524,18 @@ public class ItemGroupsMixin {
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)));
//#if MC >= 1.20.6
LOGGER.info("WHY TF 1.20.6 HAS TO FUCK SHIT UP? HOW DO I MAKE AN ENCHANTED BOOK???????????????");
//#else
//$$ 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)));
//#endif
content.add(Items.LEAD);
content.add(Items.NAME_TAG);
@ -1552,14 +1593,33 @@ public class ItemGroupsMixin {
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);
//#if MC >= 1.21
displayContext.lookup().getOptionalWrapper(RegistryKeys.ENCHANTMENT).ifPresent((impl) -> {
ItemGroupsInterfaceMixin.invokeAddMaxLevelEnchantedBooks(content, impl, ItemGroup.StackVisibility.PARENT_TAB_ONLY);
});
//#elseif MC >= 1.20.6
//$$ Set<TagKey<Item>> set = Set.of(ItemTags.FOOT_ARMOR_ENCHANTABLE, ItemTags.LEG_ARMOR_ENCHANTABLE, ItemTags.CHEST_ARMOR_ENCHANTABLE, ItemTags.HEAD_ARMOR_ENCHANTABLE, ItemTags.ARMOR_ENCHANTABLE, ItemTags.SWORD_ENCHANTABLE, ItemTags.SHARP_WEAPON_ENCHANTABLE, ItemTags.MACE_ENCHANTABLE, ItemTags.FIRE_ASPECT_ENCHANTABLE, ItemTags.WEAPON_ENCHANTABLE, ItemTags.MINING_ENCHANTABLE, ItemTags.MINING_LOOT_ENCHANTABLE, ItemTags.FISHING_ENCHANTABLE, ItemTags.TRIDENT_ENCHANTABLE, ItemTags.DURABILITY_ENCHANTABLE, ItemTags.BOW_ENCHANTABLE, ItemTags.EQUIPPABLE_ENCHANTABLE, ItemTags.CROSSBOW_ENCHANTABLE, ItemTags.VANISHING_ENCHANTABLE);
//$$
//$$ displayContext.lookup().getOptionalWrapper(RegistryKeys.ENCHANTMENT).ifPresent((impl) -> {
//$$ ItemGroupsInterfaceMixin.invokeAddMaxLevelEnchantedBooks(content, impl, set, ItemGroup.StackVisibility.PARENT_TAB_ONLY, displayContext.comp_1251());
//$$ });
//#else
//$$ EnumSet<EnchantmentTarget> set = EnumSet.allOf(EnchantmentTarget.class);
//$$
//$$ displayContext.lookup().getOptionalWrapper(RegistryKeys.ENCHANTMENT).ifPresent(wrapper -> {
//$$ ItemGroupsInterfaceMixin.invokeAddMaxLevelEnchantedBooks(content, wrapper, set, ItemGroup.StackVisibility.PARENT_TAB_ONLY);
//$$ });
//#endif
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));
//#if MC >= 1.20.6
displayContext.lookup().getOptionalWrapper(RegistryKeys.POTION).ifPresent((impl) -> {
ItemGroupsInterfaceMixin.invokeAddPotions(content, impl, Items.TIPPED_ARROW, ItemGroup.StackVisibility.PARENT_AND_SEARCH_TABS, displayContext.comp_1251());
});
//#else
//$$ displayContext.lookup().getOptionalWrapper(RegistryKeys.POTION).ifPresent(wrapper -> ItemGroupsInterfaceMixin.invokeAddPotions(content, wrapper, Items.TIPPED_ARROW, ItemGroup.StackVisibility.PARENT_AND_SEARCH_TABS));
//#endif
content.add(Items.SHIELD);
content.add(Items.TOTEM_OF_UNDYING);
@ -1596,13 +1656,24 @@ public class ItemGroupsMixin {
.create(ItemGroup.Row.BOTTOM, 4)
.type(ItemGroup.Type.CATEGORY)
.displayName(Text.translatable("itemGroup.brewing"))
.icon(() -> PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.WATER))
.entries((displayContext, content) -> {
.icon(() ->
//#if MC >= 1.20.6
PotionContentsComponent.createStack(Items.POTION, Potions.WATER)
//#else
//$$ PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.WATER)
//#endif
).entries((displayContext, content) -> {
content.add(Items.GHAST_TEAR);
displayContext.lookup().getOptionalWrapper(RegistryKeys.POTION).ifPresent(wrapper -> {
ItemGroupsInterfaceMixin.invokeAddPotions(content, wrapper, Items.POTION, ItemGroup.StackVisibility.PARENT_AND_SEARCH_TABS);
//#if MC >= 1.20.6
displayContext.lookup().getOptionalWrapper(RegistryKeys.POTION).ifPresent((impl) -> {
ItemGroupsInterfaceMixin.invokeAddPotions(content, impl, Items.POTION, ItemGroup.StackVisibility.PARENT_AND_SEARCH_TABS, displayContext.comp_1251());
});
//#else
//$$ displayContext.lookup().getOptionalWrapper(RegistryKeys.POTION).ifPresent(wrapper -> {
//$$ ItemGroupsInterfaceMixin.invokeAddPotions(content, wrapper, Items.POTION, ItemGroup.StackVisibility.PARENT_AND_SEARCH_TABS);
//$$ });
//#endif
content.add(Items.GLASS_BOTTLE);
content.add(Items.FERMENTED_SPIDER_EYE);
@ -1615,10 +1686,17 @@ public class ItemGroupsMixin {
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);
//#if MC >= 1.20.6
displayContext.lookup().getOptionalWrapper(RegistryKeys.POTION).ifPresent((impl) -> {
ItemGroupsInterfaceMixin.invokeAddPotions(content, impl, Items.SPLASH_POTION, ItemGroup.StackVisibility.PARENT_AND_SEARCH_TABS, displayContext.comp_1251());
ItemGroupsInterfaceMixin.invokeAddPotions(content, impl, Items.LINGERING_POTION, ItemGroup.StackVisibility.PARENT_AND_SEARCH_TABS, displayContext.comp_1251());
});
//#else
//$$ 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);
//$$ });
//#endif
content.add(Items.PHANTOM_MEMBRANE);
})

View file

@ -1 +1 @@
1.20.3-fabric
1.21-fabric