2014-12-15 00:11:48 +00:00
|
|
|
package com.cricketcraft.chisel.client.render;
|
2014-10-27 16:26:14 -04:00
|
|
|
|
|
|
|
|
import net.minecraft.util.IIcon;
|
|
|
|
|
import net.minecraftforge.client.event.TextureStitchEvent;
|
|
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
2014-12-14 20:05:39 +00:00
|
|
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
2014-10-27 16:26:14 -04:00
|
|
|
|
2015-01-07 19:50:18 -05:00
|
|
|
public class TextureSubmap {
|
|
|
|
|
|
|
|
|
|
public int width, height;
|
|
|
|
|
public IIcon icon;
|
|
|
|
|
public IIcon icons[];
|
|
|
|
|
|
|
|
|
|
public TextureSubmap(IIcon i, int w, int h) {
|
|
|
|
|
icon = i;
|
|
|
|
|
width = w;
|
|
|
|
|
height = h;
|
|
|
|
|
icons = new IIcon[width * height];
|
|
|
|
|
|
|
|
|
|
MinecraftForge.EVENT_BUS.register(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SubscribeEvent
|
|
|
|
|
public void TexturesStitched(TextureStitchEvent.Post event) {
|
|
|
|
|
|
|
|
|
|
for (int x = 0; x < width; x++) {
|
|
|
|
|
for (int y = 0; y < height; y++) {
|
|
|
|
|
icons[y * width + x] = new TextureVirtual(icon, width, height, x, y);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-10-27 16:26:14 -04:00
|
|
|
}
|