A couple of packaging tweaks, clean up more junk. It may come back but for now it's gone
This commit is contained in:
parent
cad228093d
commit
59af780c91
11 changed files with 47 additions and 770 deletions
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
* The FML Forge Mod Loader suite.
|
||||
* Copyright (C) 2012 cpw
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.client;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.minecraft.client.renderer.RenderEngine;
|
||||
import net.minecraft.client.renderer.texturefx.TextureFX;
|
||||
import net.minecraft.client.texturepacks.ITexturePack;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
public class FMLTextureFX extends TextureFX implements ITextureFX
|
||||
{
|
||||
public int tileSizeBase = 16;
|
||||
public int tileSizeSquare = 256;
|
||||
public int tileSizeMask = 15;
|
||||
public int tileSizeSquareMask = 255;
|
||||
public boolean errored = false;
|
||||
protected Logger log = FMLLog.getLogger();
|
||||
|
||||
public FMLTextureFX(int icon)
|
||||
{
|
||||
super(icon);
|
||||
}
|
||||
|
||||
@Override public void setErrored(boolean err){ errored = err; }
|
||||
@Override public boolean getErrored(){ return errored; }
|
||||
@Override
|
||||
public void onTexturePackChanged(RenderEngine engine, ITexturePack texturepack, Dimension dimensions)
|
||||
{
|
||||
onTextureDimensionsUpdate(dimensions.width, dimensions.height);
|
||||
}
|
||||
@Override
|
||||
public void onTextureDimensionsUpdate(int width, int height)
|
||||
{
|
||||
tileSizeBase = width >> 4;
|
||||
tileSizeSquare = tileSizeBase * tileSizeBase;
|
||||
tileSizeMask = tileSizeBase - 1;
|
||||
tileSizeSquareMask = tileSizeSquare - 1;
|
||||
setErrored(false);
|
||||
setup();
|
||||
}
|
||||
|
||||
protected void setup()
|
||||
{
|
||||
field_76852_a = new byte[tileSizeSquare << 2];
|
||||
}
|
||||
|
||||
public boolean unregister(RenderEngine engine, List<TextureFX> effects)
|
||||
{
|
||||
effects.remove(this);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* The FML Forge Mod Loader suite.
|
||||
* Copyright (C) 2012 cpw
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package cpw.mods.fml.client;
|
||||
|
||||
import net.minecraft.client.renderer.texturefx.TextureFX;
|
||||
|
||||
class OverrideInfo
|
||||
{
|
||||
public String texture;
|
||||
public String override;
|
||||
public int index;
|
||||
public int imageIndex;
|
||||
public TextureFX textureFX;
|
||||
public boolean added;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
try {
|
||||
OverrideInfo inf=(OverrideInfo) obj;
|
||||
return index==inf.index && imageIndex==inf.imageIndex;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return index+imageIndex;
|
||||
}
|
||||
}
|
|
@ -1,302 +1,24 @@
|
|||
package cpw.mods.fml.client;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
|
||||
import static org.lwjgl.opengl.GL11.GL_TEXTURE_BINDING_2D;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderEngine;
|
||||
import net.minecraft.client.renderer.texturefx.TextureFX;
|
||||
import net.minecraft.client.texturepacks.ITexturePack;
|
||||
import net.minecraft.src.ModTextureStatic;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
|
||||
public class TextureFXManager
|
||||
{
|
||||
private static final TextureFXManager INSTANCE = new TextureFXManager();
|
||||
|
||||
private class TextureProperties
|
||||
{
|
||||
private int textureId;
|
||||
private Dimension dim;
|
||||
}
|
||||
|
||||
private Map<Integer,TextureProperties> textureProperties = Maps.newHashMap();
|
||||
private Multimap<String, OverrideInfo> overrideInfo = ArrayListMultimap.create();
|
||||
private HashSet<OverrideInfo> animationSet = new HashSet<OverrideInfo>();
|
||||
|
||||
private List<TextureFX> addedTextureFX = new ArrayList<TextureFX>();
|
||||
|
||||
private Minecraft client;
|
||||
|
||||
void setClient(Minecraft client)
|
||||
{
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
public boolean onUpdateTextureEffect(TextureFX effect)
|
||||
{
|
||||
ITextureFX ifx = (effect instanceof ITextureFX ? ((ITextureFX)effect) : null);
|
||||
|
||||
if (ifx != null && ifx.getErrored())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
String name = effect.getClass().getSimpleName();
|
||||
client.field_71424_I.func_76320_a(name);
|
||||
try
|
||||
{
|
||||
if (!FMLClientHandler.instance().hasOptifine())
|
||||
{
|
||||
effect.func_76846_a();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.warning("Texture FX %s has failed to animate. Likely caused by a texture pack change that they did not respond correctly to", name);
|
||||
if (ifx != null)
|
||||
{
|
||||
ifx.setErrored(true);
|
||||
}
|
||||
client.field_71424_I.func_76319_b();
|
||||
return false;
|
||||
}
|
||||
client.field_71424_I.func_76319_b();
|
||||
|
||||
if (ifx != null)
|
||||
{
|
||||
Dimension dim = getTextureDimensions(effect);
|
||||
int target = ((dim.width >> 4) * (dim.height >> 4)) << 2;
|
||||
if (effect.field_76852_a.length != target)
|
||||
{
|
||||
FMLLog.warning("Detected a texture FX sizing discrepancy in %s (%d, %d)", name, effect.field_76852_a.length, target);
|
||||
ifx.setErrored(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//Quick and dirty image scaling, no smoothing or fanciness, meant for speed as it will be called every tick.
|
||||
public void scaleTextureFXData(byte[] data, ByteBuffer buf, int target, int length)
|
||||
{
|
||||
int sWidth = (int)Math.sqrt(data.length / 4);
|
||||
int factor = target / sWidth;
|
||||
byte[] tmp = new byte[4];
|
||||
|
||||
buf.clear();
|
||||
|
||||
if (factor > 1)
|
||||
{
|
||||
for (int y = 0; y < sWidth; y++)
|
||||
{
|
||||
int sRowOff = sWidth * y;
|
||||
int tRowOff = target * y * factor;
|
||||
for (int x = 0; x < sWidth; x++)
|
||||
{
|
||||
int sPos = (x + sRowOff) * 4;
|
||||
tmp[0] = data[sPos + 0];
|
||||
tmp[1] = data[sPos + 1];
|
||||
tmp[2] = data[sPos + 2];
|
||||
tmp[3] = data[sPos + 3];
|
||||
|
||||
int tPosTop = (x * factor) + tRowOff;
|
||||
for (int y2 = 0; y2 < factor; y2++)
|
||||
{
|
||||
buf.position((tPosTop + (y2 * target)) * 4);
|
||||
for (int x2 = 0; x2 < factor; x2++)
|
||||
{
|
||||
buf.put(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buf.position(0).limit(length);
|
||||
}
|
||||
|
||||
public void onPreRegisterEffect(TextureFX effect)
|
||||
{
|
||||
Dimension dim = getTextureDimensions(effect);
|
||||
if (effect instanceof ITextureFX)
|
||||
{
|
||||
((ITextureFX)effect).onTextureDimensionsUpdate(dim.width, dim.height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getEffectTexture(TextureFX effect)
|
||||
{
|
||||
Integer id = effectTextures.get(effect);
|
||||
if (id != null)
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
int old = GL11.glGetInteger(GL_TEXTURE_BINDING_2D);
|
||||
effect.func_76845_a(client.field_71446_o);
|
||||
id = GL11.glGetInteger(GL_TEXTURE_BINDING_2D);
|
||||
GL11.glBindTexture(GL_TEXTURE_2D, old);
|
||||
effectTextures.put(effect, id);
|
||||
effect.field_76848_d = id;
|
||||
return id;
|
||||
}
|
||||
|
||||
public void onTexturePackChange(RenderEngine engine, ITexturePack texturepack, List<TextureFX> effects)
|
||||
{
|
||||
pruneOldTextureFX(texturepack, effects);
|
||||
|
||||
for (TextureFX tex : effects)
|
||||
{
|
||||
if (tex instanceof ITextureFX)
|
||||
{
|
||||
((ITextureFX)tex).onTexturePackChanged(engine, texturepack, getTextureDimensions(tex));
|
||||
}
|
||||
}
|
||||
|
||||
loadTextures(texturepack);
|
||||
}
|
||||
|
||||
private HashMap<Integer, Dimension> textureDims = new HashMap<Integer, Dimension>();
|
||||
private IdentityHashMap<TextureFX, Integer> effectTextures = new IdentityHashMap<TextureFX, Integer>();
|
||||
private ITexturePack earlyTexturePack;
|
||||
public void setTextureDimensions(int id, int width, int height, List<TextureFX> effects)
|
||||
{
|
||||
Dimension dim = new Dimension(width, height);
|
||||
textureDims.put(id, dim);
|
||||
|
||||
for (TextureFX tex : effects)
|
||||
{
|
||||
if (getEffectTexture(tex) == id && tex instanceof ITextureFX)
|
||||
{
|
||||
((ITextureFX)tex).onTextureDimensionsUpdate(width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Dimension getTextureDimensions(TextureFX effect)
|
||||
{
|
||||
return getTextureDimensions(getEffectTexture(effect));
|
||||
}
|
||||
|
||||
public Dimension getTextureDimensions(int id)
|
||||
{
|
||||
return textureDims.get(id);
|
||||
}
|
||||
|
||||
public void addAnimation(TextureFX anim)
|
||||
{
|
||||
OverrideInfo info=new OverrideInfo();
|
||||
info.index=anim.field_76850_b;
|
||||
info.imageIndex=anim.field_76847_f;
|
||||
info.textureFX=anim;
|
||||
if (animationSet.contains(info)) {
|
||||
animationSet.remove(info);
|
||||
}
|
||||
animationSet.add(info);
|
||||
}
|
||||
|
||||
|
||||
public void loadTextures(ITexturePack texturePack)
|
||||
{
|
||||
registerTextureOverrides(client.field_71446_o);
|
||||
}
|
||||
|
||||
|
||||
public void registerTextureOverrides(RenderEngine renderer) {
|
||||
for (OverrideInfo animationOverride : animationSet) {
|
||||
renderer.func_78355_a(animationOverride.textureFX);
|
||||
addedTextureFX.add(animationOverride.textureFX);
|
||||
FMLCommonHandler.instance().getFMLLogger().finer(String.format("Registered texture override %d (%d) on %s (%d)", animationOverride.index, animationOverride.textureFX.field_76850_b, animationOverride.textureFX.getClass().getSimpleName(), animationOverride.textureFX.field_76847_f));
|
||||
}
|
||||
|
||||
for (String fileToOverride : overrideInfo.keySet()) {
|
||||
for (OverrideInfo override : overrideInfo.get(fileToOverride)) {
|
||||
try
|
||||
{
|
||||
BufferedImage image=loadImageFromTexturePack(renderer, override.override);
|
||||
ModTextureStatic mts=new ModTextureStatic(override.index, 1, override.texture, image);
|
||||
renderer.func_78355_a(mts);
|
||||
addedTextureFX.add(mts);
|
||||
FMLCommonHandler.instance().getFMLLogger().finer(String.format("Registered texture override %d (%d) on %s (%d)", override.index, mts.field_76850_b, override.texture, mts.field_76847_f));
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
FMLCommonHandler.instance().getFMLLogger().throwing("FMLClientHandler", "registerTextureOverrides", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void registerAnimatedTexturesFor(ModContainer mod)
|
||||
{
|
||||
}
|
||||
|
||||
public void onEarlyTexturePackLoad(ITexturePack fallback)
|
||||
{
|
||||
if (client==null) {
|
||||
// We're far too early- let's wait
|
||||
this.earlyTexturePack = fallback;
|
||||
} else {
|
||||
loadTextures(fallback);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void pruneOldTextureFX(ITexturePack var1, List<TextureFX> effects)
|
||||
{
|
||||
ListIterator<TextureFX> li = addedTextureFX.listIterator();
|
||||
while (li.hasNext())
|
||||
{
|
||||
TextureFX tex = li.next();
|
||||
if (tex instanceof FMLTextureFX)
|
||||
{
|
||||
if (((FMLTextureFX)tex).unregister(client.field_71446_o, effects))
|
||||
{
|
||||
li.remove();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
effects.remove(tex);
|
||||
li.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
public void addNewTextureOverride(String textureToOverride, String overridingTexturePath, int location) {
|
||||
OverrideInfo info = new OverrideInfo();
|
||||
info.index = location;
|
||||
info.override = overridingTexturePath;
|
||||
info.texture = textureToOverride;
|
||||
overrideInfo.put(textureToOverride, info);
|
||||
FMLLog.fine("Overriding %s @ %d with %s. %d slots remaining",textureToOverride, location, overridingTexturePath, SpriteHelper.freeSlotCount(textureToOverride));
|
||||
}
|
||||
|
||||
public BufferedImage loadImageFromTexturePack(RenderEngine renderEngine, String path) throws IOException
|
||||
{
|
||||
InputStream image=client.field_71418_C.func_77292_e().func_77532_a(path);
|
||||
|
|
|
@ -106,7 +106,7 @@ public class RenderingRegistry
|
|||
*/
|
||||
public static void addTextureOverride(String path, String overlayPath, int index)
|
||||
{
|
||||
TextureFXManager.instance().addNewTextureOverride(path, overlayPath, index);
|
||||
// TextureFXManager.instance().addNewTextureOverride(path, overlayPath, index);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,6 @@ import net.minecraft.client.multiplayer.NetClientHandler;
|
|||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.RenderEngine;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.texturefx.TextureFX;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.command.ICommand;
|
||||
|
@ -120,12 +119,6 @@ public class ModLoader
|
|||
{
|
||||
}
|
||||
|
||||
@SideOnly(CLIENT)
|
||||
public static void addAnimation(TextureFX anim)
|
||||
{
|
||||
TextureFXManager.instance().addAnimation(anim);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new prefix to the armor texture list
|
||||
*
|
||||
|
|
|
@ -1,141 +0,0 @@
|
|||
/*
|
||||
* The FML Forge Mod Loader suite.
|
||||
* Copyright (C) 2012 cpw
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ImageObserver;
|
||||
|
||||
import net.minecraft.client.renderer.RenderEngine;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.FMLTextureFX;
|
||||
|
||||
/**
|
||||
* A texture override for animations, it takes a vertical image of
|
||||
* texture frames and constantly rotates them in the texture.
|
||||
*/
|
||||
public class ModTextureAnimation extends FMLTextureFX
|
||||
{
|
||||
private final int tickRate;
|
||||
private byte[][] images;
|
||||
private int index = 0;
|
||||
private int ticks = 0;
|
||||
|
||||
private String targetTex = null;
|
||||
private BufferedImage imgData = null;
|
||||
|
||||
public ModTextureAnimation(int icon, int target, BufferedImage image, int tickCount)
|
||||
{
|
||||
this(icon, 1, target, image, tickCount);
|
||||
}
|
||||
|
||||
public ModTextureAnimation(int icon, int size, int target, BufferedImage image, int tickCount)
|
||||
{
|
||||
this(icon, size, (target == 0 ? "/terrain.png" : "/gui/items.png"), image, tickCount);
|
||||
}
|
||||
|
||||
public ModTextureAnimation(int icon, int size, String target, BufferedImage image, int tickCount)
|
||||
{
|
||||
super(icon);
|
||||
RenderEngine re = FMLClientHandler.instance().getClient().field_71446_o;
|
||||
|
||||
targetTex = target;
|
||||
field_76849_e = size;
|
||||
field_76847_f = re.func_78341_b(target);
|
||||
|
||||
tickRate = tickCount;
|
||||
ticks = tickCount;
|
||||
imgData = image;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup()
|
||||
{
|
||||
super.setup();
|
||||
|
||||
int sWidth = imgData.getWidth();
|
||||
int sHeight = imgData.getHeight();
|
||||
int tWidth = tileSizeBase;
|
||||
int tHeight = tileSizeBase;
|
||||
|
||||
|
||||
int frames = (int)Math.floor((double)(sHeight / sWidth));
|
||||
|
||||
if (frames < 1)
|
||||
{
|
||||
throw new IllegalArgumentException(String.format("Attempted to create a TextureAnimation with no complete frames: %dx%d", sWidth, sHeight));
|
||||
}
|
||||
else
|
||||
{
|
||||
images = new byte[frames][];
|
||||
BufferedImage image = imgData;
|
||||
|
||||
if (sWidth != tWidth)
|
||||
{
|
||||
BufferedImage b = new BufferedImage(tWidth, tHeight * frames, 6);
|
||||
Graphics2D g = b.createGraphics();
|
||||
g.drawImage(imgData, 0, 0, tWidth, tHeight * frames, 0, 0, sWidth, sHeight, (ImageObserver)null);
|
||||
g.dispose();
|
||||
image = b;
|
||||
}
|
||||
|
||||
for (int frame = 0; frame < frames; frame++)
|
||||
{
|
||||
int[] pixels = new int[tileSizeSquare];
|
||||
image.getRGB(0, tHeight * frame, tWidth, tHeight, pixels, 0, tWidth);
|
||||
images[frame] = new byte[tileSizeSquare << 2];
|
||||
|
||||
for (int i = 0; i < pixels.length; i++)
|
||||
{
|
||||
int i4 = i * 4;
|
||||
images[frame][i4 + 0] = (byte)(pixels[i] >> 16 & 255);
|
||||
images[frame][i4 + 1] = (byte)(pixels[i] >> 8 & 255);
|
||||
images[frame][i4 + 2] = (byte)(pixels[i] >> 0 & 255);
|
||||
images[frame][i4 + 3] = (byte)(pixels[i] >> 24 & 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void func_76846_a()
|
||||
{
|
||||
if (++ticks >= tickRate)
|
||||
{
|
||||
if (++index >= images.length)
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
|
||||
field_76852_a = images[index];
|
||||
ticks = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void func_76845_a(RenderEngine renderEngine)
|
||||
{
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, field_76847_f);
|
||||
}
|
||||
|
||||
// TODO: REMOVE THIS - just for you dan200
|
||||
@Deprecated
|
||||
public void func_783_a()
|
||||
{
|
||||
func_76846_a();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,183 +0,0 @@
|
|||
/*
|
||||
* The FML Forge Mod Loader suite.
|
||||
* Copyright (C) 2012 cpw
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ImageObserver;
|
||||
|
||||
import net.minecraft.client.renderer.RenderEngine;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.client.FMLTextureFX;
|
||||
|
||||
public class ModTextureStatic extends FMLTextureFX
|
||||
{
|
||||
private boolean oldanaglyph = false;
|
||||
private int[] pixels = null;
|
||||
private String targetTex = null;
|
||||
private int storedSize;
|
||||
private BufferedImage overrideData = null;
|
||||
private int needApply = 10;
|
||||
|
||||
|
||||
public ModTextureStatic(int icon, int target, BufferedImage image)
|
||||
{
|
||||
this(icon, 1, target, image);
|
||||
}
|
||||
|
||||
public ModTextureStatic(int icon, int size, int target, BufferedImage image)
|
||||
{
|
||||
this(icon, size, (target == 0 ? "/terrain.png" : "/gui/items.png"), image);
|
||||
}
|
||||
|
||||
public ModTextureStatic(int icon, int size, String target, BufferedImage image)
|
||||
{
|
||||
super(icon);
|
||||
RenderEngine re = FMLClientHandler.instance().getClient().field_71446_o;
|
||||
|
||||
targetTex = target;
|
||||
storedSize = size;
|
||||
field_76849_e = size;
|
||||
field_76847_f = re.func_78341_b(target);
|
||||
overrideData = image;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup()
|
||||
{
|
||||
super.setup();
|
||||
int sWidth = overrideData.getWidth();
|
||||
int sHeight = overrideData.getHeight();
|
||||
|
||||
pixels = new int[tileSizeSquare];
|
||||
if (tileSizeBase == sWidth && tileSizeBase == sHeight)
|
||||
{
|
||||
overrideData.getRGB(0, 0, sWidth, sHeight, pixels, 0, sWidth);
|
||||
}
|
||||
else
|
||||
{
|
||||
BufferedImage tmp = new BufferedImage(tileSizeBase, tileSizeBase, 6);
|
||||
Graphics2D gfx = tmp.createGraphics();
|
||||
gfx.drawImage(overrideData, 0, 0, tileSizeBase, tileSizeBase, 0, 0, sWidth, sHeight, (ImageObserver)null);
|
||||
tmp.getRGB(0, 0, tileSizeBase, tileSizeBase, pixels, 0, tileSizeBase);
|
||||
gfx.dispose();
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_76846_a()
|
||||
{
|
||||
if (oldanaglyph != field_76851_c)
|
||||
{
|
||||
update();
|
||||
}
|
||||
// This makes it so we only apply the texture to the target texture when we need to,
|
||||
//due to the fact that update is called when the Effect is first registered, we actually
|
||||
//need to wait for the next one.
|
||||
field_76849_e = (needApply == 0 ? 0 : storedSize);
|
||||
if (needApply > 0)
|
||||
{
|
||||
needApply--;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_76845_a(RenderEngine p_76845_1_)
|
||||
{
|
||||
GL11.glBindTexture(GL_TEXTURE_2D, p_76845_1_.func_78341_b(targetTex));
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
needApply = 10;
|
||||
for (int idx = 0; idx < pixels.length; idx++)
|
||||
{
|
||||
int i = idx * 4;
|
||||
int a = pixels[idx] >> 24 & 255;
|
||||
int r = pixels[idx] >> 16 & 255;
|
||||
int g = pixels[idx] >> 8 & 255;
|
||||
int b = pixels[idx] >> 0 & 255;
|
||||
|
||||
if (field_76851_c)
|
||||
{
|
||||
r = g = b = (r + g + b) / 3;
|
||||
}
|
||||
|
||||
field_76852_a[i + 0] = (byte)r;
|
||||
field_76852_a[i + 1] = (byte)g;
|
||||
field_76852_a[i + 2] = (byte)b;
|
||||
field_76852_a[i + 3] = (byte)a;
|
||||
}
|
||||
|
||||
oldanaglyph = field_76851_c;
|
||||
}
|
||||
|
||||
//Implementation of http://scale2x.sourceforge.net/algorithm.html
|
||||
public static BufferedImage scale2x(BufferedImage image)
|
||||
{
|
||||
int w = image.getWidth();
|
||||
int h = image.getHeight();
|
||||
BufferedImage tmp = new BufferedImage(w * 2, h * 2, 2);
|
||||
|
||||
for (int x = 0; x < h; ++x)
|
||||
{
|
||||
int x2 = x * 2;
|
||||
for (int y = 0; y < w; ++y)
|
||||
{
|
||||
int y2 = y * 2;
|
||||
int E = image.getRGB(y, x);
|
||||
int D = (x == 0 ? E : image.getRGB(y, x - 1));
|
||||
int B = (y == 0 ? E : image.getRGB(y - 1, x ));
|
||||
int H = (y >= w - 1 ? E : image.getRGB(y + 1, x ));
|
||||
int F = (x >= h - 1 ? E : image.getRGB(y, x + 1));
|
||||
|
||||
int e0, e1, e2, e3;
|
||||
|
||||
if (B != H && D != F)
|
||||
{
|
||||
e0 = D == B ? D : E;
|
||||
e1 = B == F ? F : E;
|
||||
e2 = D == H ? D : E;
|
||||
e3 = H == F ? F : E;
|
||||
}
|
||||
else
|
||||
{
|
||||
e0 = e1 = e2 = e3 = E;
|
||||
}
|
||||
|
||||
tmp.setRGB(y2, x2, e0);
|
||||
tmp.setRGB(y2 + 1, x2, e1);
|
||||
tmp.setRGB(y2, x2 + 1, e2);
|
||||
tmp.setRGB(y2 + 1, x2 + 1, e3);
|
||||
}
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format("ModTextureStatic %s @ %d", targetTex, field_76850_b);
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ public class ModLoaderPickupNotifier implements IPickupNotifier
|
|||
@Override
|
||||
public void notifyPickup(EntityItem item, EntityPlayer player)
|
||||
{
|
||||
mod.onItemPickup(player, item.func_92014_d());
|
||||
mod.onItemPickup(player, item.func_92059_d());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -250,7 +250,7 @@ public class GameRegistry
|
|||
|
||||
public static void addRecipe(ItemStack output, Object... params)
|
||||
{
|
||||
CraftingManager.func_77594_a().func_92051_a(output, params);
|
||||
CraftingManager.func_77594_a().func_92103_a(output, params);
|
||||
}
|
||||
|
||||
public static void addShapelessRecipe(ItemStack output, Object... params)
|
||||
|
|
|
@ -8,8 +8,8 @@ public ma.b #FD:EntityList/field_75625_b #nameToClassMap
|
|||
public ma.c #FD:EntityList/field_75626_c #classToNameMap
|
||||
public ma.d #FD:EntityList/field_75623_d #idToClassMap
|
||||
# RenderEngine
|
||||
public bba.h #FD:RenderEngine/field_78367_h #textureList
|
||||
# -- MISSING MAPPINGpublic bcd.j #FD:RenderEngine/field_78366_k #texturePack
|
||||
#public bba.h #FD:RenderEngine/field_78367_h #textureList # -- MISSING MAPPING # -- MISSING MAPPING
|
||||
public bcd.j #FD:RenderEngine/field_78366_k #texturePack
|
||||
# RenderManager
|
||||
public bcx.p #FD:RenderManager/field_78729_o #renderers
|
||||
# RenderBlocks - everything
|
||||
|
@ -25,8 +25,8 @@ public bn.e #FD:StringTranslate/field_74813_d
|
|||
# TileEntityRenderer
|
||||
public bfa.m #FD:TileEntityRenderer/field_76966_m
|
||||
# CraftingManager - make the add recipe methods public
|
||||
public wn.a(Lur;[Ljava/lang/Object;)Lwq; #MD:CraftingManager/func_92051_a
|
||||
# -- MISSING MAPPINGpublic wy.b(Lvc;[Ljava/lang/Object;)V #MD:CraftingManager/func_77596_b
|
||||
public wy.a(Lvc;[Ljava/lang/Object;)Lxb; #MD:CraftingManager/func_92103_a
|
||||
public wy.b(Lvc;[Ljava/lang/Object;)V #MD:CraftingManager/func_77596_b
|
||||
# WeightedRandomItem
|
||||
public kv.a #FD:WeightedRandomItem/field_76292_a #probability
|
||||
# ItemStack
|
||||
|
|
|
@ -1,47 +1,9 @@
|
|||
class,package
|
||||
IconRegister,net/minecraft/client/renderer
|
||||
Rect2i,net/minecraft/client/renderer
|
||||
RenderTntMinecart,net/minecraft/client/renderer/entity
|
||||
ScreenHopper,net/minecraft/client/gui
|
||||
StitchHolder,net/minecraft/client/renderer
|
||||
StitchSlot,net/minecraft/client/renderer
|
||||
Stitcher,net/minecraft/client/renderer
|
||||
Texture,net/minecraft/client/renderer
|
||||
TextureClock,net/minecraft/client/renderer
|
||||
TextureCompass,net/minecraft/client/renderer
|
||||
TextureManager,net/minecraft/client/renderer
|
||||
TextureMap,net/minecraft/client/renderer
|
||||
TextureStitched,net/minecraft/client/renderer
|
||||
Block,net/minecraft/block
|
||||
BlockAnvil,net/minecraft/block
|
||||
BlockBasePressurePlate,net/minecraft/block
|
||||
BlockBaseRail,net/minecraft/block
|
||||
BlockBaseRailLogic,net/minecraft/block
|
||||
BlockComparator,net/minecraft/block
|
||||
BlockDaylightDetector,net/minecraft/block
|
||||
BlockHopper,net/minecraft/block
|
||||
BlockPoweredMetal,net/minecraft/block
|
||||
BlockPoweredRail,net/minecraft/block
|
||||
BlockQuartz,net/minecraft/block
|
||||
BlockRepeater,net/minecraft/block
|
||||
BlockStoneButton,net/minecraft/block
|
||||
BlockWeightedPressurePlate,net/minecraft/block
|
||||
BlockWoodButton,net/minecraft/block
|
||||
CallableTileEntityData,net/minecraft/tileentity
|
||||
CallableTileEntityID,net/minecraft/tileentity
|
||||
CombatEntry,net/minecraft/util
|
||||
CombatTracker,net/minecraft/util
|
||||
ContainerWorldly,net/minecraft/inventory
|
||||
EntitySelectorAlive,net/minecraft/command
|
||||
EntitySelectorHopperInventory,net/minecraft/tileentity
|
||||
Icon,net/minecraft/item
|
||||
ItemChestMinecart,net/minecraft/item
|
||||
ItemFurnaceMinecart,net/minecraft/item
|
||||
ItemRideableMinecart,net/minecraft/item
|
||||
ItemTntMinecart,net/minecraft/item
|
||||
MenuHopper,net/minecraft/inventory
|
||||
TileEntityDaylightDetector,net/minecraft/tileentity
|
||||
TileEntityHopper,net/minecraft/tileentity
|
||||
Block,net/minecraft/block
|
||||
BlockAnvil,net/minecraft/block
|
||||
BlockBeacon,net/minecraft/block
|
||||
BlockBed,net/minecraft/block
|
||||
BlockBookshelf,net/minecraft/block
|
||||
|
@ -57,8 +19,10 @@ BlockClay,net/minecraft/block
|
|||
BlockCloth,net/minecraft/block
|
||||
BlockCocoa,net/minecraft/block
|
||||
BlockCommandBlock,net/minecraft/block
|
||||
BlockComparator,net/minecraft/block
|
||||
BlockContainer,net/minecraft/block
|
||||
BlockCrops,net/minecraft/block
|
||||
BlockDaylightDetector,net/minecraft/block
|
||||
BlockDeadBush,net/minecraft/block
|
||||
BlockDetectorRail,net/minecraft/block
|
||||
BlockDirectional,net/minecraft/block
|
||||
|
@ -85,6 +49,7 @@ BlockGlowStone,net/minecraft/block
|
|||
BlockGrass,net/minecraft/block
|
||||
BlockGravel,net/minecraft/block
|
||||
BlockHalfSlab,net/minecraft/block
|
||||
BlockHopper,net/minecraft/block
|
||||
BlockIce,net/minecraft/block
|
||||
BlockJukeBox,net/minecraft/block
|
||||
BlockLadder,net/minecraft/block
|
||||
|
@ -111,8 +76,11 @@ BlockPistonExtension,net/minecraft/block
|
|||
BlockPistonMoving,net/minecraft/block
|
||||
BlockPortal,net/minecraft/block
|
||||
BlockPotato,net/minecraft/block
|
||||
BlockPoweredMetal,net/minecraft/block
|
||||
BlockPoweredRail,net/minecraft/block
|
||||
BlockPressurePlate,net/minecraft/block
|
||||
BlockPumpkin,net/minecraft/block
|
||||
BlockQuartz,net/minecraft/block
|
||||
BlockRail,net/minecraft/block
|
||||
BlockRedstoneLight,net/minecraft/block
|
||||
BlockRedstoneOre,net/minecraft/block
|
||||
|
@ -120,6 +88,7 @@ BlockRedstoneRepeater,net/minecraft/block
|
|||
BlockRedstoneTorch,net/minecraft/block
|
||||
BlockRedstoneWire,net/minecraft/block
|
||||
BlockReed,net/minecraft/block
|
||||
BlockRepeater,net/minecraft/block
|
||||
BlockSand,net/minecraft/block
|
||||
BlockSandStone,net/minecraft/block
|
||||
BlockSapling,net/minecraft/block
|
||||
|
@ -137,6 +106,7 @@ BlockStem,net/minecraft/block
|
|||
BlockStep,net/minecraft/block
|
||||
BlockStone,net/minecraft/block
|
||||
BlockStoneBrick,net/minecraft/block
|
||||
BlockStoneButton,net/minecraft/block
|
||||
BlockTNT,net/minecraft/block
|
||||
BlockTallGrass,net/minecraft/block
|
||||
BlockTorch,net/minecraft/block
|
||||
|
@ -146,7 +116,9 @@ BlockTripWireSource,net/minecraft/block
|
|||
BlockVine,net/minecraft/block
|
||||
BlockWall,net/minecraft/block
|
||||
BlockWeb,net/minecraft/block
|
||||
BlockWeightedPressurePlate,net/minecraft/block
|
||||
BlockWood,net/minecraft/block
|
||||
BlockWoodButton,net/minecraft/block
|
||||
BlockWoodSlab,net/minecraft/block
|
||||
BlockWorkbench,net/minecraft/block
|
||||
EnumMobType,net/minecraft/block
|
||||
|
@ -256,6 +228,7 @@ MapItemRenderer,net/minecraft/client/gui
|
|||
Particle,net/minecraft/client/gui
|
||||
ScaledResolution,net/minecraft/client/gui
|
||||
ScreenChatOptions,net/minecraft/client/gui
|
||||
ScreenHopper,net/minecraft/client/gui
|
||||
ThreadPollServers,net/minecraft/client/gui
|
||||
GuiAchievement,net/minecraft/client/gui/achievement
|
||||
GuiAchievements,net/minecraft/client/gui/achievement
|
||||
|
@ -385,18 +358,29 @@ EntityRenderer,net/minecraft/client/renderer
|
|||
EntitySorter,net/minecraft/client/renderer
|
||||
GLAllocation,net/minecraft/client/renderer
|
||||
IImageBuffer,net/minecraft/client/renderer
|
||||
IconRegister,net/minecraft/client/renderer
|
||||
ImageBufferDownload,net/minecraft/client/renderer
|
||||
InventoryEffectRenderer,net/minecraft/client/renderer
|
||||
ItemRenderer,net/minecraft/client/renderer
|
||||
OpenGlCapsChecker,net/minecraft/client/renderer
|
||||
OpenGlHelper,net/minecraft/client/renderer
|
||||
Rect2i,net/minecraft/client/renderer
|
||||
RenderBlocks,net/minecraft/client/renderer
|
||||
RenderEngine,net/minecraft/client/renderer
|
||||
RenderGlobal,net/minecraft/client/renderer
|
||||
RenderHelper,net/minecraft/client/renderer
|
||||
RenderList,net/minecraft/client/renderer
|
||||
RenderSorter,net/minecraft/client/renderer
|
||||
StitchHolder,net/minecraft/client/renderer
|
||||
StitchSlot,net/minecraft/client/renderer
|
||||
Stitcher,net/minecraft/client/renderer
|
||||
Tessellator,net/minecraft/client/renderer
|
||||
Texture,net/minecraft/client/renderer
|
||||
TextureClock,net/minecraft/client/renderer
|
||||
TextureCompass,net/minecraft/client/renderer
|
||||
TextureManager,net/minecraft/client/renderer
|
||||
TextureMap,net/minecraft/client/renderer
|
||||
TextureStitched,net/minecraft/client/renderer
|
||||
ThreadDownloadImage,net/minecraft/client/renderer
|
||||
ThreadDownloadImageData,net/minecraft/client/renderer
|
||||
WorldRenderer,net/minecraft/client/renderer
|
||||
|
@ -443,6 +427,7 @@ RenderSnowball,net/minecraft/client/renderer/entity
|
|||
RenderSpider,net/minecraft/client/renderer/entity
|
||||
RenderSquid,net/minecraft/client/renderer/entity
|
||||
RenderTNTPrimed,net/minecraft/client/renderer/entity
|
||||
RenderTntMinecart,net/minecraft/client/renderer/entity
|
||||
RenderVillager,net/minecraft/client/renderer/entity
|
||||
RenderWitch,net/minecraft/client/renderer/entity
|
||||
RenderWither,net/minecraft/client/renderer/entity
|
||||
|
@ -523,6 +508,7 @@ CommandTime,net/minecraft/command
|
|||
CommandToggleDownfall,net/minecraft/command
|
||||
CommandWeather,net/minecraft/command
|
||||
CommandXP,net/minecraft/command
|
||||
EntitySelectorAlive,net/minecraft/command
|
||||
IAdminCommand,net/minecraft/command
|
||||
ICommand,net/minecraft/command
|
||||
ICommandManager,net/minecraft/command
|
||||
|
@ -634,6 +620,10 @@ IMerchant,net/minecraft/entity
|
|||
INpc,net/minecraft/entity
|
||||
IProjectile,net/minecraft/entity
|
||||
IRangedAttackMob,net/minecraft/entity
|
||||
ItemChestMinecart,net/minecraft/entity
|
||||
ItemFurnaceMinecart,net/minecraft/entity
|
||||
ItemRideableMinecart,net/minecraft/entity
|
||||
ItemTntMinecart,net/minecraft/entity
|
||||
NpcMerchant,net/minecraft/entity
|
||||
WatchableObject,net/minecraft/entity
|
||||
EntityAIArrowAttack,net/minecraft/entity/ai
|
||||
|
@ -773,6 +763,7 @@ ContainerMerchant,net/minecraft/inventory
|
|||
ContainerPlayer,net/minecraft/inventory
|
||||
ContainerRepair,net/minecraft/inventory
|
||||
ContainerWorkbench,net/minecraft/inventory
|
||||
ContainerWorldly,net/minecraft/inventory
|
||||
ICrafting,net/minecraft/inventory
|
||||
IInvBasic,net/minecraft/inventory
|
||||
IInventory,net/minecraft/inventory
|
||||
|
@ -783,6 +774,7 @@ InventoryEnderChest,net/minecraft/inventory
|
|||
InventoryLargeChest,net/minecraft/inventory
|
||||
InventoryMerchant,net/minecraft/inventory
|
||||
InventoryRepair,net/minecraft/inventory
|
||||
MenuHopper,net/minecraft/inventory
|
||||
Slot,net/minecraft/inventory
|
||||
SlotArmor,net/minecraft/inventory
|
||||
SlotBeacon,net/minecraft/inventory
|
||||
|
@ -1062,17 +1054,22 @@ StatTypeTime,net/minecraft/stats
|
|||
StatsSyncher,net/minecraft/stats
|
||||
ThreadStatSyncherReceive,net/minecraft/stats
|
||||
ThreadStatSyncherSend,net/minecraft/stats
|
||||
CallableTileEntityData,net/minecraft/tileentity
|
||||
CallableTileEntityID,net/minecraft/tileentity
|
||||
CallableTileEntityName,net/minecraft/tileentity
|
||||
EntitySelectorHopperInventory,net/minecraft/tileentity
|
||||
TileEntity,net/minecraft/tileentity
|
||||
TileEntityBeacon,net/minecraft/tileentity
|
||||
TileEntityBrewingStand,net/minecraft/tileentity
|
||||
TileEntityChest,net/minecraft/tileentity
|
||||
TileEntityCommandBlock,net/minecraft/tileentity
|
||||
TileEntityDaylightDetector,net/minecraft/tileentity
|
||||
TileEntityDispenser,net/minecraft/tileentity
|
||||
TileEntityEnchantmentTable,net/minecraft/tileentity
|
||||
TileEntityEndPortal,net/minecraft/tileentity
|
||||
TileEntityEnderChest,net/minecraft/tileentity
|
||||
TileEntityFurnace,net/minecraft/tileentity
|
||||
TileEntityHopper,net/minecraft/tileentity
|
||||
TileEntityMobSpawner,net/minecraft/tileentity
|
||||
TileEntityMobSpawnerSpawnData,net/minecraft/tileentity
|
||||
TileEntityNote,net/minecraft/tileentity
|
||||
|
@ -1084,6 +1081,8 @@ AABBPool,net/minecraft/util
|
|||
AxisAlignedBB,net/minecraft/util
|
||||
ChatAllowedCharacters,net/minecraft/util
|
||||
ChunkCoordinates,net/minecraft/util
|
||||
CombatEntry,net/minecraft/util
|
||||
CombatTracker,net/minecraft/util
|
||||
CryptManager,net/minecraft/util
|
||||
DamageSource,net/minecraft/util
|
||||
Direction,net/minecraft/util
|
||||
|
@ -1100,6 +1099,7 @@ HttpUtil,net/minecraft/util
|
|||
HttpUtilRunnable,net/minecraft/util
|
||||
IDownloadSuccess,net/minecraft/util
|
||||
IProgressUpdate,net/minecraft/util
|
||||
Icon,net/minecraft/util
|
||||
IntHashMap,net/minecraft/util
|
||||
IntHashMapEntry,net/minecraft/util
|
||||
LongHashMap,net/minecraft/util
|
||||
|
|
|
Loading…
Reference in a new issue