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 956dbd26b9
commit 8c560e3ff3
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
5 changed files with 9 additions and 3 deletions

View file

@ -78,7 +78,12 @@ dependencies {
include "com.sollace:Romanizer:Romanizer:1.0.2" include "com.sollace:Romanizer:Romanizer:1.0.2"
modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}" modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
if (project.use_trinkets == '1') {
modCompileOnly "dev.emi:trinkets:${project.trinkets_version}" modCompileOnly "dev.emi:trinkets:${project.trinkets_version}"
} else {
modCompileOnly "dev.emi:trinkets-dummy:${project.trinkets_version}"
}
modImplementation "com.terraformersmc.terraform-api:terraform-wood-api-v1:${project.terraformer_api_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}" 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 nodium_version=1.1.0+1.20
# Testing # Testing
use_trinkets=1
use_pehkui=0 use_pehkui=0
use_sodium=1 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) { 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) { EquippedStack(LivingEntity entity, EquipmentSlot slot) {
this(entity.getEquippedStack(slot), () -> {}, l -> l.sendEquipmentBreakStatus(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) { 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() .findFirst()
.orElse(TrinketsDelegate.EquippedStack.EMPTY); .orElse(TrinketsDelegate.EquippedStack.EMPTY);
} }