Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakllp committed Oct 3, 2024
2 parents 7687236 + 5ce419b commit e9aa246
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.*;

Expand Down Expand Up @@ -211,11 +209,9 @@ public void convertEntity(MyPet myPet, LivingEntity normalEntity) {
TagCompound offersTag = villagerTag.get("Offers");
CompoundTag vanillaNBT = (CompoundTag) ItemStackNBTConverter.compoundToVanillaCompound(offersTag);
DataResult<MerchantOffers> 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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.*;

Expand Down Expand Up @@ -211,11 +209,9 @@ public void convertEntity(MyPet myPet, LivingEntity normalEntity) {
TagCompound offersTag = villagerTag.get("Offers");
CompoundTag vanillaNBT = (CompoundTag) ItemStackNBTConverter.compoundToVanillaCompound(offersTag);
DataResult<MerchantOffers> 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");
Expand Down

0 comments on commit e9aa246

Please sign in to comment.