Make Plugs more visible in hand
This commit is contained in:
parent
5cd49d2f8c
commit
cfd89df7b9
1 changed files with 37 additions and 29 deletions
|
@ -8,15 +8,16 @@ import net.minecraft.client.renderer.Tessellator;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class PlugItemRenderer implements IItemRenderer{
|
||||
public class PlugItemRenderer implements IItemRenderer {
|
||||
|
||||
private void renderPlugItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) {
|
||||
// Render StructurePipe
|
||||
Block block = BuildCraftTransport.genericPipeBlock;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
|
||||
block = BuildCraftTransport.genericPipeBlock;
|
||||
Icon textureID = BuildCraftTransport.instance.pipeIconProvider.getIcon(PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal()); // Structure pipe
|
||||
|
||||
|
@ -29,67 +30,74 @@ public class PlugItemRenderer implements IItemRenderer{
|
|||
tessellator.setNormal(0.0F, -0F, 0.0F);
|
||||
render.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, textureID);
|
||||
tessellator.draw();
|
||||
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
render.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, textureID);
|
||||
tessellator.draw();
|
||||
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1F);
|
||||
render.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, textureID);
|
||||
tessellator.draw();
|
||||
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
render.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, textureID);
|
||||
tessellator.draw();
|
||||
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0.0F, 0.0F);
|
||||
render.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, textureID);
|
||||
tessellator.draw();
|
||||
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
render.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, textureID);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
return true;
|
||||
case EQUIPPED:
|
||||
return true;
|
||||
case INVENTORY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
case ENTITY:
|
||||
return true;
|
||||
case EQUIPPED:
|
||||
return true;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
return true;
|
||||
case INVENTORY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
return helper != ItemRendererHelper.BLOCK_3D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
GL11.glScalef(0.50F, 0.50F, 0.50F);
|
||||
renderPlugItem((RenderBlocks) data[0], item, -0.6F, 0f, -0.6F);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
renderPlugItem((RenderBlocks) data[0], item, 0F, 0F, 0f);
|
||||
break;
|
||||
case INVENTORY:
|
||||
GL11.glScalef(1.1F, 1.1F, 1.1F);
|
||||
renderPlugItem((RenderBlocks) data[0], item, -0.3f, -0.35f, -0.7f);
|
||||
break;
|
||||
default:
|
||||
case ENTITY:
|
||||
GL11.glScalef(0.50F, 0.50F, 0.50F);
|
||||
renderPlugItem((RenderBlocks) data[0], item, -0.6F, 0f, -0.6F);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
GL11.glRotatef(70, 0, 0, 1F);
|
||||
GL11.glRotatef(-55, 1, 0, 0);
|
||||
GL11.glScalef(2F, 2F, 2F);
|
||||
GL11.glTranslatef(0, -0.6F, -0.4F);
|
||||
renderPlugItem((RenderBlocks) data[0], item, 0F, 0F, 0f);
|
||||
break;
|
||||
case INVENTORY:
|
||||
GL11.glScalef(1.1F, 1.1F, 1.1F);
|
||||
renderPlugItem((RenderBlocks) data[0], item, -0.3f, -0.35f, -0.7f);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue