Merge remote-tracking branch 'origin/dev' into new-abilities

This commit is contained in:
Vidal committed 2026-03-15 19:58:18 -03:00
commit 1ab1dd1e16
4 files changed
+11 -11

No files matched your search

@@ -351,6 +351,7 @@ public class ScriptContainer implements IScriptUnit {
}
this.engine = ScriptController.Instance.getEngineByName(scriptLanguage.toLowerCase());
this.evaluated = false;
this.lastGlobalsVersion = -1;
}
}
@@ -2,6 +2,7 @@ package noppes.npcs.controllers.data;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.api.handler.data.IAuctionClaim;
import noppes.npcs.api.item.IItemStack;
import noppes.npcs.config.ConfigMarket;
@@ -209,9 +210,7 @@ public class AuctionClaim implements IAuctionClaim {
compound.setInteger("Type", type.ordinal());
if (item != null) {
NBTTagCompound itemTag = new NBTTagCompound();
item.writeToNBT(itemTag);
compound.setTag("Item", itemTag);
compound.setTag("Item", NoppesUtilServer.writeItem(item, new NBTTagCompound()));
}
compound.setString("ItemName", itemName != null ? itemName : "");
@@ -235,7 +234,7 @@ public class AuctionClaim implements IAuctionClaim {
type = EnumClaimType.fromOrdinal(compound.getInteger("Type"));
if (compound.hasKey("Item")) {
item = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("Item"));
item = NoppesUtilServer.readItem(compound.getCompoundTag("Item"));
} else {
item = null;
}
@@ -2,6 +2,7 @@ package noppes.npcs.controllers.data;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.api.handler.data.IAuctionListing;
import noppes.npcs.api.item.IItemStack;
import noppes.npcs.config.ConfigMarket;
@@ -214,9 +215,7 @@ public class AuctionListing implements IAuctionListing {
compound.setString("SellerName", sellerName != null ? sellerName : "");
if (item != null) {
NBTTagCompound itemTag = new NBTTagCompound();
item.writeToNBT(itemTag);
compound.setTag("Item", itemTag);
compound.setTag("Item", NoppesUtilServer.writeItem(item, new NBTTagCompound()));
}
compound.setLong("StartingPrice", startingPrice);
@@ -243,7 +242,7 @@ public class AuctionListing implements IAuctionListing {
sellerName = compound.getString("SellerName");
if (compound.hasKey("Item")) {
item = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("Item"));
item = NoppesUtilServer.readItem(compound.getCompoundTag("Item"));
}
startingPrice = compound.getLong("StartingPrice");
@@ -45,7 +45,7 @@ public class DataScript implements IScriptHandlerPacket {
public String scriptLanguage = "ECMAScript";
private EntityNPCInterface npc;
public boolean enabled = false;
private long lastGlobalsVersion = -1;
private final Map<ScriptEngine, Long> engineGlobalsVersion = new IdentityHashMap<>();
public ICustomNpc dummyNpc;
public IWorld dummyWorld;
@@ -273,12 +273,13 @@ public class DataScript implements IScriptHandlerPacket {
}
long currentGlobalsVersion = NpcAPI.engineObjectsVersion;
if (lastGlobalsVersion != currentGlobalsVersion) {
Long lastVersion = engineGlobalsVersion.get(engine);
if (lastVersion == null || lastVersion != currentGlobalsVersion) {
engine.put("API", NpcAPI.Instance());
for (Map.Entry<String, Object> engineObjects : NpcAPI.engineObjects.entrySet()) {
engine.put(engineObjects.getKey(), engineObjects.getValue());
}
lastGlobalsVersion = currentGlobalsVersion;
engineGlobalsVersion.put(engine, currentGlobalsVersion);
}
}