From 5ce419b857f4db57f27207ca53f5b5b712167a73 Mon Sep 17 00:00:00 2001 From: Jakl <57708725+Jakllp@users.noreply.github.com> Date: Thu, 3 Oct 2024 08:27:50 +0200 Subject: [PATCH] Don't use nonexistent logger --- .../v1_20_R4/services/EntityConverterService.java | 10 +++------- .../v1_21_R1/services/EntityConverterService.java | 10 +++------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/modules/v1_20_R4/src/main/java/de/Keyle/MyPet/compat/v1_20_R4/services/EntityConverterService.java b/modules/v1_20_R4/src/main/java/de/Keyle/MyPet/compat/v1_20_R4/services/EntityConverterService.java index 55b6aedb4..f18983523 100644 --- a/modules/v1_20_R4/src/main/java/de/Keyle/MyPet/compat/v1_20_R4/services/EntityConverterService.java +++ b/modules/v1_20_R4/src/main/java/de/Keyle/MyPet/compat/v1_20_R4/services/EntityConverterService.java @@ -21,7 +21,6 @@ package de.Keyle.MyPet.compat.v1_20_R4.services; import com.google.common.collect.Sets; -import com.mojang.logging.LogUtils; import com.mojang.serialization.DataResult; import com.mojang.serialization.Dynamic; import de.Keyle.MyPet.MyPetApi; @@ -51,7 +50,6 @@ import org.bukkit.entity.*; import org.bukkit.inventory.HorseInventory; import org.bukkit.inventory.ItemStack; -import org.slf4j.Logger; import java.util.*; @@ -211,11 +209,9 @@ public void convertEntity(MyPet myPet, LivingEntity normalEntity) { TagCompound offersTag = villagerTag.get("Offers"); CompoundTag vanillaNBT = (CompoundTag) ItemStackNBTConverter.compoundToVanillaCompound(offersTag); DataResult dataresult = MerchantOffers.CODEC.parse(entityVillager.registryAccess().createSerializationContext(NbtOps.INSTANCE), vanillaNBT.get("Offers")); - Logger logger = LogUtils.getLogger(); - Objects.requireNonNull(logger); - dataresult.resultOrPartial(net.minecraft.Util.prefix("Failed to load offers: ", logger::warn)).ifPresent((merchantrecipelist) -> { - entityVillager.setOffers(merchantrecipelist); - }); + if(dataresult.hasResultOrPartial() && dataresult.resultOrPartial().isPresent()) { + entityVillager.setOffers(dataresult.resultOrPartial().get()); + } } if (villagerTag.containsKey("Inventory")) { TagList inventoryTag = villagerTag.get("Inventory"); diff --git a/modules/v1_21_R1/src/main/java/de/Keyle/MyPet/compat/v1_21_R1/services/EntityConverterService.java b/modules/v1_21_R1/src/main/java/de/Keyle/MyPet/compat/v1_21_R1/services/EntityConverterService.java index 1f8b794ee..d8613e77a 100644 --- a/modules/v1_21_R1/src/main/java/de/Keyle/MyPet/compat/v1_21_R1/services/EntityConverterService.java +++ b/modules/v1_21_R1/src/main/java/de/Keyle/MyPet/compat/v1_21_R1/services/EntityConverterService.java @@ -21,7 +21,6 @@ package de.Keyle.MyPet.compat.v1_21_R1.services; import com.google.common.collect.Sets; -import com.mojang.logging.LogUtils; import com.mojang.serialization.DataResult; import com.mojang.serialization.Dynamic; import de.Keyle.MyPet.MyPetApi; @@ -51,7 +50,6 @@ import org.bukkit.entity.*; import org.bukkit.inventory.HorseInventory; import org.bukkit.inventory.ItemStack; -import org.slf4j.Logger; import java.util.*; @@ -211,11 +209,9 @@ public void convertEntity(MyPet myPet, LivingEntity normalEntity) { TagCompound offersTag = villagerTag.get("Offers"); CompoundTag vanillaNBT = (CompoundTag) ItemStackNBTConverter.compoundToVanillaCompound(offersTag); DataResult dataresult = MerchantOffers.CODEC.parse(entityVillager.registryAccess().createSerializationContext(NbtOps.INSTANCE), vanillaNBT.get("Offers")); - Logger logger = LogUtils.getLogger(); - Objects.requireNonNull(logger); - dataresult.resultOrPartial(net.minecraft.Util.prefix("Failed to load offers: ", logger::warn)).ifPresent((merchantrecipelist) -> { - entityVillager.setOffers(merchantrecipelist); - }); + if(dataresult.hasResultOrPartial() && dataresult.resultOrPartial().isPresent()) { + entityVillager.setOffers(dataresult.resultOrPartial().get()); + } } if (villagerTag.containsKey("Inventory")) { TagList inventoryTag = villagerTag.get("Inventory");