Skip to content

Commit 6973392

Browse files
authored
Vanity Slots compat for BedrockCapeRenderer (#645)
Signed-off-by: unilock <[email protected]>
1 parent 9f2f05d commit 6973392

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

Diff for: build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ dependencies {
101101
// modCompileOnly("maven.modrinth:enchantment-descriptions:${project.enchantment_descriptions_version}")
102102
modCompileOnly("maven.modrinth:travelersbackpack:${project.travelers_backpack_version}")
103103
modCompileOnly("maven.modrinth:botania:${project.botania_version}")
104+
modCompileOnly("maven.modrinth:vanity:${project.vanityslots_version}")
104105
modImplementation("maven.modrinth:idwtialsimmoedm:${project.idwtialsimmoedm_version}")
105106

106107
//Porting Lib

Diff for: gradle.properties

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ port_lib_version = 2.3.5+1.20.1
6565
port_lib_modules = lazy_registration
6666
# https://modrinth.com/mod/exclusions-lib
6767
exclusionslib_version=0.6
68+
# https://modrinth.com/mod/vanity
69+
vanityslots_version=1.2.9
6870

6971
# What recipe viewer to use ('emi', 'rei', or 'disabled')
7072
recipe_viewer=emi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package de.dafuqs.spectrum.compat.vanityslots;
2+
3+
import gay.nyako.vanityslots.*;
4+
import net.fabricmc.loader.api.*;
5+
import net.minecraft.entity.*;
6+
import net.minecraft.item.*;
7+
8+
public class VanitySlotsCompat {
9+
public static final boolean IS_VANITY_SLOTS_PRESENT = FabricLoader.getInstance().isModLoaded("vanityslots");
10+
11+
public static ItemStack getEquippedStack(LivingEntity entity, EquipmentSlot slot) {
12+
if (VanitySlotsCompat.IS_VANITY_SLOTS_PRESENT) {
13+
return VanitySlots.getEquippedStack(entity, slot);
14+
} else {
15+
return entity.getEquippedStack(slot);
16+
}
17+
}
18+
}

Diff for: src/main/java/de/dafuqs/spectrum/mixin/client/CapeFeatureRendererMixin.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package de.dafuqs.spectrum.mixin.client;
22

3+
import de.dafuqs.spectrum.compat.vanityslots.*;
34
import de.dafuqs.spectrum.registries.*;
45
import de.dafuqs.spectrum.render.armor.*;
56
import net.fabricmc.api.*;
67
import net.minecraft.client.network.*;
78
import net.minecraft.client.render.*;
8-
import net.minecraft.client.render.entity.*;
99
import net.minecraft.client.render.entity.feature.*;
1010
import net.minecraft.client.render.entity.model.*;
1111
import net.minecraft.client.util.math.*;
@@ -29,7 +29,7 @@ public CapeFeatureRendererMixin(FeatureRendererContext<AbstractClientPlayerEntit
2929
@Inject(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/network/AbstractClientPlayerEntity;FFFFFF)V", at = @At("HEAD"), cancellable = true)
3030
public void spectrum$renderBedrockCape(MatrixStack ms, VertexConsumerProvider vertices, int light, AbstractClientPlayerEntity player, float f, float g, float h, float j, float k, float l, CallbackInfo ci) {
3131
// Check for the chestplate, and begin rendering the cape if equipped
32-
ItemStack chestStack = player.getEquippedStack(EquipmentSlot.CHEST);
32+
ItemStack chestStack = VanitySlotsCompat.getEquippedStack(player, EquipmentSlot.CHEST);
3333
if (chestStack.getItem() == SpectrumItems.BEDROCK_CHESTPLATE) {
3434
BedrockCapeRenderer.renderBedrockCapeAndCloth(ms, vertices, light, player, h, chestStack);
3535
// TODO - Cancel for now, as the new armor tailoring system is not implemented yet

0 commit comments

Comments
 (0)