From 226eefc90e01f57e7fa1aa753becf37df4b56436 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 26 Sep 2024 16:59:35 +0200 Subject: [PATCH] reinstate curios compat --- build.gradle | 6 +++-- gradle.properties | 3 +-- .../resources/data/curios/tags/item/belt.json | 6 +++++ .../data/curios/tags/item/charm.json | 6 +++++ .../data/curios/tags/item/necklace.json | 5 ++++ .../resources/data/curios/tags/item/ring.json | 5 ++++ .../naturesaura/curios/entities/entities.json | 11 ++++++++ .../data/naturesaura/curios/slots/belt.json | 4 +++ .../data/naturesaura/curios/slots/charm.json | 4 +++ .../naturesaura/curios/slots/necklace.json | 4 +++ .../data/naturesaura/curios/slots/ring.json | 4 +++ .../java/de/ellpeck/naturesaura/Helper.java | 8 +++--- .../de/ellpeck/naturesaura/compat/Compat.java | 3 +-- .../naturesaura/compat/CuriosCompat.java | 26 +++++++++---------- .../renderers/PlayerLayerTrinkets.java | 7 ++--- 15 files changed, 76 insertions(+), 26 deletions(-) create mode 100644 src/generated/resources/data/curios/tags/item/belt.json create mode 100644 src/generated/resources/data/curios/tags/item/charm.json create mode 100644 src/generated/resources/data/curios/tags/item/necklace.json create mode 100644 src/generated/resources/data/curios/tags/item/ring.json create mode 100644 src/generated/resources/data/naturesaura/curios/entities/entities.json create mode 100644 src/generated/resources/data/naturesaura/curios/slots/belt.json create mode 100644 src/generated/resources/data/naturesaura/curios/slots/charm.json create mode 100644 src/generated/resources/data/naturesaura/curios/slots/necklace.json create mode 100644 src/generated/resources/data/naturesaura/curios/slots/ring.json diff --git a/build.gradle b/build.gradle index cdbf81fe..2f0db831 100644 --- a/build.gradle +++ b/build.gradle @@ -27,6 +27,9 @@ repositories { maven { url = "https://maven.theillusivec4.top/" } + maven { + url = uri("https://maven.octo-studios.com/releases") + } } base { @@ -98,8 +101,7 @@ dependencies { compileOnly "mezz.jei:jei-${minecraft_version}-neoforge-api:${jei_version}" runtimeOnly "mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}" -// runtimeOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}" -// compileOnly "top.theillusivec4.curios:curios-neoforge:${curios_version}:api" + implementation "top.theillusivec4.curios:curios-neoforge:${curios_version}" compileOnly "vazkii.patchouli:Patchouli:${patchouli_version}:api" runtimeOnly "vazkii.patchouli:Patchouli:${patchouli_version}" diff --git a/gradle.properties b/gradle.properties index 4d51c271..3a6ca7ac 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,8 +19,7 @@ neo_version_range=[21.1.0,) loader_version_range=[4,) jei_version=19.18.3.204 -# TODO what to do about curios being discontinued? try out https://www.curseforge.com/minecraft/mc-mods/adorned? -# curios_version=7.2.0+1.20.4 +curios_version=9.0.11+1.21 patchouli_version=1.21-87-NEOFORGE ## Mod Properties diff --git a/src/generated/resources/data/curios/tags/item/belt.json b/src/generated/resources/data/curios/tags/item/belt.json new file mode 100644 index 00000000..47b640c4 --- /dev/null +++ b/src/generated/resources/data/curios/tags/item/belt.json @@ -0,0 +1,6 @@ +{ + "values": [ + "naturesaura:aura_cache", + "naturesaura:aura_trove" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/curios/tags/item/charm.json b/src/generated/resources/data/curios/tags/item/charm.json new file mode 100644 index 00000000..fec975a0 --- /dev/null +++ b/src/generated/resources/data/curios/tags/item/charm.json @@ -0,0 +1,6 @@ +{ + "values": [ + "naturesaura:eye", + "naturesaura:eye_improved" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/curios/tags/item/necklace.json b/src/generated/resources/data/curios/tags/item/necklace.json new file mode 100644 index 00000000..34e66ffa --- /dev/null +++ b/src/generated/resources/data/curios/tags/item/necklace.json @@ -0,0 +1,5 @@ +{ + "values": [ + "naturesaura:shockwave_creator" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/curios/tags/item/ring.json b/src/generated/resources/data/curios/tags/item/ring.json new file mode 100644 index 00000000..9d44b997 --- /dev/null +++ b/src/generated/resources/data/curios/tags/item/ring.json @@ -0,0 +1,5 @@ +{ + "values": [ + "naturesaura:death_ring" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/naturesaura/curios/entities/entities.json b/src/generated/resources/data/naturesaura/curios/entities/entities.json new file mode 100644 index 00000000..33ddad8a --- /dev/null +++ b/src/generated/resources/data/naturesaura/curios/entities/entities.json @@ -0,0 +1,11 @@ +{ + "entities": [ + "minecraft:player" + ], + "slots": [ + "charm", + "belt", + "ring", + "necklace" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/naturesaura/curios/slots/belt.json b/src/generated/resources/data/naturesaura/curios/slots/belt.json new file mode 100644 index 00000000..eadd4854 --- /dev/null +++ b/src/generated/resources/data/naturesaura/curios/slots/belt.json @@ -0,0 +1,4 @@ +{ + "add_cosmetic": true, + "size": 1 +} \ No newline at end of file diff --git a/src/generated/resources/data/naturesaura/curios/slots/charm.json b/src/generated/resources/data/naturesaura/curios/slots/charm.json new file mode 100644 index 00000000..eadd4854 --- /dev/null +++ b/src/generated/resources/data/naturesaura/curios/slots/charm.json @@ -0,0 +1,4 @@ +{ + "add_cosmetic": true, + "size": 1 +} \ No newline at end of file diff --git a/src/generated/resources/data/naturesaura/curios/slots/necklace.json b/src/generated/resources/data/naturesaura/curios/slots/necklace.json new file mode 100644 index 00000000..eadd4854 --- /dev/null +++ b/src/generated/resources/data/naturesaura/curios/slots/necklace.json @@ -0,0 +1,4 @@ +{ + "add_cosmetic": true, + "size": 1 +} \ No newline at end of file diff --git a/src/generated/resources/data/naturesaura/curios/slots/ring.json b/src/generated/resources/data/naturesaura/curios/slots/ring.json new file mode 100644 index 00000000..eadd4854 --- /dev/null +++ b/src/generated/resources/data/naturesaura/curios/slots/ring.json @@ -0,0 +1,4 @@ +{ + "add_cosmetic": true, + "size": 1 +} \ No newline at end of file diff --git a/src/main/java/de/ellpeck/naturesaura/Helper.java b/src/main/java/de/ellpeck/naturesaura/Helper.java index 87c659a3..aae59eac 100644 --- a/src/main/java/de/ellpeck/naturesaura/Helper.java +++ b/src/main/java/de/ellpeck/naturesaura/Helper.java @@ -8,6 +8,7 @@ import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge; import de.ellpeck.naturesaura.api.misc.ILevelData; import de.ellpeck.naturesaura.blocks.tiles.BlockEntityImpl; import de.ellpeck.naturesaura.chunk.AuraChunk; +import de.ellpeck.naturesaura.compat.Compat; import de.ellpeck.naturesaura.misc.LevelData; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; @@ -50,6 +51,8 @@ import net.neoforged.neoforge.capabilities.Capabilities; import net.neoforged.neoforge.capabilities.ICapabilityProvider; import net.neoforged.neoforge.items.IItemHandler; import net.neoforged.neoforge.items.IItemHandlerModifiable; +import top.theillusivec4.curios.api.CuriosApi; +import top.theillusivec4.curios.api.SlotResult; import java.lang.reflect.Modifier; import java.util.List; @@ -300,15 +303,14 @@ public final class Helper { } public static ItemStack getEquippedItem(Predicate predicate, Player player, boolean hotbarOnly) { - // TODO curios? - /* if (Compat.hasCompat("curios")) { + if (Compat.hasCompat("curios")) { var inventory = CuriosApi.getCuriosInventory(player); if (inventory.isPresent()) { var stack = inventory.get().findFirstCurio(predicate).map(SlotResult::stack); if (stack.isPresent()) return stack.get(); } - }*/ + } var invSize = hotbarOnly ? 9 : player.getInventory().getContainerSize(); for (var i = 0; i < invSize; i++) { var slot = player.getInventory().getItem(i); diff --git a/src/main/java/de/ellpeck/naturesaura/compat/Compat.java b/src/main/java/de/ellpeck/naturesaura/compat/Compat.java index 384d536f..9ed82406 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/Compat.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/Compat.java @@ -19,8 +19,7 @@ public final class Compat { @SuppressWarnings("Convert2MethodRef") // bleh classloading compat issues private static final Map> MODULE_TYPES = ImmutableMap.>builder() .put("patchouli", () -> new PatchouliCompat()) - // TODO curios? - //.put("curios", () -> new CuriosCompat()) + .put("curios", () -> new CuriosCompat()) //.put("enchantability", EnchantibilityCompat::new) .build(); private static final Map MODULES = new HashMap<>(); diff --git a/src/main/java/de/ellpeck/naturesaura/compat/CuriosCompat.java b/src/main/java/de/ellpeck/naturesaura/compat/CuriosCompat.java index 3cf20503..8c34e492 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/CuriosCompat.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/CuriosCompat.java @@ -1,5 +1,3 @@ -// TODO curios? -/* package de.ellpeck.naturesaura.compat; import com.google.common.collect.ImmutableMap; @@ -26,13 +24,13 @@ import java.util.concurrent.CompletableFuture; public class CuriosCompat implements ICompat { private static final Map TYPES = ImmutableMap.builder() - .put(ModItems.EYE, "charm") - .put(ModItems.EYE_IMPROVED, "charm") - .put(ModItems.AURA_CACHE, "belt") - .put(ModItems.AURA_TROVE, "belt") - .put(ModItems.SHOCKWAVE_CREATOR, "necklace") - .put(ModItems.DEATH_RING, "ring") - .build(); + .put(ModItems.EYE, "charm") + .put(ModItems.EYE_IMPROVED, "charm") + .put(ModItems.AURA_CACHE, "belt") + .put(ModItems.AURA_TROVE, "belt") + .put(ModItems.SHOCKWAVE_CREATOR, "necklace") + .put(ModItems.DEATH_RING, "ring") + .build(); @Override public void addCapabilities(RegisterCapabilitiesEvent event) { @@ -69,7 +67,7 @@ public class CuriosCompat implements ICompat { @Override public void addItemTags(ItemTagProvider provider) { for (var entry : CuriosCompat.TYPES.entrySet()) { - var tag = ItemTags.create(new ResourceLocation("curios", entry.getValue())); + var tag = ItemTags.create(ResourceLocation.fromNamespaceAndPath("curios", entry.getValue())); provider.tag(tag).add(entry.getKey()); } } @@ -82,12 +80,12 @@ public class CuriosCompat implements ICompat { @Override public void generate(HolderLookup.Provider provider, ExistingFileHelper existingFileHelper) { - for (var type : CuriosCompat.TYPES.values()) { - this.createSlot(type); - } + var types = CuriosCompat.TYPES.values().stream().distinct().toArray(String[]::new); + this.createEntities("entities").addPlayer().addSlots(types); + for (var type : types) + this.createSlot(type).size(1).addCosmetic(true); } } } -*/ diff --git a/src/main/java/de/ellpeck/naturesaura/renderers/PlayerLayerTrinkets.java b/src/main/java/de/ellpeck/naturesaura/renderers/PlayerLayerTrinkets.java index 49c8c0f3..d31f5fd1 100644 --- a/src/main/java/de/ellpeck/naturesaura/renderers/PlayerLayerTrinkets.java +++ b/src/main/java/de/ellpeck/naturesaura/renderers/PlayerLayerTrinkets.java @@ -5,6 +5,7 @@ import com.mojang.math.Axis; import de.ellpeck.naturesaura.ModConfig; import de.ellpeck.naturesaura.api.render.ITrinketItem; import de.ellpeck.naturesaura.api.render.ITrinketItem.RenderType; +import de.ellpeck.naturesaura.compat.Compat; import net.minecraft.client.model.PlayerModel; import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.renderer.MultiBufferSource; @@ -17,6 +18,7 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.neoforged.api.distmarker.Dist; import net.neoforged.api.distmarker.OnlyIn; +import top.theillusivec4.curios.api.CuriosApi; import java.util.HashSet; import java.util.Set; @@ -57,15 +59,14 @@ public class PlayerLayerTrinkets extends RenderLayer