コード例 #1
0
  public void setBoundsOnBlock(Block block) {
    if (haveBlockBounds) {
      block.setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);
      return;
    }
    if (hasSkin()) {
      Skin skin = null;
      if (worldObj.isRemote) {
        skin = getSkinClient(skinPointer);
      } else {
        skin = getSkinServer(skinPointer);
      }

      if (skin != null) {
        float scale = 0.0625F;
        SkinPart skinPart = skin.getParts().get(0);
        Rectangle3D rec = skinPart.getPartBounds();
        IRectangle3D buildSpace = skinPart.getPartType().getBuildingSpace();

        int x = buildSpace.getX() + buildSpace.getWidth() + rec.getX();
        int y = buildSpace.getY() + buildSpace.getHeight() - rec.getY() - rec.getHeight();
        int z = buildSpace.getZ() + buildSpace.getDepth() - rec.getZ() - rec.getDepth();
        minX = x * scale;
        minY = y * scale;
        minZ = z * scale;
        maxX = (x + rec.getWidth()) * scale;
        maxY = (y + rec.getHeight()) * scale;
        maxZ = (z + rec.getDepth()) * scale;
        rotateBlockBounds();
        haveBlockBounds = true;
        block.setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);
        return;
      }
    }
    block.setBlockBounds(0F, 0F, 0F, 1F, 1F, 1F);
  }
コード例 #2
0
  public static void addTooltipToSkinItem(
      ItemStack stack, EntityPlayer player, List tooltip, boolean showAdvancedItemTooltips) {
    String cRed = EnumChatFormatting.RED.toString();

    boolean isEquipmentSkin = stack.getItem() == ModItems.equipmentSkin;
    boolean isEquipmentContainer = stack.getItem() instanceof AbstractModItemArmour;

    if (EquipmentNBTHelper.stackHasSkinData(stack)) {
      SkinPointer skinData = EquipmentNBTHelper.getSkinPointerFromStack(stack);

      if (!isEquipmentSkin & !skinData.lockSkin & !isEquipmentContainer) {
        return;
      }

      if (!isEquipmentSkin) {
        tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.hasSkin"));
      }

      if (ClientModelCache.INSTANCE.isEquipmentInCache(skinData.skinId)) {
        Skin data = ClientModelCache.INSTANCE.getEquipmentItemData(skinData.skinId);
        if (!data.getCustomName().trim().isEmpty()) {
          tooltip.add(
              TranslateUtils.translate(
                  "item.armourersworkshop:rollover.skinName", data.getCustomName()));
        }
        if (!data.getAuthorName().trim().isEmpty()) {
          tooltip.add(
              TranslateUtils.translate(
                  "item.armourersworkshop:rollover.skinAuthor", data.getAuthorName()));
        }

        if (ConfigHandler.showSkinTooltipDebugInfo) {
          if (GuiScreen.isShiftKeyDown()) {
            if (skinData.skinType != null) {
              String localSkinName =
                  SkinTypeRegistry.INSTANCE.getLocalizedSkinTypeName(skinData.skinType);
              tooltip.add(
                  TranslateUtils.translate(
                      "item.armourersworkshop:rollover.skinType", localSkinName));
            }
            tooltip.add(
                TranslateUtils.translate(
                    "item.armourersworkshop:rollover.skinId", skinData.skinId));
            tooltip.add(
                TranslateUtils.translate(
                    "item.armourersworkshop:rollover.skinTotalCubes", data.getTotalCubes()));
            tooltip.add(
                TranslateUtils.translate(
                    "item.armourersworkshop:rollover.skinNumCubes",
                    data.getTotalOfCubeType(Cube.class)));
            tooltip.add(
                TranslateUtils.translate(
                    "item.armourersworkshop:rollover.skinNumCubesGlowing",
                    data.getTotalOfCubeType(CubeGlowing.class)));
            tooltip.add(
                TranslateUtils.translate(
                    "item.armourersworkshop:rollover.skinNumCubesGlass",
                    data.getTotalOfCubeType(CubeGlass.class)));
            tooltip.add(
                TranslateUtils.translate(
                    "item.armourersworkshop:rollover.skinNumCubesGlassGlowing",
                    data.getTotalOfCubeType(CubeGlassGlowing.class)));
            tooltip.add(
                TranslateUtils.translate(
                    "item.armourersworkshop:rollover.skinPaintData", data.hasPaintData()));
            tooltip.add(
                TranslateUtils.translate(
                    "item.armourersworkshop:rollover.skinMarkerCount", data.getMarkerCount()));
          } else {
            tooltip.add(
                TranslateUtils.translate("item.armourersworkshop:rollover.skinHoldShiftForInfo"));
          }
        }

        if (skinData.skinId != data.lightHash()) {
          tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinIdError1"));
          tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinIdError2"));
          tooltip.add(
              TranslateUtils.translate(
                  "item.armourersworkshop:rollover.skinIdError3",
                  data.requestId,
                  data.lightHash()));
        }
      } else {
        tooltip.add(
            TranslateUtils.translate(
                "item.armourersworkshop:rollover.skindownloading", skinData.skinId));
      }
      String keyName = Keyboard.getKeyName(Keybindings.openCustomArmourGui.getKeyCode());
      if (isEquipmentSkin) {
        tooltip.add(
            TranslateUtils.translate("item.armourersworkshop:rollover.skinOpenWardrobe", keyName));
      }
    } else {
      if (EquipmentNBTHelper.stackHasLegacySkinData(stack)) {
        tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinOldType"));
      } else {
        if (isEquipmentSkin) {
          tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinInvalidItem"));
        }
      }
    }
  }