Exemplo n.º 1
0
 // Don't call this method, for future use.
 protected Texture getTextureFromItemStack(ItemStack itemStack) {
   BlockDesign design = null;
   Texture texture = null;
   org.spoutcraft.api.material.CustomItem item =
       MaterialData.getCustomItem(itemStack.getItemDamage());
   if (item != null) {
     String textureURI = item.getTexture();
     if (textureURI == null) {
       org.spoutcraft.api.material.CustomBlock block =
           MaterialData.getCustomBlock(itemStack.getItemDamage());
       design = block != null ? block.getBlockDesign() : null;
       textureURI = design != null ? design.getTextureURL() : null;
     }
     if (textureURI != null) {
       texture = CustomTextureManager.getTextureFromUrl(item.getAddon(), textureURI);
     }
   }
   return texture;
 }
Exemplo n.º 2
0
  // Don't call this method, for future use.
  protected Texture getTextureFromCoords(World world, int x, int y, int z) {
    short customId = 0;
    Texture texture = null;
    if (SpoutClient.getInstance().getRawWorld() != null) {
      SpoutcraftChunk sChunk =
          Spoutcraft.getChunkAt(SpoutClient.getInstance().getRawWorld(), x, y, z);
      customId = sChunk.getCustomBlockId(x, y, z);
      short[] customBlockIds = sChunk.getCustomBlockIds();
      byte[] customBlockData = sChunk.getCustomBlockData();

      if (customId > 0) {
        CustomBlock block = MaterialData.getCustomBlock(customId);
        if (block != null) {
          BlockDesign design = block.getBlockDesign(customBlockData[customId]);
          if (design != null) {
            texture = getTextureFromUrl(block.getAddon(), design.getTextureURL());
          }
        }
      }
    }
    return texture;
  }