add spruce and jungle particles
fix additional leaf types not loading
@@ -7,6 +7,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
|
import mods.betterfoliage.BetterFoliage;
|
||||||
import mods.betterfoliage.client.TextureMatcher;
|
import mods.betterfoliage.client.TextureMatcher;
|
||||||
import mods.betterfoliage.client.render.IconSet;
|
import mods.betterfoliage.client.render.IconSet;
|
||||||
import mods.betterfoliage.client.resource.LeafTextureEnumerator.LeafTextureFoundEvent;
|
import mods.betterfoliage.client.resource.LeafTextureEnumerator.LeafTextureFoundEvent;
|
||||||
@@ -40,6 +41,8 @@ public class LeafParticleTextures {
|
|||||||
/** Default color value */
|
/** Default color value */
|
||||||
public int defaultColor = 0x208040;
|
public int defaultColor = 0x208040;
|
||||||
|
|
||||||
|
public int loadedSets;
|
||||||
|
|
||||||
public LeafParticleTextures(int defaultColor) {
|
public LeafParticleTextures(int defaultColor) {
|
||||||
this.defaultColor = defaultColor;
|
this.defaultColor = defaultColor;
|
||||||
}
|
}
|
||||||
@@ -56,16 +59,6 @@ public class LeafParticleTextures {
|
|||||||
return result == null ? defaultColor : result;
|
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.
|
/** Calculate average color value (in HSB color space) for a texture.
|
||||||
* @param icon texture
|
* @param icon texture
|
||||||
*/
|
*/
|
||||||
@@ -104,6 +97,7 @@ public class LeafParticleTextures {
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void handleTextureReload(TextureStitchEvent.Pre event) {
|
public void handleTextureReload(TextureStitchEvent.Pre event) {
|
||||||
if (event.map.getTextureType() != 0) return;
|
if (event.map.getTextureType() != 0) return;
|
||||||
|
loadedSets = 1;
|
||||||
iconSets.clear();
|
iconSets.clear();
|
||||||
iconColors.clear();
|
iconColors.clear();
|
||||||
|
|
||||||
@@ -113,9 +107,23 @@ public class LeafParticleTextures {
|
|||||||
defaultIcons.registerIcons(event.map);
|
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
|
@SubscribeEvent
|
||||||
public void handleRegisterTexture(LeafTextureFoundEvent event) {
|
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++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
// Vanilla
|
||||||
|
spruce=spruce
|
||||||
|
jungle=jungle
|
||||||
|
|
||||||
|
// Biomes O' Plenty
|
||||||
|
loftwood=jungle
|
||||||
|
fir=spruce
|
||||||
|
After Width: | Height: | Size: 286 B |
|
After Width: | Height: | Size: 265 B |
|
After Width: | Height: | Size: 274 B |
|
After Width: | Height: | Size: 278 B |
|
After Width: | Height: | Size: 255 B |
|
After Width: | Height: | Size: 244 B |
|
After Width: | Height: | Size: 231 B |
|
After Width: | Height: | Size: 236 B |