mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-17 13:13:12 +01:00
74 lines
2.5 KiB
Java
74 lines
2.5 KiB
Java
package ellpeck.actuallyadditions.blocks.render;
|
|
|
|
import ellpeck.actuallyadditions.util.Util;
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.util.ResourceLocation;
|
|
import net.minecraftforge.client.IItemRenderer;
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
public class RenderItems implements IItemRenderer{
|
|
|
|
ModelBaseAA theModel;
|
|
ResourceLocation theTexture;
|
|
|
|
public RenderItems(ModelBaseAA model){
|
|
this.theModel = model;
|
|
this.theTexture = new ResourceLocation(Util.MOD_ID_LOWER, "textures/blocks/models/" + this.theModel.getName() + ".png");
|
|
}
|
|
|
|
@Override
|
|
public boolean handleRenderType(ItemStack item, ItemRenderType type){
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper){
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public void renderItem(ItemRenderType type, ItemStack item, Object... data){
|
|
switch(type){
|
|
case INVENTORY:
|
|
GL11.glPushMatrix();
|
|
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
|
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
|
GL11.glTranslatef(-0.5F, -1.27F, 0.5F);
|
|
Minecraft.getMinecraft().renderEngine.bindTexture(theTexture);
|
|
theModel.render(0.0625F);
|
|
GL11.glPopMatrix();
|
|
break;
|
|
|
|
case EQUIPPED:
|
|
GL11.glPushMatrix();
|
|
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
|
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
|
GL11.glTranslatef(0.6F, -1.2F, -0.0F);
|
|
Minecraft.getMinecraft().renderEngine.bindTexture(theTexture);
|
|
theModel.render(0.0625F);
|
|
GL11.glPopMatrix();
|
|
break;
|
|
|
|
case EQUIPPED_FIRST_PERSON:
|
|
GL11.glPushMatrix();
|
|
GL11.glScalef(1.2F, 1.2F, 1.2F);
|
|
GL11.glRotatef(180, 2F, -0F, 0.1F);
|
|
GL11.glTranslatef(1.5F, -1.2F, -0.3F);
|
|
Minecraft.getMinecraft().renderEngine.bindTexture(theTexture);
|
|
theModel.render(0.0625F);
|
|
GL11.glPopMatrix();
|
|
break;
|
|
|
|
default:
|
|
GL11.glPushMatrix();
|
|
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
|
GL11.glTranslatef(0.0F, -1.27F, 0.0F);
|
|
Minecraft.getMinecraft().renderEngine.bindTexture(theTexture);
|
|
theModel.render(0.0625F);
|
|
GL11.glPopMatrix();
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|