add spruce and jungle particles

fix additional leaf types not loading
This commit is contained in:
octarine-noise
2014-08-28 22:47:52 +02:00
parent 5ad3bbe342
commit 4f7ede5d9e
10 changed files with 26 additions and 11 deletions

View File

@@ -7,6 +7,7 @@ import java.util.Map;
import javax.imageio.ImageIO;
import mods.betterfoliage.BetterFoliage;
import mods.betterfoliage.client.TextureMatcher;
import mods.betterfoliage.client.render.IconSet;
import mods.betterfoliage.client.resource.LeafTextureEnumerator.LeafTextureFoundEvent;
@@ -40,6 +41,8 @@ public class LeafParticleTextures {
/** Default color value */
public int defaultColor = 0x208040;
public int loadedSets;
public LeafParticleTextures(int defaultColor) {
this.defaultColor = defaultColor;
}
@@ -56,16 +59,6 @@ public class LeafParticleTextures {
return result == null ? defaultColor : result;
}
protected void addAtlasTexture(TextureAtlasSprite icon) {
Integer textureColor = calculateTextureColor(icon);
if (textureColor != null) iconColors.put(icon, textureColor);
String leafType = leafTypes.put(icon);
if (leafType != null && !iconSets.keySet().contains(leafType)) {
iconSets.put(leafType, new IconSet("betterfoliage", String.format("falling_leaf_%s_%%d", leafType)));
}
}
/** Calculate average color value (in HSB color space) for a texture.
* @param icon texture
*/
@@ -104,6 +97,7 @@ public class LeafParticleTextures {
@SubscribeEvent
public void handleTextureReload(TextureStitchEvent.Pre event) {
if (event.map.getTextureType() != 0) return;
loadedSets = 1;
iconSets.clear();
iconColors.clear();
@@ -113,9 +107,23 @@ public class LeafParticleTextures {
defaultIcons.registerIcons(event.map);
}
@SubscribeEvent
public void endTextureReload(TextureStitchEvent.Post event) {
if (event.map.getTextureType() == 0) BetterFoliage.log.info(String.format("Loaded %d leaf particle sets", loadedSets));
}
@SubscribeEvent
public void handleRegisterTexture(LeafTextureFoundEvent event) {
addAtlasTexture(event.icon);
Integer textureColor = calculateTextureColor(event.icon);
if (textureColor != null) iconColors.put(event.icon, textureColor);
String leafType = leafTypes.put(event.icon);
if (leafType != null && !iconSets.keySet().contains(leafType)) {
IconSet newSet = new IconSet("betterfoliage", String.format("falling_leaf_%s_%%d", leafType));
newSet.registerIcons(event.blockTextures);
iconSets.put(leafType, newSet);
loadedSets++;
}
}
}

View File

@@ -0,0 +1,7 @@
// Vanilla
spruce=spruce
jungle=jungle
// Biomes O' Plenty
loftwood=jungle
fir=spruce

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B