コード例 #1
0
 public static void setup(TextureAtlasSprite icon) {
   if (!fboSupported) {
     return;
   }
   String name = IconAPI.getIconName(icon).replaceFirst("^minecraft:items/", "");
   if (icon instanceof TextureClock && name.equals("compass")) { // 1.5 bug
     name = "clock";
   }
   if ("compass".equals(name)) {
     if (!enableCompass) {
       return;
     }
   } else if ("clock".equals(name)) {
     if (!enableClock) {
       return;
     }
   } else {
     logger.warning("ignoring custom animation for %s not compass or clock", name);
     return;
   }
   ResourceLocation resource =
       TexturePackAPI.newMCPatcherResourceLocation(
           "/misc/" + name + ".properties", "dial/" + name + ".properties");
   if (TexturePackAPI.hasResource(resource)) {
     logger.fine("found custom %s (%s)", name, resource);
     setupInfo.put(icon, resource);
     active = true;
   }
 }
コード例 #2
0
 Layer newLayer(PropertiesFile properties, String suffix) {
   ResourceLocation textureResource = properties.getResourceLocation("source" + suffix, "");
   if (textureResource == null) {
     return null;
   }
   if (!TexturePackAPI.hasResource(textureResource)) {
     properties.error("could not read %s", textureResource);
     return null;
   }
   float scaleX = properties.getFloat("scaleX" + suffix, 1.0f);
   float scaleY = properties.getFloat("scaleY" + suffix, 1.0f);
   float offsetX = properties.getFloat("offsetX" + suffix, 0.0f);
   float offsetY = properties.getFloat("offsetY" + suffix, 0.0f);
   float angleMultiplier = properties.getFloat("rotationSpeed" + suffix, 0.0f);
   float angleOffset = properties.getFloat("rotationOffset" + suffix, 0.0f);
   String blend = properties.getString("blend" + suffix, "alpha");
   BlendMethod blendMethod = BlendMethod.parse(blend);
   if (blendMethod == null) {
     properties.error("unknown blend method %s", blend);
     return null;
   }
   boolean debug = properties.getBoolean("debug" + suffix, false);
   return new Layer(
       textureResource,
       scaleX,
       scaleY,
       offsetX,
       offsetY,
       angleMultiplier,
       angleOffset,
       blendMethod,
       debug);
 }