@EventHandler public void postInit(FMLPostInitializationEvent event) { if (event.getSide() == Side.CLIENT) { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); BlockAuraStone.BlockType.registerRenders(); renderItem.getItemModelMesher().register(orb, 0, new ModelResourceLocation(MODID + ":" + ((ItemAuraOrb) orb).getNameFromDamage(0), "inventory")); renderItem.getItemModelMesher().register(orb, 1, new ModelResourceLocation(MODID + ":" + ((ItemAuraOrb) orb).getNameFromDamage(1), "inventory")); renderItem.getItemModelMesher().register(Item.getItemFromBlock(auramPlant), 0 , new ModelResourceLocation(MODID + ":" + (((BlockAuramPlant) auramPlant).getName()), "inventory")); } }
@Override public void renderTileEntityAt(TileEntityShaft shaft, double dx, double dy, double dz, float partial, int destroyingStage) { GlStateManager.enableTexture2D(); GlStateManager.enableRescaleNormal(); GlStateManager.enableBlend(); Minecraft.getMinecraft().getTextureManager().bindTexture(Core.blockAtlas); GL11.glPushMatrix(); GL11.glTranslated(dx + 0.5, dy + 0.5, dz + 0.5); if (shaft.axis.getDirectionVec().getX() == 1) { GL11.glRotatef(90, 0, 0, 1); } else if (shaft.axis.getDirectionVec().getZ() == 1) { GL11.glRotatef(90, 1, 0, 0); } double angle = Math.toDegrees(NumUtil.interp(shaft.prev_angle, shaft.angle, partial)); GL11.glRotatef((float) angle, 0, 1, 0); Minecraft mc = Minecraft.getMinecraft(); RenderItem ri = mc.getRenderItem(); RenderUtil.scale3(2); IBakedModel model = ri.getItemModelMesher().getItemModel(shaft.shaftItem); ri.renderItem(shaft.shaftItem, model); GL11.glPopMatrix(); }
@SideOnly(Side.CLIENT) public void renderTesr(@Nullable ServoMotor motor, float partial) { final Minecraft mc = Minecraft.getMinecraft(); final RenderItem ri = mc.getRenderItem(); RenderUtil.scale3(2); GL11.glPushMatrix(); GL11.glTranslated(0.25, 0.25, 0.25); for (int i = 0; i < parts.length; i++) { ItemStack part = parts[i]; if (part == null) continue; if (motor == null && isStaticPart(i, part)) continue; GL11.glPushMatrix(); stateForPart(i, part, partial); ri.renderItem(part, ItemCameraTransforms.TransformType.NONE); GL11.glPopMatrix(); } GL11.glPopMatrix(); }
public static final void initBlocks(FMLInitializationEvent event) { blocks = new ArrayList<CustomBlock>(); marble = (CustomBlock)new CustomBlock("marble", Material.rock).setHardness(1.5f).setResistance(10.0f).setStepSound(Block.soundTypePiston); marbleBricks = (CustomBlock)new CustomBlock("marbleBricks", Material.rock).setHardness(1.5f).setResistance(10.0f).setStepSound(Block.soundTypePiston); if (event.getSide() == Side.CLIENT) { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); for (CustomBlock block : blocks) { renderItem.getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(NaturalRocks.prefix + block.getName(), "inventory")); } } }
public BWItem(net.minecraft.item.Item item, int meta, NBTTagCompound tag) { this.item = item; this.meta = meta; this.tag = tag; components.add(new StaticRenderer()) .onRender(model -> { model.addChild(new CustomModel(self -> { Tessellator.instance.draw(); GL11.glPushMatrix(); DoubleBuffer buffer = BufferUtils.createDoubleBuffer(4 * 4); double[] flatArray = Arrays.stream(self.matrix.getMatrix().getData()) .flatMapToDouble(Arrays::stream) .toArray(); buffer.put(flatArray); buffer.position(0); GL11.glMultMatrix(buffer); RenderItem.getInstance().doRender(fakeEntity, 0, 0, 0, 0, 0); GL11.glPopMatrix(); Tessellator.instance.startDrawingQuads(); })); } ); }
@Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f1) { model.renderDoomShrine(x, y, z); TileDoomShrine tileEntity = (TileDoomShrine)te; int slot = 0; if(tileEntity.getStackInSlot(slot)!= null){ if((entItem == null) || entItem.getEntityItem().getItem() != tileEntity.getStackInSlot(slot).getItem()) entItem = new EntityItem(tileEntity.getWorldObj(), x, y, z, tileEntity.getStackInSlot(slot)); GL11.glPushMatrix(); this.entItem.hoverStart = 0.0F; RenderItem.renderInFrame = true; GL11.glTranslatef((float)x + 0.5F, (float)y + 1.08F, (float)z + 0.5F); GL11.glRotatef(0, 90, 1, 1); RenderManager.instance.renderEntityWithPosYaw(this.entItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); RenderItem.renderInFrame = false; GL11.glPopMatrix(); } }
private void renderSlots(GearSwapperTE gearSwapperTE) { RenderHelper.enableGUIStandardItemLighting(); float factor = 2.0f; float f3 = 0.0075F; GL11.glTranslatef(-0.5F, 0.5F, 0.04F); GL11.glScalef(f3 * factor, -f3 * factor, 0.0001f); RenderItem itemRender = Minecraft.getMinecraft().getRenderItem(); for (int i = 0 ; i < 4 ; i++) { ItemStack stack = gearSwapperTE.getStackInSlot(i); if (stack != null) { itemRender.renderItemAndEffectIntoGUI(stack, xx[i], yy[i]); } } RenderHelper.enableStandardItemLighting(); }
public void renderItemStack(ItemStack stack, int x, int y) { if (stack != null) { GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderHelper.enableGUIStandardItemLighting(); // Renders Item Icon. RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack, x, y); // Renders Item Overlay example durability bar RenderItem.getInstance().renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, stack, x, y); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1F, 1F, 1F, 1F); } }
/** * ------------------------------------------------------------------------- */ @Override public void registerItemModels() { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); for (Item item : RealLifeMod_Items.itemList) { renderItem.getItemModelMesher().register(item, 0, new ModelResourceLocation( Reference.ID + ":" + item.getUnlocalizedName().substring(5), "inventory")); } for (Block b : RealLifeMod_Blocks.blockList) { renderItem.getItemModelMesher().register(Item.getItemFromBlock(b), 0, new ModelResourceLocation(Reference.ID + ":" + b.getUnlocalizedName().substring(5), "inventory")); } ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(RealLifeMod_Blocks.transformer), 0, new ModelResourceLocation(Reference.ID + ":blockTransformer", "inventory")); }
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { // ====================== Render item texture ====================== FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(item); int color = fluidStack.getFluid().getColor(); IIcon fluidIcon = item.getIconIndex(); IIcon bucketIcon = Items.bucket.getIconIndex(new ItemStack(Items.bucket)); if(type == ItemRenderType.INVENTORY) { GL11.glEnable(GL11.GL_ALPHA_TEST); RenderItem.getInstance().renderIcon(0, 0, bucketIcon, 16, 16); GL11.glColor3ub((byte)((color >>> 16) & 0xFF), (byte)((color >>> 8) & 0xFF), (byte)(color & 0xFF)); RenderItem.getInstance().renderIcon(0, 0, fluidIcon, 16, 16); GL11.glColor3f(1f, 1f, 1f); } else { ItemRenderer.renderItemIn2D(Tessellator.instance, ((IIcon)bucketIcon).getMinU(), ((IIcon)bucketIcon).getMinV(), ((IIcon)bucketIcon).getMaxU(), ((IIcon)bucketIcon).getMaxV(), ((IIcon)bucketIcon).getIconWidth(), ((IIcon)bucketIcon).getIconHeight(), 0.1f); GL11.glColor3ub((byte)((color >>> 16) & 0xFF), (byte)((color >>> 8) & 0xFF), (byte)(color & 0xFF)); ItemRenderer.renderItemIn2D(Tessellator.instance, ((IIcon)fluidIcon).getMinU(), ((IIcon)fluidIcon).getMinV(), ((IIcon)fluidIcon).getMaxU(), ((IIcon)fluidIcon).getMaxV(), ((IIcon)fluidIcon).getIconWidth(), ((IIcon)fluidIcon).getIconHeight(), 0.1f); GL11.glColor3f(1f, 1f, 1f); } }
@Override public void renderPage(GuiManual gui, int x, int y, int mx, int my) { GL11.glEnable(GL12.GL_RESCALE_NORMAL); RenderHelper.enableGUIStandardItemLighting(); float scale = 2f; int w = (105-stacks.length*16)/(stacks.length+1); GL11.glScalef(scale,scale,scale); RenderItem.getInstance().renderWithColor=true; for(int i=0; i<stacks.length; i++) RenderItem.getInstance().renderItemAndEffectIntoGUI(manual.fontRenderer, ManualUtils.mc().renderEngine, stacks[i], (int)((x+w+(18+w)*i)/scale), (int)((y+4)/scale)); GL11.glScalef(1/scale,1/scale,1/scale); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_BLEND); if(localizedText!=null&&!localizedText.isEmpty()) manual.fontRenderer.drawSplitString(localizedText, x,y+44, 120, manual.getTextColour()); }
/** Redraws the ItemStack into the focus slot **/ private void updateItemStackFocus(ItemStack itemstack) { if(itemstack != null) { RenderItem renderer = new RenderItem(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); RenderHelper.enableGUIStandardItemLighting(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240 / 1.0F, 240 / 1.0F); renderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.renderEngine, itemstack, this.posX + 152, this.posY + 111); } }
@Override public void draw() { RenderItem renderer = new RenderItem(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); RenderHelper.enableGUIStandardItemLighting(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240 / 1.0F, 240 / 1.0F); renderer.renderItemAndEffectIntoGUI(fontrenderer, renderengine, item, posX, posY); }
public RenderHelper() { renderer = new RenderItem() { public boolean shouldSpreadItems() { return false; } public boolean shouldBob() { return false; } }; renderer.setRenderManager(RenderManager.instance); renderer.renderInFrame = true; entityItem.hoverStart = 0F; }
public void sendAlertWithItem(String title, String description, int givenWidth, ItemStack givenItem) { this.title = "\u00A7f" + title; this.description = description; this.field_146263_l = Minecraft.getSystemTime(); this.field_146262_n = false; this.itemStack = givenItem; this.item = new RenderItem(); this.image = null; if (givenWidth == -1) { if (mc.fontRenderer.getStringWidth(title) > mc.fontRenderer.getStringWidth(description)) { this.alertWidth = 30 + mc.fontRenderer.getStringWidth(title) + 5; } else { this.alertWidth = 30 + mc.fontRenderer.getStringWidth(description) + 5; } } }
private void registerModelLocation(final Item item, final String name, final String type) { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); //System.out.println("registerModelLocation for " + name); if (renderItem != null) { renderItem.getItemModelMesher().register(item, new ItemMeshDefinition() { @Override public ModelResourceLocation getModelLocation(ItemStack stack) { //System.out.println(name + "/" + stack.getUnlocalizedName()); if (item instanceof ISubtypeFromStackPovider && ((ISubtypeFromStackPovider)item).getSubType(stack) != null) { //System.out.println(ModInfo.ModID + ":" + name + "/" + ((ISubtypeFromStackPovider)item).getSubType(stack)); return new ModelResourceLocation(ModInfo.ModID + ":" + name + "/" + ((ISubtypeFromStackPovider)item).getSubType(stack), type); } else { return new ModelResourceLocation(ModInfo.ModID + ":" + name, type); } } }); } }
@SideOnly(Side.CLIENT) @Override public void call(Gui gui) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int type = isItemLocation(); if (u == -1) u = 0; if (v == -1) v = 0; if (type == -1) { GL11.glEnable(GL11.GL_BLEND); Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(resource)); gui.drawTexturedModalRect(x, y, u, v, width, height); GL11.glDisable(GL11.GL_BLEND); } else { RenderItem render = new RenderItem(); ItemStack toRender = type == 1 ? new ItemStack((Block)Block.blockRegistry.getObject(resource)) : new ItemStack((Item)Item.itemRegistry.getObject(resource)); render.renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), toRender, x, y); } }
@Override public void registerRenderThings() { RenderManager renderManager = Minecraft.getMinecraft().getRenderManager(); RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); Registers.addEntityRender(EntityZertum.class, new RenderZertum(renderManager, new ModelZertumStage1(), 0.5F)); Registers.addEntityRender(EntityRedZertum.class, new RenderRedZertum(renderManager, new ModelZertumStage1(), 0.5F)); Registers.addEntityRender(EntityDarkZertum.class, new RenderDarkZertum(renderManager, new ModelZertumStage1(), 0.5F)); Registers.addEntityRender(EntityDestroZertum.class, new RenderDestroZertum(renderManager, new ModelZertumStage1(), 0.5F)); Registers.addEntityRender(EntityIceZertum.class, new RenderIceZertum(renderManager, new ModelZertumStage1(), 0.5F)); Registers.addEntityRender(EntityForisZertum.class, new RenderForisZertum(renderManager, new ModelZertumStage1(), 0.5F)); Registers.addEntityRender(EntityMetalZertum.class, new RenderMetalZertum(renderManager, new ModelZertumStage1(), 0.5F)); Registers.addEntityRender(EntityJakan.class, new RenderJakan(renderManager, new ModelJakan(), 1.0F)); Registers.addEntityRender(EntityKurr.class, new RenderKurr(renderManager, new ModelKurr(), 1.0F)); Registers.addEntityRender(EntityKortor.class, new RenderKortor(renderManager, new ModelKortor(), 1.0F)); Registers.addEntityRender(EntityRiggator.class, new RenderRiggator(renderManager, new ModelRiggator(), 1.0F)); Registers.addEntityRender(EntityFlamingPoisonball.class, new RenderProjectiles(renderManager, ModItems.FPoisonball, renderItem)); Registers.addEntityRender(EntityIceball.class, new RenderProjectiles(renderManager, ModItems.iceBall, renderItem)); Registers.addEntityRender(EntityGrenade.class, new RenderProjectiles(renderManager, ModItems.nileGrenade, renderItem)); Registers.addEntityRender(EntityZertumBeam.class, new RenderProjectiles(renderManager, Items.snowball, renderItem)); Registers.bindTileEntitySpecialRenderer(TileEntityNileWorkbench.class, new RenderNileTable()); Registers.bindTileEntitySpecialRenderer(TileEntityFoodBowl.class, new RenderFoodBowl()); }
public static void renderItemStackInGUI(ItemStack itemStack, FontRenderer fontRendererObj, RenderItem itemRender, int x, int y, float zLevel) { if (itemStack == null) return; TextureManager textureManager = Minecraft.getMinecraft().getTextureManager(); RenderHelper.enableGUIStandardItemLighting(); glDisable(GL_LIGHTING); glEnable(GL_RESCALE_NORMAL); glEnable(GL_COLOR_MATERIAL); glEnable(GL_LIGHTING); itemRender.zLevel = zLevel; itemRender.renderItemAndEffectIntoGUI(fontRendererObj, textureManager, itemStack, x, y); itemRender.renderItemOverlayIntoGUI(fontRendererObj, textureManager, itemStack, x, y); itemRender.zLevel = 0.0F; glDisable(GL_LIGHTING); glEnable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); }
@SideOnly(Side.CLIENT) public static void disabledRender(RenderItem itemRender, ItemStack stack, int i, int j) { Minecraft.getMinecraft().getTextureManager().bindTexture(texture); GL11.glPushMatrix(); if (!(stack.getItemSpriteNumber() == 0 && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(stack.getItem()).getRenderType()))) GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV((double)(i + 0), (double)(j + 16), 500F, 0, 1); tessellator.addVertexWithUV((double)(i + 16), (double)(j + 16), 500F, 1, 1); tessellator.addVertexWithUV((double)(i + 16), (double)(j + 0), 500F, 1, 0); tessellator.addVertexWithUV((double)(i + 0), (double)(j + 0), 500F, 0, 0); tessellator.draw(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
public void setPosition(int p_78913_1_, int p_78913_2_, int p_78913_3_) { if (p_78913_1_ != this.posX || p_78913_2_ != this.posY || p_78913_3_ != this.posZ) { this.setDontDraw(); this.posX = p_78913_1_; this.posY = p_78913_2_; this.posZ = p_78913_3_; this.posXPlus = p_78913_1_ + 8; this.posYPlus = p_78913_2_ + 8; this.posZPlus = p_78913_3_ + 8; this.posXClip = p_78913_1_ & 1023; this.posYClip = p_78913_2_; this.posZClip = p_78913_3_ & 1023; this.posXMinus = p_78913_1_ - this.posXClip; this.posYMinus = p_78913_2_ - this.posYClip; this.posZMinus = p_78913_3_ - this.posZClip; float f = 6.0F; this.rendererBoundingBox = AxisAlignedBB.getBoundingBox((double)((float)p_78913_1_ - f), (double)((float)p_78913_2_ - f), (double)((float)p_78913_3_ - f), (double)((float)(p_78913_1_ + 16) + f), (double)((float)(p_78913_2_ + 16) + f), (double)((float)(p_78913_3_ + 16) + f)); GL11.glNewList(this.glRenderList + 2, GL11.GL_COMPILE); RenderItem.renderAABB(AxisAlignedBB.getBoundingBox((double)((float)this.posXClip - f), (double)((float)this.posYClip - f), (double)((float)this.posZClip - f), (double)((float)(this.posXClip + 16) + f), (double)((float)(this.posYClip + 16) + f), (double)((float)(this.posZClip + 16) + f))); GL11.glEndList(); this.markDirty(); } }
@Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { RenderItem itemRenderer = new RenderItem(); ItemStack itemStackToRender = new ItemStack(block, 1, metadata); itemRenderer.setRenderManager(RenderManager.instance); EntityItem entityItemToRender = new EntityItem(Minecraft.getMinecraft().theWorld, 0, 0, 0, itemStackToRender); entityItemToRender.hoverStart = 0; float scaleItem = 1.5f; GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); GL11.glRotatef((float) (90f * Math.PI / 180f), 1, 0, 0); GL11.glScalef(scaleItem, scaleItem, scaleItem); itemRenderer.doRender(entityItemToRender, 0, 0, 0, 0, 0); GL11.glPopMatrix(); }
public RenderHandler(Minecraft mc) { this.mc = mc; this.width = mc.displayWidth; this.height = mc.displayHeight; this.renderPlayer = new RenderPlayer(); this.renderEntity = new RenderEntity(); this.itemRender = new RenderItem(); this.curBlockDamage = null; try { for (Field field : PlayerControllerMP.class.getDeclaredFields()) if (field.getName().equals("field_78770_f") || field.getName().equals("curBlockDamageMP")) { this.curBlockDamage = PlayerControllerMP.class.getDeclaredField(field.getName()); curBlockDamage.setAccessible(true); } } catch (Exception exception) { System.err.println(exception); } }
public EnergyContainerTESR() { texture = new ResourceLocation("minecraft:textures/blocks/planks_oak.png"); model = AdvancedModelLoader.loadModel(new ResourceLocation("biotechmod:models/energyContainer.obj")); potato = new RenderItem() { public boolean shouldBob() { return false; } public boolean shouldSpreadItems() { return false; } }; dummy = new EntityItem(null); dummy.hoverStart = 0.0f; dummy.motionX = 0.0f; dummy.motionY = 0.0f; dummy.motionZ = 0.0f; potato.setRenderManager(RenderManager.instance); }
public ModelDrawingHelper(ModelRobot model, TileFactoryController tile, ResourceLocation texture, int canvasWidth, int canvasHeight, float scale) { this.model = model; this.texture = texture; this.canvasWidth = canvasWidth; this.canvasHeight = canvasHeight; this.scale = scale; this.tile = tile; customRenderItem = new RenderItem() { @Override public boolean shouldBob() { return false; } }; customRenderItem.setRenderManager(RenderManager.instance); }
public static final void initBlocks(FMLInitializationEvent event) { sapphire_ore = new BlockBasic("sapphire_ore").setUnlocalizedName("sapphire_ore"); ruby_ore = new BlockBasic("ruby_ore").setUnlocalizedName("ruby_ore"); peridot_ore = new BlockBasic("peridot_ore").setUnlocalizedName("peridot_ore"); sapphire_block = new BlockBasic("sapphire_block").setUnlocalizedName("sapphire_block"); ruby_block = new BlockBasic("ruby_block").setUnlocalizedName("ruby_block"); peridot_block = new BlockBasic("peridot_block").setUnlocalizedName("peridot_block"); //register renders if(event.getSide() == Side.CLIENT) { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); //blocks renderItem.getItemModelMesher().register(Item.getItemFromBlock(sapphire_ore), 0, new ModelResourceLocation(Gems.prefix + ((BlockBasic) sapphire_ore).getName(), "inventory")); renderItem.getItemModelMesher().register(Item.getItemFromBlock(ruby_ore), 0, new ModelResourceLocation(Gems.prefix + ((BlockBasic) ruby_ore).getName(), "inventory")); renderItem.getItemModelMesher().register(Item.getItemFromBlock(peridot_ore), 0, new ModelResourceLocation(Gems.prefix + ((BlockBasic) peridot_ore).getName(), "inventory")); renderItem.getItemModelMesher().register(Item.getItemFromBlock(sapphire_block), 0, new ModelResourceLocation(Gems.prefix + ((BlockBasic) sapphire_block).getName(), "inventory")); renderItem.getItemModelMesher().register(Item.getItemFromBlock(ruby_block), 0, new ModelResourceLocation(Gems.prefix + ((BlockBasic) ruby_block).getName(), "inventory")); renderItem.getItemModelMesher().register(Item.getItemFromBlock(peridot_block), 0, new ModelResourceLocation(Gems.prefix + ((BlockBasic) peridot_block).getName(), "inventory")); } }
public void func_78913_a(int p_78913_1_, int p_78913_2_, int p_78913_3_) { if(p_78913_1_ != this.field_78923_c || p_78913_2_ != this.field_78920_d || p_78913_3_ != this.field_78921_e) { this.func_78910_b(); this.field_78923_c = p_78913_1_; this.field_78920_d = p_78913_2_; this.field_78921_e = p_78913_3_; this.field_78925_n = p_78913_1_ + 8; this.field_78926_o = p_78913_2_ + 8; this.field_78940_p = p_78913_3_ + 8; this.field_78932_i = p_78913_1_ & 1023; this.field_78929_j = p_78913_2_; this.field_78930_k = p_78913_3_ & 1023; this.field_78918_f = p_78913_1_ - this.field_78932_i; this.field_78919_g = p_78913_2_ - this.field_78929_j; this.field_78931_h = p_78913_3_ - this.field_78930_k; float var4 = 6.0F; this.field_78938_r = AxisAlignedBB.func_72330_a((double)((float)p_78913_1_ - var4), (double)((float)p_78913_2_ - var4), (double)((float)p_78913_3_ - var4), (double)((float)(p_78913_1_ + 16) + var4), (double)((float)(p_78913_2_ + 16) + var4), (double)((float)(p_78913_3_ + 16) + var4)); GL11.glNewList(this.field_78942_y + 2, 4864); RenderItem.func_76980_a(AxisAlignedBB.func_72332_a().func_72299_a((double)((float)this.field_78932_i - var4), (double)((float)this.field_78929_j - var4), (double)((float)this.field_78930_k - var4), (double)((float)(this.field_78932_i + 16) + var4), (double)((float)(this.field_78929_j + 16) + var4), (double)((float)(this.field_78930_k + 16) + var4))); GL11.glEndList(); this.func_78914_f(); } }
/** * Sets a new position for the renderer and setting it up so it can be reloaded with the new data for that position */ public void setPosition(int par1, int par2, int par3) { if (par1 != this.posX || par2 != this.posY || par3 != this.posZ) { this.setDontDraw(); this.posX = par1; this.posY = par2; this.posZ = par3; this.posXPlus = par1 + 8; this.posYPlus = par2 + 8; this.posZPlus = par3 + 8; this.posXClip = par1 & 1023; this.posYClip = par2; this.posZClip = par3 & 1023; this.posXMinus = par1 - this.posXClip; this.posYMinus = par2 - this.posYClip; this.posZMinus = par3 - this.posZClip; float f = 6.0F; this.rendererBoundingBox = AxisAlignedBB.getBoundingBox((double)((float)par1 - f), (double)((float)par2 - f), (double)((float)par3 - f), (double)((float)(par1 + 16) + f), (double)((float)(par2 + 16) + f), (double)((float)(par3 + 16) + f)); GL11.glNewList(this.glRenderList + 2, GL11.GL_COMPILE); RenderItem.renderAABB(AxisAlignedBB.getAABBPool().getAABB((double)((float)this.posXClip - f), (double)((float)this.posYClip - f), (double)((float)this.posZClip - f), (double)((float)(this.posXClip + 16) + f), (double)((float)(this.posYClip + 16) + f), (double)((float)(this.posZClip + 16) + f))); GL11.glEndList(); this.markDirty(); } }
/** * Registers every model of each block so it has a texture */ public static void registerBlockModels(){ // TODO In die Proxy Klassen verlagern System.out.println("Atomizer is registering its models now!"); RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); ModelResourceLocation mrl; for(Block b : blocks){ mrl = new ModelResourceLocation(b.getRegistryName(), "inventory"); renderItem.getItemModelMesher().register(Item.getItemFromBlock(b), 0, mrl); System.out.println("Registered: " + b.getRegistryName()); //ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(b), 0, mrl); } }
protected void drawForeground() { fontRendererObj.drawString("§lSURVIVE", xSize / 2 - fontRendererObj.getStringWidth("§lSURVIVE") / 2, 16, 0x332211); fontRendererObj.drawString("§lMINE", xSize / 2 - fontRendererObj.getStringWidth("§lMINE") / 2, 28, 0x332211); fontRendererObj.drawString("§lCRAFT", xSize / 2 - fontRendererObj.getStringWidth("§lCRAFT") / 2, 40, 0x332211); fontRendererObj.drawString("§n" + player.getDisplayName(), xSize / 2 - fontRendererObj.getStringWidth("§n" + player.getDisplayName()) / 2, 60, 0x443322); fontRendererObj.drawString("§oComplex Wiring", xSize / 2 - fontRendererObj.getStringWidth("§oComplex Wiring") / 2, ySize - 28, 0x554433); RenderItem renderItem = new RenderItem(); renderItem.renderItemIntoGUI(fontRendererObj, Minecraft.getMinecraft().getTextureManager(), new ItemStack(Items.redstone), craftingGridX + 16, craftingGridY); renderItem.renderItemIntoGUI(fontRendererObj, Minecraft.getMinecraft().getTextureManager(), new ItemStack(Items.paper), craftingGridX, craftingGridY + 16); renderItem.renderItemIntoGUI(fontRendererObj, Minecraft.getMinecraft().getTextureManager(), new ItemStack(Items.book), craftingGridX + 16, craftingGridY + 16); renderItem.renderItemIntoGUI(fontRendererObj, Minecraft.getMinecraft().getTextureManager(), new ItemStack(Items.paper), craftingGridX + 32, craftingGridY + 16); renderItem.renderItemIntoGUI(fontRendererObj, Minecraft.getMinecraft().getTextureManager(), new ItemStack(Items.redstone), craftingGridX + 16, craftingGridY + 32); }
private void renderItem(TileEntityInventoryBase tileEnt, RenderItem itemRender, ItemStack stack, float x, float y, float z) { GL11.glPushMatrix(); float scaleFactor = CoreUtil.getGhostItemScaleFactor(this.outputRender, stack); float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL); EntityItem ghostEntityItem = new EntityItem(tileEnt.getWorldObj()); ghostEntityItem.hoverStart = 0.0F; ghostEntityItem.setEntityItemStack(stack); GL11.glTranslatef(x, y, z); GL11.glScalef(scaleFactor, scaleFactor, scaleFactor); GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F); itemRender.doRender(ghostEntityItem, 0, 0, 0, 0, 0); GL11.glPopMatrix(); }
private void renderTileBox(TileEntityPrehistoryBox tile, double x, double y, double z) { translations = new double[][]{new double[]{0.4D, 0.15D, 0.4D}, new double[]{0.65D, 0.15D, 0.4D}, new double[]{0.4D, 0.15D, 0.65D}, new double[]{0.65D, 0.15D, 0.65D}}; for(int i = 0; i < tile.stacks.length; i++) { if(tile.stacks[i] != null) { entityItem[i].setEntityItemStack(tile.stacks[i]); GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glTranslated(x, y, z); GL11.glTranslated(translations[i][0], translations[i][1], translations[i][2]); GL11.glRotatef(0F, 0.0F, 0.0F, 0.0F); GL11.glScalef(0.5F, 0.5F, 0.5F); RenderItem.renderInFrame = true; RenderManager.instance.renderEntityWithPosYaw(entityItem[i], 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); RenderItem.renderInFrame = false; GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } } }
@Override @SideOnly(Side.CLIENT) protected void drawContents(RenderState renderState, float partialTicks) { renderState.enableTexture(); renderState.enableDepthTest(); renderState.enableCullFace(); renderState.disableLight(); renderState.setColor(0xFFFFFF, 1.0f); GL11.glScalef(scale, scale, scale); final RenderItem renderItem = getRenderItem(); final Minecraft minecraft = Minecraft.getMinecraft(); final TextureManager textureManager = minecraft.getTextureManager(); renderItem.renderItemAndEffectIntoGUI(minecraft.fontRenderer, textureManager, drawStack, 0, 0); if (damageBar > 0 || !Strings.isNullOrEmpty(label)) { renderItem.renderItemOverlayIntoGUI(minecraft.fontRenderer, textureManager, dummyStack, 0, 0, label); } RenderUtils.disableLightmap(); renderState.readState(); }
public RenderTileEntityWoolColorizer() { mc = FMLClientHandler.instance().getClient(); renderBlocks = new RenderBlocks(); renderItem = new RenderItem() { @Override public boolean shouldBob() { return false; } @Override public boolean shouldSpreadItems() { return false; } }; renderItem.setRenderManager(RenderManager.instance); }
public void renderModel(TileEntityFossilCleaner tile, float f) { if (tile.itemInCleaner != -1) if (MaemeItemsFossils.getFossilFromIndex(tile.itemInCleaner) != null) { bindTextureByName("/maemesoft/texture/fossils/" + fossilTexture(tile) + ".png"); GL11.glTranslatef(0, 2.23F, 0); if (MaemeItemsFossils.getFossilFromIndex(tile.itemInCleaner).getModel() != null) MaemeItemsFossils.getFossilFromIndex(tile.itemInCleaner).getModel().renderModel(f); } else if (MaemeItemsFossils.getCoveredFossilFromIndex(tile.itemInCleaner) != null) { if (uncoveredEntity != null) if (uncoveredEntity.getEntityItem().itemID != tile.itemInCleaner) uncoveredEntity = null; if (uncoveredEntity == null) { uncoveredEntity = new EntityItem(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, new ItemStack( MaemeItemsFossils.getCoveredFossilFromIndex(tile.itemInCleaner))); } GL11.glTranslatef(0, 0.15F, 0); GL11.glRotatef(-1*tile.timer/1.5f * 57.296f, 0.0F, 1.0F, 0.0F); ((RenderItem) RenderManager.instance.getEntityClassRenderObject(EntityItem.class)).doRenderItem(uncoveredEntity, 0, 1.8, 0, tile.timer / 1.5f, 0); GL11.glRotatef(tile.timer/1.5f * 57.296f, 0.0F, 1.0F, 0.0F); } }
public static void registerRenders() { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); for (int i = 0; i < values().length; i++) { renderItem.getItemModelMesher().register(Item.getItemFromBlock(AuraMod.AuraStone), i, new ModelResourceLocation(values()[i].getResouceLocation(), "inventory")); } }
@Override public void registerBlockItem(Block block) { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); ModelResourceLocation location = new ModelResourceLocation(block.getRegistryName(), "inventory"); renderItem.getItemModelMesher().register(Item.getItemFromBlock(block), 0, location); }