Examples of IAdvancedTool


Examples of thaumic.tinkerer.common.item.kami.tool.IAdvancedTool

    EntityPlayer player = (EntityPlayer) par3Entity;
    ItemStack currentStack = player.getCurrentEquippedItem();
    if (currentStack == null || !(currentStack.getItem() instanceof IAdvancedTool))
      return;
    IAdvancedTool tool = (IAdvancedTool) currentStack.getItem();

    if (tool.getType().equals("sword"))
      return;

    MovingObjectPosition pos = ToolHandler.raytraceFromEntity(par2World, par3Entity, true, 4.5F);
    String typeToFind = "";

    if (player.isSwingInProgress && pos != null) {
      Block block = par2World.getBlock(pos.blockX, pos.blockY, pos.blockZ);

      if (block != null) {
        Material mat = block.getMaterial();
        if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsPick))
          typeToFind = "pick";
        else if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsShovel))
          typeToFind = "shovel";
        else if (ToolHandler.isRightMaterial(mat, ToolHandler.materialsAxe))
          typeToFind = "axe";
      }
    }

    if (tool.getType().equals(typeToFind) || typeToFind.isEmpty())
      return;

    for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
      ItemStack stackInSlot = player.inventory.getStackInSlot(i);
      if (stackInSlot != null && stackInSlot.getItem() instanceof IAdvancedTool && stackInSlot != currentStack) {
        IAdvancedTool toolInSlot = (IAdvancedTool) stackInSlot.getItem();
        if (toolInSlot.getType().equals(typeToFind)) {
          player.inventory.setInventorySlotContents(player.inventory.currentItem, stackInSlot);
          player.inventory.setInventorySlotContents(i, currentStack);
          break;
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.