2015-03-29 15:29:05 +02:00
|
|
|
package ellpeck.actuallyadditions.util;
|
|
|
|
|
2015-08-24 17:57:11 +02:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.client.Minecraft;
|
2015-04-19 01:50:02 +02:00
|
|
|
import net.minecraft.client.gui.FontRenderer;
|
2015-08-24 17:57:11 +02:00
|
|
|
import net.minecraft.client.renderer.ItemRenderer;
|
|
|
|
import net.minecraft.client.renderer.RenderBlocks;
|
|
|
|
import net.minecraft.client.renderer.Tessellator;
|
|
|
|
import net.minecraft.client.renderer.texture.TextureMap;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.IIcon;
|
2015-03-29 15:29:05 +02:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
|
|
|
|
|
|
|
public class AssetUtil{
|
|
|
|
|
|
|
|
public static final ResourceLocation GUI_INVENTORY_LOCATION = getGuiLocation("guiInventory");
|
|
|
|
|
|
|
|
public static ResourceLocation getGuiLocation(String file){
|
|
|
|
return new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/gui/" + file + ".png");
|
|
|
|
}
|
|
|
|
|
2015-05-20 22:39:43 +02:00
|
|
|
public static void displayNameString(FontRenderer font, int xSize, int yPositionOfMachineText, String machineName){
|
2015-08-01 00:40:29 +02:00
|
|
|
String localMachineName = StringUtil.localize(machineName+".name");
|
2015-04-19 01:50:02 +02:00
|
|
|
font.drawString(localMachineName, xSize/2 - font.getStringWidth(localMachineName)/2, yPositionOfMachineText, StringUtil.DECIMAL_COLOR_WHITE);
|
|
|
|
}
|
2015-08-24 17:57:11 +02:00
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public static void renderItem(ItemStack stack, int renderPass){
|
|
|
|
IIcon icon = stack.getItem().getIcon(stack, renderPass);
|
|
|
|
float f = icon.getMinU();
|
|
|
|
float f1 = icon.getMaxU();
|
|
|
|
float f2 = icon.getMinV();
|
|
|
|
float f3 = icon.getMaxV();
|
|
|
|
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
|
|
|
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F/16F);
|
|
|
|
}
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public static void renderBlock(Block block, int meta){
|
|
|
|
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
|
|
|
RenderBlocks.getInstance().renderBlockAsItem(block, meta, 1F);
|
|
|
|
}
|
2015-03-29 15:29:05 +02:00
|
|
|
}
|