Fix Setting Item Stack to Null

This commit is contained in:
Kam committed 2024-04-04 18:20:19 -04:00
1 parent d4e0664f97
commit c8d62f0c72
1 file changed
+6 -1
@@ -1,6 +1,7 @@
package noppes.npcs.scripted.entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.api.IPos;
import noppes.npcs.api.ITimers;
@@ -617,7 +618,11 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
* @param item The item the drop list slot will be changed to
*/
public void setLootItem(int slot, IItemStack item) {
npc.inventory.setInventorySlotContents(slot+7, item.getMCItemStack());
if(item == null || item.getMCItemStack() == null){
npc.inventory.setInventorySlotContents(slot+7, (ItemStack) null);
} else {
npc.inventory.setInventorySlotContents(slot+7, item.getMCItemStack());
}
}
/**