Caching textures for more efficiency

This commit is contained in:
GotoLink 2013-10-28 20:40:54 +01:00
commit e8c86a8c92
7 changed files with 33 additions and 25 deletions

View file

@ -14,22 +14,11 @@ import mysticworld.entity.EntityChargeEnergy;
import mysticworld.entity.EntityChargeFire;
import mysticworld.entity.EntityChargeWater;
import mysticworld.items.ItemHandler;
import mysticworld.renderer.BlockPillarInsertRenderer;
import mysticworld.renderer.ItemOrbAirRenderer;
import mysticworld.renderer.ItemOrbEarthRenderer;
import mysticworld.renderer.ItemOrbEnergyRenderer;
import mysticworld.renderer.ItemOrbFireRenderer;
import mysticworld.renderer.ItemOrbWaterRenderer;
import mysticworld.renderer.ItemStaffAirRenderer;
import mysticworld.renderer.ItemStaffEarthRenderer;
import mysticworld.renderer.ItemStaffEnergyRenderer;
import mysticworld.renderer.ItemStaffFireRenderer;
import mysticworld.renderer.ItemStaffWaterRenderer;
import mysticworld.renderer.RenderStaffPower;
import mysticworld.renderer.TileEntityPillarInsertRenderer;
import mysticworld.renderer.*;
import mysticworld.tiles.TileEntityPillarInsert;
import mysticworld.util.CommonProxy;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import cpw.mods.fml.client.registry.ClientRegistry;
@ -37,6 +26,7 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
public class ClientProxy extends CommonProxy {
public final Minecraft mc = Minecraft.getMinecraft();
public static final ResourceLocation particle = new ResourceLocation("textures/particle/particles.png");
@Override
public int addArmor(String armor) {

View file

@ -1,5 +1,6 @@
package mysticworld.client.fx;
import mysticworld.client.ClientProxy;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
@ -10,6 +11,8 @@ import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
public class LightCubeFX extends EntityFX {
public static final ResourceLocation lightFX = new ResourceLocation("mysticmods", "textures/misc/lightCubeFX.png");
public LightCubeFX(World world, double x, double y, double z) {
super(world, x, y, z);
}
@ -60,7 +63,7 @@ public class LightCubeFX extends EntityFX {
GL11.glDepthMask(false);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 1);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("MysticMods:textures" + "/misc/lightCubeFX.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(lightFX);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
float scale = 0.1F * this.particleScale;
float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX);
@ -77,7 +80,7 @@ public class LightCubeFX extends EntityFX {
GL11.glDisable(3042);
GL11.glDepthMask(true);
GL11.glPopMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("minecraft:textures" + "/particle/particles.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ClientProxy.particle);
tessellator.startDrawingQuads();
}
}

View file

@ -1,5 +1,6 @@
package mysticworld.client.fx;
import mysticworld.client.ClientProxy;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.MathHelper;
@ -11,6 +12,8 @@ import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
public class PowerAirFX extends EntityFX {
public static final ResourceLocation airFX = new ResourceLocation("mysticmods", "textures/misc/airFX.png");
public PowerAirFX(World world, double x, double y, double z) {
super(world, x, y, z);
}
@ -80,7 +83,7 @@ public class PowerAirFX extends EntityFX {
GL11.glDepthMask(false);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 1);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("MysticMods:textures" + "/misc/airFX.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(airFX);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
float scale = 0.1F * this.particleScale;
float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX);
@ -97,7 +100,7 @@ public class PowerAirFX extends EntityFX {
GL11.glDisable(3042);
GL11.glDepthMask(true);
GL11.glPopMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("minecraft:textures" + "/particle/particles.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ClientProxy.particle);
tessellator.startDrawingQuads();
}
}

View file

@ -1,5 +1,6 @@
package mysticworld.client.fx;
import mysticworld.client.ClientProxy;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
@ -10,6 +11,8 @@ import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
public class PowerEarthFX extends EntityFX {
public static final ResourceLocation earthFX = new ResourceLocation("mysticmods", "textures/misc/earthFX.png");
public PowerEarthFX(World world, double x, double y, double z) {
super(world, x, y, z);
}
@ -60,7 +63,7 @@ public class PowerEarthFX extends EntityFX {
GL11.glDepthMask(false);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 1);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("MysticMods:textures" + "/misc/earthFX.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(earthFX);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
float scale = 0.1F * this.particleScale;
float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX);
@ -77,7 +80,7 @@ public class PowerEarthFX extends EntityFX {
GL11.glDisable(3042);
GL11.glDepthMask(true);
GL11.glPopMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("minecraft:textures" + "/particle/particles.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ClientProxy.particle);
tessellator.startDrawingQuads();
}
}

View file

@ -1,5 +1,6 @@
package mysticworld.client.fx;
import mysticworld.client.ClientProxy;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
@ -10,6 +11,8 @@ import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
public class PowerEnergyFX extends EntityFX {
public static final ResourceLocation energyFX = new ResourceLocation("mysticmods", "textures/misc/energyFX.png");
public PowerEnergyFX(World world, double x, double y, double z) {
super(world, x, y, z);
}
@ -60,7 +63,7 @@ public class PowerEnergyFX extends EntityFX {
GL11.glDepthMask(false);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 1);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("MysticMods:textures" + "/misc/energyFX.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(energyFX);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
float scale = 0.1F * this.particleScale;
float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX);
@ -77,7 +80,7 @@ public class PowerEnergyFX extends EntityFX {
GL11.glDisable(3042);
GL11.glDepthMask(true);
GL11.glPopMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("minecraft:textures" + "/particle/particles.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ClientProxy.particle);
tessellator.startDrawingQuads();
}
}

View file

@ -1,5 +1,6 @@
package mysticworld.client.fx;
import mysticworld.client.ClientProxy;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
@ -10,6 +11,8 @@ import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
public class PowerFireFX extends EntityFX {
public static final ResourceLocation fireFX = new ResourceLocation("mysticmods", "textures/misc/fireFX.png");
public PowerFireFX(World world, double x, double y, double z) {
super(world, x, y, z);
}
@ -60,7 +63,7 @@ public class PowerFireFX extends EntityFX {
GL11.glDepthMask(false);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 1);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("MysticMods:textures" + "/misc/fireFX.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(fireFX);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
float scale = 0.1F * this.particleScale;
float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX);
@ -77,7 +80,7 @@ public class PowerFireFX extends EntityFX {
GL11.glDisable(3042);
GL11.glDepthMask(true);
GL11.glPopMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("minecraft:textures" + "/particle/particles.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ClientProxy.particle);
tessellator.startDrawingQuads();
}
}

View file

@ -1,5 +1,6 @@
package mysticworld.client.fx;
import mysticworld.client.ClientProxy;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
@ -10,6 +11,8 @@ import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
public class PowerWaterFX extends EntityFX {
public static final ResourceLocation waterFX = new ResourceLocation("mysticmods", "textures/misc/waterFX.png");
public PowerWaterFX(World world, double x, double y, double z) {
super(world, x, y, z);
}
@ -60,7 +63,7 @@ public class PowerWaterFX extends EntityFX {
GL11.glDepthMask(false);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 1);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("MysticMods:textures" + "/misc/waterFX.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(waterFX);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
float scale = 0.1F * this.particleScale;
float xPos = (float) (this.prevPosX + (this.posX - this.prevPosX) * par2 - interpPosX);
@ -77,7 +80,7 @@ public class PowerWaterFX extends EntityFX {
GL11.glDisable(3042);
GL11.glDepthMask(true);
GL11.glPopMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("minecraft:textures" + "/particle/particles.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ClientProxy.particle);
tessellator.startDrawingQuads();
}
}