private void renderHeldItem(EntityObj entityObj, ItemStack itemStack, ItemCameraTransforms.TransformType cameraTransforms, EnumHandSide handSide) { if (!itemStack.isEmpty()) { GlStateManager.pushMatrix(); if (entityObj.isSneaking()) { GlStateManager.translate(0.0F, 0.2F, 0.0F); } objRenderer.transformToHandAndRotateAndScale(handSide); GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(-180.0F, 0.0F, 1.0F, 0.0F); boolean flag = handSide == EnumHandSide.LEFT; Minecraft.getMinecraft().getItemRenderer().renderItemSide(entityObj, itemStack, cameraTransforms, flag); GlStateManager.popMatrix(); } }
@Override public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) { if (baseSpellPageModel instanceof IPerspectiveAwareModel) { Matrix4f matrix4f = ((IPerspectiveAwareModel) baseSpellPageModel).handlePerspective(cameraTransformType) .getRight(); return Pair.of(this, matrix4f); } ItemCameraTransforms itemCameraTransforms = baseSpellPageModel.getItemCameraTransforms(); ItemTransformVec3f itemTransformVec3f = itemCameraTransforms.getTransform(cameraTransformType); TRSRTransformation tr = new TRSRTransformation(itemTransformVec3f); Matrix4f mat = null; if (tr != null) { mat = tr.getMatrix(); } return Pair.of(this, mat); }
public static IBakedModel makeModelCube(TextureAtlasSprite p_makeModelCube_0_, int p_makeModelCube_1_) { List list = new ArrayList(); EnumFacing[] aenumfacing = EnumFacing.VALUES; Map<EnumFacing, List<BakedQuad>> map = new HashMap(); for (int i = 0; i < aenumfacing.length; ++i) { EnumFacing enumfacing = aenumfacing[i]; List list1 = new ArrayList(); list1.add(makeBakedQuad(enumfacing, p_makeModelCube_0_, p_makeModelCube_1_)); map.put(enumfacing, list1); } ItemOverrideList itemoverridelist = new ItemOverrideList(new ArrayList()); IBakedModel ibakedmodel = new SimpleBakedModel(list, map, true, true, p_makeModelCube_0_, ItemCameraTransforms.DEFAULT, itemoverridelist); return ibakedmodel; }
@Override public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) { if (parentModel instanceof IPerspectiveAwareModel) { Matrix4f matrix4f = ((IPerspectiveAwareModel) parentModel).handlePerspective(cameraTransformType) .getRight(); return Pair.of(this, matrix4f); } ItemCameraTransforms itemCameraTransforms = parentModel.getItemCameraTransforms(); ItemTransformVec3f itemTransformVec3f = itemCameraTransforms.getTransform(cameraTransformType); TRSRTransformation tr = new TRSRTransformation(itemTransformVec3f); Matrix4f mat = null; if (tr != null) { mat = tr.getMatrix(); } return Pair.of(this, mat); }
public void renderItem(ItemStack stack, IBakedModel model) { if (!stack.isEmpty()) { if (model.isBuiltInRenderer() && !(stack.getItem() instanceof ItemDankNullHolder)) { Minecraft.getMinecraft().getItemRenderer().renderItem(EasyMappings.player(), stack, ItemCameraTransforms.TransformType.NONE); } else { RenderModel.render(model, stack); if (stack.hasEffect()) { if ((stack.getItem() instanceof ItemDankNull)) { if (!Options.superShine) { GlintEffectRenderer.apply(model, stack.getItemDamage()); } else { GlintEffectRenderer.apply2(model, DankNullUtils.getColor(stack.getItemDamage(), false)); } } else { GlintEffectRenderer.apply(model, -1); } } } } }
protected void renderItemModelTransform(ItemStack stack, IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType) { this.textureManager.bindTexture(TextureMap.locationBlocksTexture); this.textureManager.getTexture(TextureMap.locationBlocksTexture).setBlurMipmap(false, false); this.preTransform(stack); GlStateManager.enableRescaleNormal(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.pushMatrix(); ItemCameraTransforms itemcameratransforms = model.getItemCameraTransforms(); itemcameratransforms.applyTransform(cameraTransformType); if (this.func_183005_a(itemcameratransforms.getTransform(cameraTransformType))) { GlStateManager.cullFace(1028); } this.renderItem(stack, model); GlStateManager.cullFace(1029); GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); GlStateManager.disableBlend(); this.textureManager.bindTexture(TextureMap.locationBlocksTexture); this.textureManager.getTexture(TextureMap.locationBlocksTexture).restoreLastBlurMipmap(); }
public void renderItemIntoGUI(ItemStack stack, int x, int y) { IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(stack); GlStateManager.pushMatrix(); this.textureManager.bindTexture(TextureMap.locationBlocksTexture); this.textureManager.getTexture(TextureMap.locationBlocksTexture).setBlurMipmap(false, false); GlStateManager.enableRescaleNormal(); GlStateManager.enableAlpha(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableBlend(); GlStateManager.blendFunc(770, 771); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.setupGuiTransform(x, y, ibakedmodel.isGui3d()); ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GUI); this.renderItem(stack, ibakedmodel); GlStateManager.disableAlpha(); GlStateManager.disableRescaleNormal(); GlStateManager.disableLighting(); GlStateManager.popMatrix(); this.textureManager.bindTexture(TextureMap.locationBlocksTexture); this.textureManager.getTexture(TextureMap.locationBlocksTexture).restoreLastBlurMipmap(); }
public static IBakedModel makeModelCube(TextureAtlasSprite p_makeModelCube_0_, int p_makeModelCube_1_) { List list = new ArrayList(); EnumFacing[] aenumfacing = EnumFacing.VALUES; List list1 = new ArrayList(aenumfacing.length); for (int i = 0; i < aenumfacing.length; ++i) { EnumFacing enumfacing = aenumfacing[i]; List list2 = new ArrayList(); list2.add(makeBakedQuad(enumfacing, p_makeModelCube_0_, p_makeModelCube_1_)); list1.add(list2); } IBakedModel ibakedmodel = new SimpleBakedModel(list, list1, true, true, p_makeModelCube_0_, ItemCameraTransforms.DEFAULT); return ibakedmodel; }
private void renderHeldItem(EntityLivingBase p_188358_1_, ItemStack p_188358_2_, ItemCameraTransforms.TransformType p_188358_3_, EnumHandSide handSide) { if (p_188358_2_ != null) { GlStateManager.pushMatrix(); if (p_188358_1_.isSneaking()) { GlStateManager.translate(0.0F, 0.2F, 0.0F); } // Forge: moved this call down, fixes incorrect offset while sneaking. ((ModelBiped)this.livingEntityRenderer.getMainModel()).postRenderArm(0.0625F, handSide); GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); boolean flag = handSide == EnumHandSide.LEFT; GlStateManager.translate((float)(flag ? -1 : 1) / 16.0F, 0.125F, -0.625F); Minecraft.getMinecraft().getItemRenderer().renderItemSide(p_188358_1_, p_188358_2_, p_188358_3_, flag); GlStateManager.popMatrix(); } }
public static IBakedModel makeModelCube(TextureAtlasSprite p_makeModelCube_0_, int p_makeModelCube_1_) { List list = new ArrayList(); EnumFacing[] aenumfacing = EnumFacing.values(); List list1 = new ArrayList(aenumfacing.length); for (int i = 0; i < aenumfacing.length; ++i) { EnumFacing enumfacing = aenumfacing[i]; List list2 = new ArrayList(); list2.add(makeBakedQuad(enumfacing, p_makeModelCube_0_, p_makeModelCube_1_)); list1.add(list2); } IBakedModel ibakedmodel = new SimpleBakedModel(list, list1, true, true, p_makeModelCube_0_, ItemCameraTransforms.DEFAULT); return ibakedmodel; }
public void renderItemSide(EntityLivingBase entitylivingbaseIn, ItemStack heldStack, ItemCameraTransforms.TransformType transform, boolean leftHanded) { if (!heldStack.func_190926_b()) { Item item = heldStack.getItem(); Block block = Block.getBlockFromItem(item); GlStateManager.pushMatrix(); boolean flag = this.itemRenderer.shouldRenderItemIn3D(heldStack) && block.getBlockLayer() == BlockRenderLayer.TRANSLUCENT; if (flag && (!Config.isShaders() || !Shaders.renderItemKeepDepthMask)) { GlStateManager.depthMask(false); } this.itemRenderer.renderItem(heldStack, entitylivingbaseIn, transform, leftHanded); if (flag) { GlStateManager.depthMask(true); } GlStateManager.popMatrix(); } }
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { boolean flag = entitylivingbaseIn.getPrimaryHand() == EnumHandSide.RIGHT; ItemStack itemstack = flag ? entitylivingbaseIn.getHeldItemOffhand() : entitylivingbaseIn.getHeldItemMainhand(); ItemStack itemstack1 = flag ? entitylivingbaseIn.getHeldItemMainhand() : entitylivingbaseIn.getHeldItemOffhand(); if (itemstack != null || itemstack1 != null) { GlStateManager.pushMatrix(); if (this.livingEntityRenderer.getMainModel().isChild) { float f = 0.5F; GlStateManager.translate(0.0F, 0.625F, 0.0F); GlStateManager.rotate(-20.0F, -1.0F, 0.0F, 0.0F); GlStateManager.scale(0.5F, 0.5F, 0.5F); } this.renderHeldItem(entitylivingbaseIn, itemstack1, ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, EnumHandSide.RIGHT); this.renderHeldItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, EnumHandSide.LEFT); GlStateManager.popMatrix(); } }
public static void renderItemStack(ItemStack stack) { //Fix stack 'y' center if(stack.getItem() instanceof ItemBlock) { GlStateManager.translate(0F, -0.1F, 0F); } RenderItem render = Minecraft.getMinecraft().getRenderItem(); GlStateManager.pushAttrib(); net.minecraft.client.renderer.RenderHelper.enableStandardItemLighting(); render.renderItem(stack, ItemCameraTransforms.TransformType.GROUND); net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); GlStateManager.popAttrib(); }
@SuppressWarnings("deprecation") public static IBakedModel handleCameraTransforms(IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType, boolean leftHandHackery) { if(model instanceof IPerspectiveAwareModel) { Pair<? extends IBakedModel, Matrix4f> pair = ((IPerspectiveAwareModel)model).handlePerspective(cameraTransformType); if(pair.getRight() != null) { Matrix4f matrix = new Matrix4f(pair.getRight()); if(leftHandHackery) { matrix.mul(flipX, matrix); matrix.mul(matrix, flipX); } multiplyCurrentGlMatrix(matrix); } return pair.getLeft(); } else { //if(leftHandHackery) GlStateManager.scale(-1, 1, 1); ItemCameraTransforms.applyTransformSide(model.getItemCameraTransforms().getTransform(cameraTransformType), leftHandHackery); //if(leftHandHackery) GlStateManager.scale(-1, 1, 1); } return model; }
private void renderItem(TilePedestal te) { ItemStack stack = te.getStack(); if (stack != null) { RenderHelper.enableStandardItemLighting(); GlStateManager.enableLighting(); GlStateManager.pushMatrix(); GlStateManager.translate(0.5, 0.75, 0.5); GlStateManager.scale(0.4F, .4F, 0.4F); Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.NONE); GlStateManager.popMatrix(); } }
private void renderItem(ItemStack stack) { float toScale = stack.getItem() instanceof ItemBlock ? 0.25F : 0.4375F; GlStateManager.scale(toScale, toScale, toScale); float playerView = Minecraft.getMinecraft().getRenderManager().playerViewY; GlStateManager.rotate(180.0F - playerView, 0, 1.0F, 0); Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.NONE); }
@Override public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) { GlStateManager.pushMatrix(); GlStateManager.translate((float) x, (float) y, (float) z); GlStateManager.enableRescaleNormal(); GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.rotate((this.renderManager.options.thirdPersonView == 2 ? -1 : 1) * this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); GlStateManager.disableLighting(); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } this.itemRenderer.renderItem(new ItemStack(ModItems.projectileItem), ItemCameraTransforms.TransformType.GROUND); if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } GlStateManager.enableLighting(); GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); }
public BakedToolHeadModel(ToolHeadModel parent, ImmutableList<BakedQuad> quads, VertexFormat format, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms, Map<String, IBakedModel> cache) { this.quads = quads; this.format = format; this.parent = parent; this.transforms = itemTransforms(); }
public void doRenderLayer(EntitySnowman entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { if (!entitylivingbaseIn.isInvisible() && !entitylivingbaseIn.isPumpkinEquipped()) { GlStateManager.pushMatrix(); this.snowManRenderer.getMainModel().head.postRender(0.0625F); float f = 0.625F; GlStateManager.translate(0.0F, -0.34375F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); GlStateManager.scale(0.625F, -0.625F, -0.625F); Minecraft.getMinecraft().getItemRenderer().renderItem(entitylivingbaseIn, new ItemStack(Blocks.PUMPKIN, 1), ItemCameraTransforms.TransformType.HEAD); GlStateManager.popMatrix(); } }
public static void renderItemWithTransform(World world, ItemStack stack, ItemCameraTransforms.TransformType transform) { GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); GlStateManager.enableCull(); GlStateManager.depthMask(true); RenderHelper.enableStandardItemLighting(); GlStateManager.enableAlpha(); GlStateManager.enableRescaleNormal(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); IBakedModel ibakedmodel = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, world, (EntityLivingBase) null); IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, transform, false); Minecraft.getMinecraft().getRenderItem().renderItem(stack, transformedModel); GlStateManager.disableBlend(); GlStateManager.disableAlpha(); RenderHelper.disableStandardItemLighting(); GlStateManager.depthMask(false); GlStateManager.disableCull(); GlStateManager.popAttrib(); GlStateManager.popMatrix(); }
private void renderItem(ItemStack stack, int slot) { if (stack != null && !stack.isEmpty()) { int slotX = slot; int slotY = 0; if (slot >= 6) { slotX = slot - 6; slotY = 2; } else if (slot >= 3) { slotX = slot - 3; slotY = 1; } RenderHelper.enableStandardItemLighting(); GlStateManager.enableLighting(); GlStateManager.pushMatrix(); GlStateManager.translate((slotX / 5.35d) + 0.315, .675, (slotY / 5.35d) + 0.315); GlStateManager.scale(.1f, .1f, .1f); if (!(stack.getItem() instanceof ItemBlock)) { GlStateManager.rotate(-90, 1, 0, 0); GlStateManager.translate(0, 0, -0.5); } Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.NONE); GlStateManager.popMatrix(); } }
public SimpleBakedModel(List<BakedQuad> p_i46077_1_, List<List<BakedQuad>> p_i46077_2_, boolean p_i46077_3_, boolean p_i46077_4_, TextureAtlasSprite p_i46077_5_, ItemCameraTransforms p_i46077_6_) { this.generalQuads = p_i46077_1_; this.faceQuads = p_i46077_2_; this.ambientOcclusion = p_i46077_3_; this.gui3d = p_i46077_4_; this.texture = p_i46077_5_; this.cameraTransforms = p_i46077_6_; }
private Builder(boolean p_i46076_1_, boolean p_i46076_2_, ItemCameraTransforms p_i46076_3_) { this.builderGeneralQuads = Lists.<BakedQuad>newArrayList(); this.builderFaceQuads = Lists.<List<BakedQuad>>newArrayListWithCapacity(6); for (EnumFacing enumfacing : EnumFacing.values()) { this.builderFaceQuads.add(Lists.<BakedQuad>newArrayList()); } this.builderAmbientOcclusion = p_i46076_1_; this.builderGui3d = p_i46076_2_; this.builderCameraTransforms = p_i46076_3_; }
/** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doe */ public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) { GlStateManager.pushMatrix(); GlStateManager.translate((float)x, (float)y, (float)z); GlStateManager.enableRescaleNormal(); GlStateManager.scale(0.5F, 0.5F, 0.5F); GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); this.bindTexture(TextureMap.locationBlocksTexture); this.field_177083_e.func_181564_a(this.func_177082_d(entity), ItemCameraTransforms.TransformType.GROUND); GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); }
public void doRenderLayer(EntitySnowman entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) { if (!entitylivingbaseIn.isInvisible()) { GlStateManager.pushMatrix(); this.snowManRenderer.getMainModel().head.postRender(0.0625F); float f = 0.625F; GlStateManager.translate(0.0F, -0.34375F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); GlStateManager.scale(f, -f, -f); Minecraft.getMinecraft().getItemRenderer().renderItem(entitylivingbaseIn, new ItemStack(Blocks.pumpkin, 1), ItemCameraTransforms.TransformType.HEAD); GlStateManager.popMatrix(); } }
public void func_181564_a(ItemStack p_181564_1_, ItemCameraTransforms.TransformType p_181564_2_) { if (p_181564_1_ != null) { IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(p_181564_1_); this.renderItemModelTransform(p_181564_1_, ibakedmodel, p_181564_2_); } }
public void renderItem(EntityLivingBase entityIn, ItemStack heldStack, ItemCameraTransforms.TransformType transform) { if (heldStack != null) { Item item = heldStack.getItem(); Block block = Block.getBlockFromItem(item); GlStateManager.pushMatrix(); if (this.itemRenderer.shouldRenderItemIn3D(heldStack)) { GlStateManager.scale(2.0F, 2.0F, 2.0F); if (this.isBlockTranslucent(block)) { GlStateManager.depthMask(false); } } this.itemRenderer.renderItemModelForEntity(heldStack, entityIn, transform); if (this.isBlockTranslucent(block)) { GlStateManager.depthMask(true); } GlStateManager.popMatrix(); } }
public void renderItem(double x, double y, double z, TileMeltery meltery) { // calculate x/z parameters double x1 = meltery.getPos().getX(); double y1 = meltery.getPos().getY(); double z1 = meltery.getPos().getZ(); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); RenderUtil.pre(x, y, z); GlStateManager.translate(0.5,1/16d,0.5); GlStateManager.disableCull(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderHelper.enableStandardItemLighting(); int brightness = meltery.getWorld().getCombinedLight(meltery.getPos(), 0); ItemStack stack = meltery.inventory.getStackInSlot(0); boolean isItem = !(stack.getItem() instanceof ItemBlock); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) (brightness % 0x10000) / 1f, (float) (brightness / 0x10000) / 1f); if (isItem) { GlStateManager.rotate(-90, 1, 0, 0); } else { GlStateManager.scale(0.5,0.5,0.5); } IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, meltery.getWorld(), null); model = ForgeHooksClient.handleCameraTransforms(model, ItemCameraTransforms.TransformType.NONE, false); Minecraft.getMinecraft().getRenderItem().renderItem(stack, model); if (isItem) { GlStateManager.rotate(90, 1, 0, 0); } RenderHelper.enableStandardItemLighting(); GlStateManager.enableCull(); RenderUtil.post(); }
public BakedToolModel(IModel parent, ImmutableList<BakedQuad> quads, VertexFormat format, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms, Map<String, IBakedModel> cache) { this.quads = quads; this.format = format; this.parent = parent; this.transforms = itemTransforms(); this.cache = cache; }
@Override public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) { if (cameraTransformType == ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND || cameraTransformType == ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND) { return Pair.of(this, mat_fp); } if (cameraTransformType == ItemCameraTransforms.TransformType.GUI) { return Pair.of(this, mat_gui); } return Pair.of(this, null); }
@Override public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) { if (cameraTransformType == ItemCameraTransforms.TransformType.GUI) return Pair.of(this, mat_gui); return Pair.of(this, mat); }
@Override public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) { switch (cameraTransformType) { case GUI: return Pair.of(this, mat_gui); } return Pair.of(this, mat); }
public void doRenderLayer(EntitySnowman entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { if (!entitylivingbaseIn.isInvisible() && entitylivingbaseIn.isPumpkinEquipped()) { GlStateManager.pushMatrix(); this.snowManRenderer.getMainModel().head.postRender(0.0625F); float f = 0.625F; GlStateManager.translate(0.0F, -0.34375F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); GlStateManager.scale(0.625F, -0.625F, -0.625F); Minecraft.getMinecraft().getItemRenderer().renderItem(entitylivingbaseIn, new ItemStack(Blocks.PUMPKIN, 1), ItemCameraTransforms.TransformType.HEAD); GlStateManager.popMatrix(); } }
@Override public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) { if(cameraTransformType == ItemCameraTransforms.TransformType.GUI) return Pair.of(this, mat_gui); return Pair.of(this, mat); }
public void renderItem(ItemStack stack, EntityLivingBase entitylivingbaseIn, ItemCameraTransforms.TransformType transform, boolean leftHanded) { if (stack != null && entitylivingbaseIn != null && stack.getItem() != null) { IBakedModel ibakedmodel = this.getItemModelWithOverrides(stack, entitylivingbaseIn.worldObj, entitylivingbaseIn); this.renderItemModel(stack, ibakedmodel, transform, leftHanded); } }
@Override public void render(TileMagibench te, double x, double y, double z, float partialTicks, int destroyStage, float alpha, BufferBuilder buffer, Tessellator tes) { resetTrans(te); //todo add floating items support MagibenchRegistry.Tier t = PurMag.INSTANCE.getMagibenchRegistry().getTier(te.getTier()); int index = 0; float scale = Math.min(1f / t.getWidth(), 1f / t.getHeight()); GlStateManager.pushMatrix(); GlStateManager.translate(0.5f, 0, 0.5f); GlStateManager.rotate(PXLMC.getHorizontalRotation(te.getWorld().getBlockState(te.getPos()).getValue(HorizontalFacingController.FACING_H)), 0, 1, 0); GlStateManager.translate(-0.5f, 0, -0.5f); GlStateManager.translate(0.16f, 1.09f, 0.16f); for (int yy = 0; yy < t.getHeight(); yy++) { for (int xx = 0; xx < t.getWidth(); xx++) { ItemStack stack = te.handler.getStackInSlot(index); if (!stack.isEmpty()) { GlStateManager.pushMatrix(); GlStateManager.scale(0.8f, 0.8f, 0.8f); GlStateManager.translate(0.1f, 0, 0.1f); GlStateManager.scale(scale, scale, scale); GlStateManager.translate(t.getWidth() - xx - 1, 0, t.getHeight() - yy - 1); if (!(stack.getItem() instanceof ItemBlock)) { GlStateManager.translate(0, -0.22f, 0); GlStateManager.rotate(90, 1, 0, 0); } Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.FIXED); GlStateManager.popMatrix(); } index++; } } GlStateManager.popMatrix(); setTrans(te); }