New TextureStitchEvents called before and after a TextureMap gathers and stitches textures together.
Also added a config option to diable the writing of resulting stitched textures to disc. Default disables the writing.
This commit is contained in:
parent
a964725d46
commit
2395699afd
5 changed files with 91 additions and 4 deletions
|
@ -25,9 +25,11 @@ import net.minecraft.client.renderer.RenderEngine;
|
|||
import net.minecraft.client.renderer.RenderGlobal;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.client.event.TextureLoadEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.IArmorTextureProvider;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*;
|
||||
|
@ -220,6 +222,16 @@ public class ForgeHooksClient
|
|||
MinecraftForge.EVENT_BUS.post(new TextureLoadEvent(texture, pack));
|
||||
}
|
||||
|
||||
public static void onTextureStitchedPre(TextureMap map)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Pre(map));
|
||||
}
|
||||
|
||||
public static void onTextureStitchedPost(TextureMap map)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Post(map));
|
||||
}
|
||||
|
||||
/**
|
||||
* This is added for Optifine's convenience. And to explode if a ModMaker is developing.
|
||||
* @param texture
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
|
||||
public class TextureStitchEvent extends Event
|
||||
{
|
||||
public final TextureMap map;
|
||||
|
||||
public TextureStitchEvent(TextureMap map)
|
||||
{
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the TextureMap is told to refresh it's stitched texture.
|
||||
* Called after the Stitched list is cleared, but before any blocks or items
|
||||
* add themselves to the list.
|
||||
*/
|
||||
public static class Pre extends TextureStitchEvent
|
||||
{
|
||||
public Pre(TextureMap map){ super(map); }
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is fired once the texture map has loaded all textures and
|
||||
* stitched them together. All Icons should have there locations defined
|
||||
* by the time this is fired.
|
||||
*/
|
||||
public static class Post extends TextureStitchEvent
|
||||
{
|
||||
public Post(TextureMap map){ super(map); }
|
||||
}
|
||||
}
|
|
@ -130,3 +130,8 @@ public bdm.b(Lmp;)V #MD:WorldClient/func_72847_b #releaseEntitySkin
|
|||
#WorldServer
|
||||
public iz.b(Lmp;)V #MD:WorldServer/func_72847_b #releaseEntitySkin
|
||||
public iz.N #FD:WorldServer/field_73068_N #allPlayersSleeping
|
||||
#TextureMap
|
||||
public bil.a #TextureMap/field_94255_a
|
||||
public bil.b #TextureMap/field_94253_b
|
||||
public bil.c #TextureMap/field_94254_c
|
||||
public bil.d #TextureMap/field_94251_d
|
||||
|
|
|
@ -30,6 +30,7 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces
|
|||
public static boolean legacyFurnaceSides = false;
|
||||
public static boolean removeErroringEntities = false;
|
||||
public static boolean removeErroringTileEntities = false;
|
||||
public static boolean disableStitchedFileSaving = false;
|
||||
|
||||
public ForgeDummyContainer()
|
||||
{
|
||||
|
@ -105,6 +106,10 @@ public class ForgeDummyContainer extends DummyModContainer implements WorldAcces
|
|||
FMLLog.warning("Enableing removal of erroring Tile Entities USE AT YOUR OWN RISK");
|
||||
}
|
||||
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "disableStitchedFileSaving", true);
|
||||
prop.comment = "Set this to just disable the texture stitcher from writing the 'debug.stitched_{name}.png file to disc. Just a small performance tweak. Default: true";
|
||||
disableStitchedFileSaving = prop.getBoolean(true);
|
||||
|
||||
if (config.hasChanged())
|
||||
{
|
||||
config.save();
|
||||
|
|
|
@ -1,6 +1,23 @@
|
|||
--- ../src_base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java
|
||||
+++ ../src_work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java
|
||||
@@ -90,13 +90,22 @@
|
||||
@@ -20,6 +20,8 @@
|
||||
import net.minecraft.client.texturepacks.ITexturePack;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Icon;
|
||||
+import net.minecraftforge.client.ForgeHooksClient;
|
||||
+import net.minecraftforge.common.ForgeDummyContainer;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class TextureMap implements IconRegister
|
||||
@@ -47,6 +49,7 @@
|
||||
public void func_94247_b()
|
||||
{
|
||||
this.field_94256_j.clear();
|
||||
+ ForgeHooksClient.onTextureStitchedPre(this);
|
||||
int i;
|
||||
int j;
|
||||
|
||||
@@ -90,13 +93,22 @@
|
||||
StitchHolder stitchholder = new StitchHolder(texture);
|
||||
stitcher.func_94312_a(stitchholder);
|
||||
hashmap.put(stitchholder, Arrays.asList(new Texture[] {texture}));
|
||||
|
@ -30,7 +47,7 @@
|
|||
|
||||
if (!list.isEmpty())
|
||||
{
|
||||
@@ -116,7 +125,7 @@
|
||||
@@ -116,7 +128,7 @@
|
||||
}
|
||||
|
||||
this.field_94257_h = stitcher.func_94306_e();
|
||||
|
@ -39,7 +56,7 @@
|
|||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
@@ -150,7 +159,17 @@
|
||||
@@ -150,7 +162,17 @@
|
||||
if (list1.size() > 1)
|
||||
{
|
||||
this.field_94258_i.add(texturestitched);
|
||||
|
@ -58,7 +75,20 @@
|
|||
ITexturePack itexturepack = Minecraft.getMinecraft().texturePackList.getSelectedTexturePack();
|
||||
boolean flag1 = !itexturepack.func_98138_b("/" + this.field_94254_c + s2 + ".png", false);
|
||||
|
||||
@@ -218,4 +237,37 @@
|
||||
@@ -176,7 +198,11 @@
|
||||
texturestitched1.func_94217_a(this.field_94250_g);
|
||||
}
|
||||
|
||||
- this.field_94257_h.func_94279_c("debug.stitched_" + this.field_94253_b + ".png");
|
||||
+ if (!ForgeDummyContainer.disableStitchedFileSaving)
|
||||
+ {
|
||||
+ this.field_94257_h.func_94279_c("debug.stitched_" + this.field_94253_b + ".png");
|
||||
+ }
|
||||
+ ForgeHooksClient.onTextureStitchedPost(this);
|
||||
this.field_94257_h.func_94285_g();
|
||||
}
|
||||
|
||||
@@ -218,4 +244,37 @@
|
||||
{
|
||||
return this.field_94250_g;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue