From 6973392e5502f0f239538198a306c3c1b9d82336 Mon Sep 17 00:00:00 2001 From: Katherine Date: Mon, 30 Dec 2024 04:29:36 -0500 Subject: [PATCH] Vanity Slots compat for BedrockCapeRenderer (#645) Signed-off-by: unilock --- build.gradle | 1 + gradle.properties | 2 ++ .../compat/vanityslots/VanitySlotsCompat.java | 18 ++++++++++++++++++ .../mixin/client/CapeFeatureRendererMixin.java | 4 ++-- 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 src/main/java/de/dafuqs/spectrum/compat/vanityslots/VanitySlotsCompat.java diff --git a/build.gradle b/build.gradle index 4989cd2cd1..bde2917768 100644 --- a/build.gradle +++ b/build.gradle @@ -101,6 +101,7 @@ dependencies { // modCompileOnly("maven.modrinth:enchantment-descriptions:${project.enchantment_descriptions_version}") modCompileOnly("maven.modrinth:travelersbackpack:${project.travelers_backpack_version}") modCompileOnly("maven.modrinth:botania:${project.botania_version}") + modCompileOnly("maven.modrinth:vanity:${project.vanityslots_version}") modImplementation("maven.modrinth:idwtialsimmoedm:${project.idwtialsimmoedm_version}") //Porting Lib diff --git a/gradle.properties b/gradle.properties index 60b9c424ba..81c5ab3476 100644 --- a/gradle.properties +++ b/gradle.properties @@ -65,6 +65,8 @@ port_lib_version = 2.3.5+1.20.1 port_lib_modules = lazy_registration # https://modrinth.com/mod/exclusions-lib exclusionslib_version=0.6 +# https://modrinth.com/mod/vanity +vanityslots_version=1.2.9 # What recipe viewer to use ('emi', 'rei', or 'disabled') recipe_viewer=emi diff --git a/src/main/java/de/dafuqs/spectrum/compat/vanityslots/VanitySlotsCompat.java b/src/main/java/de/dafuqs/spectrum/compat/vanityslots/VanitySlotsCompat.java new file mode 100644 index 0000000000..9ac2469169 --- /dev/null +++ b/src/main/java/de/dafuqs/spectrum/compat/vanityslots/VanitySlotsCompat.java @@ -0,0 +1,18 @@ +package de.dafuqs.spectrum.compat.vanityslots; + +import gay.nyako.vanityslots.*; +import net.fabricmc.loader.api.*; +import net.minecraft.entity.*; +import net.minecraft.item.*; + +public class VanitySlotsCompat { + public static final boolean IS_VANITY_SLOTS_PRESENT = FabricLoader.getInstance().isModLoaded("vanityslots"); + + public static ItemStack getEquippedStack(LivingEntity entity, EquipmentSlot slot) { + if (VanitySlotsCompat.IS_VANITY_SLOTS_PRESENT) { + return VanitySlots.getEquippedStack(entity, slot); + } else { + return entity.getEquippedStack(slot); + } + } +} diff --git a/src/main/java/de/dafuqs/spectrum/mixin/client/CapeFeatureRendererMixin.java b/src/main/java/de/dafuqs/spectrum/mixin/client/CapeFeatureRendererMixin.java index 847a5d3445..299731ca91 100644 --- a/src/main/java/de/dafuqs/spectrum/mixin/client/CapeFeatureRendererMixin.java +++ b/src/main/java/de/dafuqs/spectrum/mixin/client/CapeFeatureRendererMixin.java @@ -1,11 +1,11 @@ package de.dafuqs.spectrum.mixin.client; +import de.dafuqs.spectrum.compat.vanityslots.*; import de.dafuqs.spectrum.registries.*; import de.dafuqs.spectrum.render.armor.*; import net.fabricmc.api.*; import net.minecraft.client.network.*; import net.minecraft.client.render.*; -import net.minecraft.client.render.entity.*; import net.minecraft.client.render.entity.feature.*; import net.minecraft.client.render.entity.model.*; import net.minecraft.client.util.math.*; @@ -29,7 +29,7 @@ public CapeFeatureRendererMixin(FeatureRendererContext