コード例 #1
0
  @Override
  public boolean executeBlock(int pMode, int px, int py, int pz) {
    if (!owner.isEqualTile()) {
      return false;
    }

    TileEntityFurnace ltile = (TileEntityFurnace) owner.maidTileEntity;
    ItemStack litemstack;
    boolean lflag = false;
    int li;

    if (owner.getSwingStatusDominant().canAttack()) {
      // 完成品回収
      litemstack = ltile.getStackInSlot(2);
      if (litemstack != null) {
        if (litemstack.stackSize > 0) {
          li = litemstack.stackSize;
          if (owner.maidInventory.addItemStackToInventory(litemstack)) {
            dropExpOrb(litemstack, li - litemstack.stackSize);
            owner.playSound("random.pop");
            owner.setSwing(5, LMM_EnumSound.cookingOver, false);
            //                    	if
            // (!pEntityLittleMaid.maidInventory.isItemBurned(pEntityLittleMaid.maidInventory.currentItem)) {
            owner.getNextEquipItem();
            //                    	}
            lflag = true;
          }
        }
        ltile.setInventorySlotContents(2, null);
      }

      // 調理可能品を竈にぽーい
      if (!lflag && ltile.getStackInSlot(0) == null) {
        litemstack = ltile.getStackInSlot(2);
        li = owner.maidInventory.getSmeltingItem();
        owner.setEquipItem(li);
        if (li > -1) {
          litemstack = owner.maidInventory.getStackInSlot(li);
          // レシピ対応品
          if (litemstack.stackSize >= ltile.getInventoryStackLimit()) {
            ltile.setInventorySlotContents(
                0, litemstack.splitStack(ltile.getInventoryStackLimit()));
          } else {
            ltile.setInventorySlotContents(0, litemstack.splitStack(litemstack.stackSize));
          }
          if (litemstack.stackSize <= 0) {
            owner.maidInventory.setInventorySlotContents(li, null);
          }
          owner.playSound("random.pop");
          owner.setSwing(5, LMM_EnumSound.cookingStart, false);
          lflag = true;
        }
      }

      // 手持ちの燃料をぽーい
      if (!lflag && ltile.getStackInSlot(1) == null && ltile.getStackInSlot(0) != null) {
        owner.getNextEquipItem();
        litemstack = owner.getCurrentEquippedItem();
        if (LMM_InventoryLittleMaid.isItemBurned(litemstack)) {
          if (litemstack.stackSize >= ltile.getInventoryStackLimit()) {
            ltile.setInventorySlotContents(
                1, litemstack.splitStack(ltile.getInventoryStackLimit()));
          } else {
            ltile.setInventorySlotContents(1, litemstack.splitStack(litemstack.stackSize));
          }
          if (litemstack.stackSize <= 0) {
            owner.maidInventory.setInventoryCurrentSlotContents(null);
          }
          owner.getNextEquipItem();
          owner.playSound("random.pop");
          owner.setSwing(5, LMM_EnumSound.addFuel, false);
          lflag = true;
        } else {
          if (ltile.isBurning()) {
            lflag = true;
          } else {
            // 燃やせるアイテムを持ってないので調理可能品を回収
            ItemStack litemstack2 = ltile.getStackInSlotOnClosing(0);
            if (owner.maidInventory.addItemStackToInventory(litemstack2)) {
              owner.playSound("random.pop");
              owner.setSwing(5, LMM_EnumSound.Null, false);
              owner.getNextEquipItem();
              lflag = false;
            } else {
              ltile.setInventorySlotContents(0, litemstack2);
            }
          }
        }
      }

      // 燃え終わってるのに燃料口に何かあるなら回収する
      if (!lflag && !ltile.isBurning() && ltile.getStackInSlot(1) != null) {
        ItemStack litemstack2 = ltile.getStackInSlotOnClosing(1);
        if (owner.maidInventory.addItemStackToInventory(litemstack2)) {
          owner.playSound("random.pop");
          owner.setSwing(5, LMM_EnumSound.Null, false);
          owner.getNextEquipItem();
          lflag = LMM_InventoryLittleMaid.isItemBurned(owner.getCurrentEquippedItem());
        } else {
          ltile.setInventorySlotContents(1, litemstack2);
        }
      }
    } else {
      lflag = true;
    }
    if (ltile.isBurning()) {
      owner.setWorking(true);
      owner.setSneaking(py - (int) owner.posY <= 0);
      lflag = true;
    }
    // mod_LMM_littleMaidMob.Debug("work" + lflag);
    return lflag;
  }
コード例 #2
0
 @Override
 public boolean checkItemStack(ItemStack pItemStack) {
   return LMM_InventoryLittleMaid.isItemBurned(pItemStack)
       || LMM_InventoryLittleMaid.isItemSmelting(pItemStack);
 }
コード例 #3
0
 @Override
 public boolean shouldBlock(int pMode) {
   return owner.maidTileEntity instanceof TileEntityFurnace
       && (((TileEntityFurnace) owner.maidTileEntity).isBurning()
           || LMM_InventoryLittleMaid.isItemBurned(owner.getCurrentEquippedItem()));
 }