Пример #1
0
 public ItemType CheckItem(ItemStack stack)
     throws InvocationTargetException, IllegalAccessException {
   int ItemID = stack.getTypeId();
   byte meta = stack.getData().getData();
   Object item = nmsResolver.getItemList().get(ItemID);
   ForgePermittor.log(item.toString(), true);
   if (item != null) {
     /*  if (this.getInformationManager().HasConnectableInferface(item))
     return ItemType.Connectable;*/
     if (this.getInformationManager().HasItemBlockContainerInterface(item))
       return ItemType.Container;
     if (this.getInformationManager().HasFoodInterface(item)) return ItemType.Food;
     if (this.getInformationManager().HasSwordInterface(item)) return ItemType.Weapon;
     if (this.getInformationManager().HasItemBlockInterface(item))
       return CheckItemBlock(item, ItemID, meta);
     if (this.getInformationManager().HasItemInterface(item)) {
       if (nmsResolver
           .getItemStackHandler()
           .HasTagCompound(nmsResolver.getCraftItemStackHandler().asNMSCopy(stack)))
         return ItemType.AdvItem;
       return ItemType.Item;
     }
   }
   return ItemType.Unknown;
 }
Пример #2
0
 private ItemType CheckItemBlock(Object item, int ItemID, byte meta)
     throws InvocationTargetException, IllegalAccessException {
   if (ItemID < nmsResolver.getBlockList().getLength()) {
     Object object = nmsResolver.getItemBlockHandler().getBlock(item);
     if (this.getInformationManager().HasContainerInterface(object)
         || nmsResolver.getBlockHandler().IsContainer(object, meta)) return ItemType.Container;
     else if (this.getInformationManager().HasBlockInterface(object)) {
       return ItemType.Block;
     }
   }
   return ItemType.Block;
 }
Пример #3
0
 public BlockType CheckBlock(Block block)
     throws InvocationTargetException, IllegalAccessException {
   if (block.getTypeId() < 4096 && block.getTypeId() != 0) {
     Object object = nmsResolver.getBlockList().get(block.getTypeId());
     ForgePermittor.log(object.getClass().toString(), true);
     // todo Test if this doesn't break something
     if (
     /*this.getInformationManager().HasContainerInterface(object) || */ nmsResolver
         .getCraftWorldHandler()
         .HasTileEntity(block))
       if (this.getInformationManager()
           .HasTradeBlockInterface(nmsResolver.getCraftWorldHandler().getTileEntityFrom(block)))
         return BlockType.Trade;
       else return BlockType.Container; // CheckConnectable(block);
     if (this.getInformationManager().HasBlockInterface(object)) return BlockType.Block;
   }
   return BlockType.Unknown;
 }