Commit a775b4f3 authored by Matchlighter's avatar Matchlighter
Browse files

Updated to 1.6.2. Added something to the build scripts

parent 4a5077bf
......@@ -56,7 +56,8 @@
<property name="version.major" value="${MLCore.build.major.number}" />
<property name="version.minor" value="${MLCore.build.minor.number}" />
<property name="version.rev" value="${MLCore.build.revision.number}" />
<property name="version" value="${version.major}.${version.minor}.${version.rev}.${version.build}" />
<property name="version.info" value="${MLCore.build.info}" />
<property name="version" value="${version.major}.${version.minor}.${version.rev}.${version.build}-${version.info}" />
<antcall target="writeversion" />
</target>
......
......@@ -43,13 +43,14 @@ def main():
except OSError:
print("Git not found")
vers="v1.0-0-deadbeef"
(major,minor,rev,githash)=re.match("v(\d+).(\d+)-(\d+)-(.*)",vers).groups()
(major,minor,info,rev,githash)=re.match("v(\d+).(\d+)-?(.*)-(\d+)-(.*)",vers).groups()
(mcpversion,mcversion,mcserverversion) = re.match("[.\w]+ \(data: ([.\w]+), client: ([.\w.]+), server: ([.\w.]+)\)",Commands.fullversion()).groups()
with open("version.properties","w") as f:
f.write("%s=%s\n" %("MLCore.build.major.number",major))
f.write("%s=%s\n" %("MLCore.build.minor.number",minor))
f.write("%s=%s\n" %("MLCore.build.info",info))
f.write("%s=%s\n" %("MLCore.build.revision.number",rev))
f.write("%s=%s\n" %("MLCore.build.githash",githash))
f.write("%s=%s\n" %("MLCore.build.mcpversion",mcpversion))
......
......@@ -36,9 +36,9 @@ public abstract class GuiContainerControl extends GuiContainer {
GuiControl ret = null;
float cZind = 0;
for (GuiControl ctrl : controls) {
if (ctrl.isPointIn(x, y) && ctrl.zLevel>=cZind) {
if (ctrl.isPointIn(x, y) && ctrl.getZLevel()>=cZind) {
ret = ctrl;
cZind = ret.zLevel;
cZind = ret.getZLevel();
}
}
return ret;
......
......@@ -39,4 +39,6 @@ public abstract class GuiControl extends Gui {
public boolean onKeyPress(char chr, int key) {
return false;
}
public float getZLevel() { return this.zLevel; }
}
......@@ -4,12 +4,15 @@ import ml.core.gui.GuiContainerControl;
import ml.core.gui.GuiPositionedControl;
import ml.core.gui.GuiRenderUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ControlButton extends GuiPositionedControl {
protected static final ResourceLocation buttonRes = new ResourceLocation("textures/gui/widgets.png");
public String text;
public ControlButton(GuiContainerControl assocGui, int xPos, int yPos, int w, int h, String t) {
......@@ -19,7 +22,7 @@ public class ControlButton extends GuiPositionedControl {
@Override
public void renderForeground(Minecraft mc, int mouseX, int mouseY) {
mc.renderEngine.bindTexture("/gui/gui.png");
mc.func_110434_K().func_110577_a(buttonRes);
GuiRenderUtils.drawSlicedRect(bounds.xCoord, bounds.yCoord, bounds.width, bounds.height, 0, enabled ? isPointIn(mouseX, mouseY) ? 86 : 66 : 46, 200, 20, 2, 2, 2, 2);
}
......
......@@ -11,6 +11,7 @@ import ml.core.gui.GuiSide;
import ml.core.gui.MouseButton;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
......@@ -20,6 +21,8 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ControlTabManager extends GuiControl {
protected static ResourceLocation ledgerRes = new ResourceLocation("MLCore:textures/gui/ledger.png");
public int tabTopMargin = 4;
/**
......@@ -83,7 +86,7 @@ public class ControlTabManager extends GuiControl {
float blue = (tabColor & 0xFF) /255F;
GL11.glColor4f(red, green, blue, 1.0F);
mc.renderEngine.bindTexture("/mods/MLCore/textures/gui/ledger.png");
mc.func_110434_K().func_110577_a(ledgerRes);
switch (TabManager.side){
case Left:
......
......@@ -8,10 +8,18 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.ResourceLocation;
@SideOnly(Side.CLIENT)
public abstract class CustomTextureMap extends TextureMap {
public ResourceLocation resourceLoc;
public CustomTextureMap(int par1, String par2Str, ResourceLocation resLoc) {
super(par1, par2Str);
resourceLoc = resLoc;
}
public static BufferedImage defaultMissingTextureImage = new BufferedImage(64, 64, 2);
static {
Graphics graphics = defaultMissingTextureImage.getGraphics();
......@@ -35,11 +43,6 @@ public abstract class CustomTextureMap extends TextureMap {
graphics.dispose();
}
public CustomTextureMap(int par1, String par2, String par3Str,
BufferedImage par4BufferedImage) {
super(par1, par2, par3Str, par4BufferedImage);
}
/**
* Called by MLCore. You code should find whatever is using this TextureMap and re-register the icons into its list.
......
package ml.core.texture;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
......@@ -27,14 +29,22 @@ public class CustomTextureMapManager {
throw new RuntimeException("TextureMap type " + map.textureType + " is already registered.");
maps.put(map.textureType, map);
map.refreshTextures();
Minecraft mc = Minecraft.getMinecraft();
mc.renderEngine.func_130088_a(map.resourceLoc, map);
try {
map.func_110551_a(mc.func_110442_L());
} catch (IOException e) {}
}
@ForgeSubscribe
public void reregisterIcons(TextureStitchEvent.Pre evt) {
Minecraft mc = Minecraft.getMinecraft();
if (evt.map.textureType==0) {
for (TextureMap map : maps.values()) {
map.refreshTextures();
for (CustomTextureMap map : maps.values()) {
try {
map.func_110551_a(mc.func_110442_L());
} catch (IOException e) {}
}
}
if (maps.containsKey(evt.map.textureType)) {
......
package ml.core.texture;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.imageio.ImageIO;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.texture.TextureStitched;
import net.minecraft.client.texturepacks.ITexturePack;
import net.minecraft.client.resources.ResourceManager;
import net.minecraft.client.resources.SimpleResource;
import net.minecraft.util.Icon;
import net.minecraft.util.ResourceLocation;
public class TextureSheet {
public class TextureSprite extends TextureStitched {
public class TextureSprite extends TextureAtlasSprite {
protected String textureName;
protected int index;
......@@ -24,14 +31,20 @@ public class TextureSheet {
}
@Override
public boolean loadTexture(TextureManager manager, ITexturePack texturepack, String name, String fileName, BufferedImage image, ArrayList textures) {
public boolean load(ResourceManager manager, ResourceLocation location)
throws IOException {
int offX = index%tilesX * swidth;
int offY = index/tilesY * sheight;
textures.add(TextureUtils.loadTextureFromImage(textureName, masterImg.getSubimage(offX, offY, swidth, sheight)));
BufferedImage spri = masterImg.getSubimage(offX, offY, swidth, sheight);
ByteArrayOutputStream ot = new ByteArrayOutputStream();
ImageIO.write(spri, "png", ot);
SimpleResource res = new SimpleResource(location, new ByteArrayInputStream(ot.toByteArray()), null, null);
super.func_130100_a(res);
return true;
}
}
protected TextureSprite[] sprites;
......@@ -45,8 +58,8 @@ public class TextureSheet {
protected int swidth;
protected int sheight;
public TextureSheet(String file, int tilesX, int tilesY) {
texFile = file;
public TextureSheet(String fl, int tilesX, int tilesY) {
texFile = fl;
this.tilesX = tilesX;
this.tilesY = tilesY;
sprites = new TextureSprite[tilesX*tilesY];
......
......@@ -3,37 +3,37 @@ package ml.core.texture;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import javax.imageio.ImageIO;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.Texture;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.texture.TextureStitched;
import net.minecraft.client.texturepacks.ITexturePack;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.resources.ResourceManager;
import net.minecraft.util.ResourceLocation;
public class TextureUtils {
public static Texture createDefaultTexture(String nm, int w, int h) {
return new Texture(nm, 2, w, h, GL11.GL_CLAMP, GL11.GL_RGBA, GL11.GL_NEAREST, GL11.GL_NEAREST, null);
}
public static Texture loadTextureFromFile(String file) {
BufferedImage bfi = loadBufferedImage(file);
return new Texture(file, 2, bfi.getWidth(), bfi.getHeight(), GL11.GL_CLAMP, GL11.GL_RGBA, GL11.GL_NEAREST, GL11.GL_NEAREST, bfi);
}
// public static Texture createDefaultTexture(String nm, int w, int h) {
// return new Texture(nm, 2, w, h, GL11.GL_CLAMP, GL11.GL_RGBA, GL11.GL_NEAREST, GL11.GL_NEAREST, null);
// }
//
// public static Texture loadTextureFromFile(String file) {
// BufferedImage bfi = loadBufferedImage(file);
// return new Texture(file, 2, bfi.getWidth(), bfi.getHeight(), GL11.GL_CLAMP, GL11.GL_RGBA, GL11.GL_NEAREST, GL11.GL_NEAREST, bfi);
// }
//
// public static Texture loadTextureFromImage(String name, BufferedImage bfi) {
// return new Texture(name, 2, bfi.getWidth(), bfi.getHeight(), GL11.GL_CLAMP, GL11.GL_RGBA, GL11.GL_NEAREST, GL11.GL_NEAREST, bfi);
// }
public static Texture loadTextureFromImage(String name, BufferedImage bfi) {
return new Texture(name, 2, bfi.getWidth(), bfi.getHeight(), GL11.GL_CLAMP, GL11.GL_RGBA, GL11.GL_NEAREST, GL11.GL_NEAREST, bfi);
public static BufferedImage loadBufferedImage(String fl) {
return loadBufferedImage(new ResourceLocation(fl));
}
public static BufferedImage loadBufferedImage(String file) {
public static BufferedImage loadBufferedImage(ResourceLocation resLoc) {
try {
InputStream is = Minecraft.getMinecraft().renderEngine.texturePack.getSelectedTexturePack().getResourceAsStream(file);
InputStream is = Minecraft.getMinecraft().func_110442_L().func_110536_a(resLoc).func_110527_b();
if (is != null) {
BufferedImage bfi = loadBufferedImage(is);
return bfi;
......@@ -51,9 +51,10 @@ public class TextureUtils {
}
public static boolean shouldReloadTexture(TextureMap mp, String texFile) {
return mp.setTextureEntry(texFile, new TextureStitched(texFile) {
return mp.setTextureEntry(texFile, new TextureAtlasSprite(texFile) {
@Override
public boolean loadTexture(TextureManager manager, ITexturePack texturepack, String name, String fileName, BufferedImage image, ArrayList textures) {
public boolean load(ResourceManager manager,
ResourceLocation location) throws IOException {
return false;
}
});
......
......@@ -5,13 +5,14 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.ResourceLocation;
import ml.core.texture.CustomTextureMap;
import ml.core.texture.CustomTextureMapManager;
public class BasicCustomTextureMap extends CustomTextureMap {
public static final BasicCustomTextureMap GUI = new BasicCustomTextureMap(CustomTextureMapManager.getNextMapId(), "gui", "textures/gui/", defaultMissingTextureImage);
public static final BasicCustomTextureMap GUI = new BasicCustomTextureMap(CustomTextureMapManager.getNextMapId(), "textures/gui/", "MLCore:textures/icons.png");
public List<IIconProvider> providers = new ArrayList<IIconProvider>();
......@@ -20,15 +21,14 @@ public class BasicCustomTextureMap extends CustomTextureMap {
providers.add(pvdr);
}
public BasicCustomTextureMap(int par1, String par2, String par3Str, BufferedImage par4BufferedImage) {
super(par1, par2, par3Str, par4BufferedImage);
public BasicCustomTextureMap(int par1, String basePath, ResourceLocation resLoc) {
super(par1, basePath, resLoc);
CustomTextureMapManager.instance.registerMap(this);
}
@Override
public void refreshTextures() {
super.refreshTextures();
public BasicCustomTextureMap(int par1, String basePath, String resLoc) {
this(par1, basePath, new ResourceLocation(resLoc));
}
@Override
......
......@@ -55,7 +55,7 @@ public abstract class TileEntityConnectable extends TileEntity {
public abstract Packet getDescriptionPacket();
private void sendPacket() {
PacketDispatcher.sendPacketToAllInDimension(getDescriptionPacket(), worldObj.getWorldInfo().getDimension());
PacketDispatcher.sendPacketToAllInDimension(getDescriptionPacket(), worldObj.provider.dimensionId);
}
public void onConnect(boolean isMaster, TileEntityConnectable remote) {}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment