reinstate curios compat

This commit is contained in:
Ell 2024-09-26 16:59:35 +02:00
parent c5e8935595
commit 226eefc90e
15 changed files with 76 additions and 26 deletions

View file

@ -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}"

View file

@ -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

View file

@ -0,0 +1,6 @@
{
"values": [
"naturesaura:aura_cache",
"naturesaura:aura_trove"
]
}

View file

@ -0,0 +1,6 @@
{
"values": [
"naturesaura:eye",
"naturesaura:eye_improved"
]
}

View file

@ -0,0 +1,5 @@
{
"values": [
"naturesaura:shockwave_creator"
]
}

View file

@ -0,0 +1,5 @@
{
"values": [
"naturesaura:death_ring"
]
}

View file

@ -0,0 +1,11 @@
{
"entities": [
"minecraft:player"
],
"slots": [
"charm",
"belt",
"ring",
"necklace"
]
}

View file

@ -0,0 +1,4 @@
{
"add_cosmetic": true,
"size": 1
}

View file

@ -0,0 +1,4 @@
{
"add_cosmetic": true,
"size": 1
}

View file

@ -0,0 +1,4 @@
{
"add_cosmetic": true,
"size": 1
}

View file

@ -0,0 +1,4 @@
{
"add_cosmetic": true,
"size": 1
}

View file

@ -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<ItemStack> 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);

View file

@ -19,8 +19,7 @@ public final class Compat {
@SuppressWarnings("Convert2MethodRef") // bleh classloading compat issues
private static final Map<String, Supplier<ICompat>> MODULE_TYPES = ImmutableMap.<String, Supplier<ICompat>>builder()
.put("patchouli", () -> new PatchouliCompat())
// TODO curios?
//.put("curios", () -> new CuriosCompat())
.put("curios", () -> new CuriosCompat())
//.put("enchantability", EnchantibilityCompat::new)
.build();
private static final Map<String, ICompat> MODULES = new HashMap<>();

View file

@ -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<Item, String> TYPES = ImmutableMap.<Item, String>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);
}
}
}
*/

View file

@ -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<AbstractClientPlayer, Playe
this.renderStack(player.getInventory().getItem(i), player, type, main, second, matrices, buffer, packedLight);
}
// TODO curios?
/* if (Compat.hasCompat("curios")) {
if (Compat.hasCompat("curios")) {
var inventory = CuriosApi.getCuriosInventory(player).orElse(null);
if (inventory != null) {
var handler = inventory.getEquippedCurios();
for (var i = 0; i < handler.getSlots(); i++)
this.renderStack(handler.getStackInSlot(i), player, type, main, second, matrices, buffer, packedLight);
}
}*/
}
}
private void renderStack(ItemStack stack, Player player, RenderType type, ItemStack main, ItemStack second, PoseStack matrices, MultiBufferSource buffer, int packedLight) {