Fixed amulet rendering when trinkets is not installed. Closes #455

This commit is contained in:
Sollace 2024-09-18 16:52:44 +01:00
parent 9523070c96
commit 3cc7030e7b
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
5 changed files with 10 additions and 5 deletions

View file

@ -77,9 +77,13 @@ dependencies {
include "com.sollace:Romanizer:Romanizer:1.0.2"
modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
modCompileOnly "dev.emi:trinkets:${project.trinkets_version}"
modCompileOnly "dev.onyxstudios.cardinal-components-api:cardinal-components-base:5.3.0"
modCompileOnly "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:5.3.0"
if (project.use_trinkets == '1') {
modCompileOnly "dev.emi:trinkets:${project.trinkets_version}"
modCompileOnly "dev.onyxstudios.cardinal-components-api:cardinal-components-base:5.3.0"
modCompileOnly "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:5.3.0"
} else {
modCompileOnly "dev.emi:trinkets-dummy:${project.trinkets_version}"
}
modImplementation "com.terraformersmc.terraform-api:terraform-wood-api-v1:${project.terraformer_api_version}"
include "com.terraformersmc.terraform-api:terraform-wood-api-v1:${project.terraformer_api_version}"

View file

@ -30,6 +30,7 @@ org.gradle.daemon=false
nodium_version=1.1.0+1.20
# Testing
use_trinkets=1
use_pehkui=0
use_sodium=1

Binary file not shown.

View file

@ -127,7 +127,7 @@ public interface TrinketsDelegate {
}
record EquippedStack(ItemStack stack, Runnable sendUpdate, Consumer<LivingEntity> breakStatusSender) {
public static EquippedStack EMPTY = new EquippedStack(ItemStack.EMPTY, () -> {}, l -> {});
public static final EquippedStack EMPTY = new EquippedStack(ItemStack.EMPTY, () -> {}, l -> {});
EquippedStack(LivingEntity entity, EquipmentSlot slot) {
this(entity.getEquippedStack(slot), () -> {}, l -> l.sendEquipmentBreakStatus(slot));

View file

@ -101,7 +101,7 @@ public class AmuletItem extends WearableItem implements ChargeableItem {
}
public static TrinketsDelegate.EquippedStack get(LivingEntity entity) {
return TrinketsDelegate.getInstance(entity).getEquipped(entity, TrinketsDelegate.NECKLACE)
return TrinketsDelegate.getInstance(entity).getEquipped(entity, TrinketsDelegate.NECKLACE, stack -> stack.getItem() instanceof AmuletItem)
.findFirst()
.orElse(TrinketsDelegate.EquippedStack.EMPTY);
}