mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 01:49:40 +00:00
Added handler support to NPC API.
This commit is contained in:
1 parent
69f96519dc
commit
d50f51e208
40 files changed
+1471
-56
No files matched your search
@@ -6,6 +6,7 @@ import io.netty.buffer.Unpooled;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -400,4 +401,31 @@ public class NoppesUtilPlayer {
|
||||
public static void isGUIOpen(EntityPlayerMP player){
|
||||
Server.sendData(player, EnumPacketClient.ISGUIOPEN);
|
||||
}
|
||||
|
||||
public static List<ItemStack> countStacks(IInventory inv, boolean ignoreDamage, boolean ignoreNBT) {
|
||||
List<ItemStack> list = new ArrayList();
|
||||
|
||||
for(int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||
ItemStack item = inv.getStackInSlot(i);
|
||||
if (!NoppesUtilServer.IsItemStackNull(item)) {
|
||||
boolean found = false;
|
||||
Iterator var7 = list.iterator();
|
||||
|
||||
while(var7.hasNext()) {
|
||||
ItemStack is = (ItemStack)var7.next();
|
||||
if (compareItems(item, is, ignoreDamage, ignoreNBT)) {
|
||||
is.stackSize = is.stackSize + item.stackSize;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
list.add(item.copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user