com.mojang.blaze3d.matrix.MatrixStack Java Examples
The following examples show how to use
com.mojang.blaze3d.matrix.MatrixStack.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Render.java From XRay-Mod with GNU General Public License v3.0 | 7 votes |
static void renderBlocks(RenderWorldLastEvent event) { Vector3d view = XRay.mc.gameRenderer.getActiveRenderInfo().getProjectedView(); MatrixStack stack = event.getMatrixStack(); stack.translate(-view.x, -view.y, -view.z); // translate RenderSystem.pushMatrix(); RenderSystem.multMatrix(stack.getLast().getMatrix()); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); Profile.BLOCKS.apply(); // Sets GL state for block drawing syncRenderList.forEach(blockProps -> { buffer.begin( GL_LINES, DefaultVertexFormats.POSITION_COLOR ); renderBlockBounding(buffer, blockProps); tessellator.draw(); } ); Profile.BLOCKS.clean(); RenderSystem.popMatrix(); }
Example #2
Source File: RenderBlockTER.java From MiningGadgets with MIT License | 6 votes |
private void renderModelBrightnessColorQuads(MatrixStack.Entry matrixEntry, IVertexBuilder builder, float red, float green, float blue, float alpha, List<BakedQuad> listQuads, int combinedLightsIn, int combinedOverlayIn) { for(BakedQuad bakedquad : listQuads) { float f; float f1; float f2; if (bakedquad.hasTintIndex()) { f = red * 1f; f1 = green * 1f; f2 = blue * 1f; } else { f = 1f; f1 = 1f; f2 = 1f; } builder.addVertexData(matrixEntry, bakedquad, f, f1, f2, alpha, combinedLightsIn, combinedOverlayIn); } }
Example #3
Source File: SawmillScreen.java From Survivalist with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void func_230430_a_(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { this.func_230446_a_(matrixStack); if (this.recipeGui.isVisible() && this.widthTooNarrowIn) { this.func_230450_a_(matrixStack, partialTicks, mouseX, mouseY); this.recipeGui.func_230430_a_(matrixStack, mouseX, mouseY, partialTicks); } else { this.recipeGui.func_230430_a_(matrixStack, mouseX, mouseY, partialTicks); super.func_230430_a_(matrixStack, mouseX, mouseY, partialTicks); this.recipeGui.func_230477_a_(matrixStack, this.guiLeft, this.guiTop, true, partialTicks); } this.func_230459_a_(matrixStack, mouseX, mouseY); this.recipeGui.func_238924_c_(matrixStack, this.guiLeft, this.guiTop, mouseX, mouseY); }
Example #4
Source File: SawmillScreen.java From Survivalist with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override protected void func_230450_a_(MatrixStack matrixStack, float partialTicks, int mouseX, int mouseY) { RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); this.field_230706_i_.getTextureManager().bindTexture(GUI_TEXTURE_LOCATION); int x = this.guiLeft; int y = this.guiTop; this.func_238474_b_(matrixStack, x, y, 0, 0, xSize, ySize); if (container.isBurning()) { int k = this.getBurnLeftScaled(13); this.func_238474_b_(matrixStack, x + 56, y + 36 + 12 - k, 176, 12 - k, 14, k + 1); } int l = this.getCookProgressScaled(24); this.func_238474_b_(matrixStack, x + 79, y + 34, 176, 14, l + 1, 16); }
Example #5
Source File: GuiSelectionScreen.java From XRay-Mod with GNU General Public License v3.0 | 6 votes |
@Override // @mcp: func_230432_a_ = render public void func_230432_a_(MatrixStack stack, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTicks) { BlockData blockData = this.block; FontRenderer font = Minecraft.getInstance().fontRenderer; // @mcp: func_238407_a_ = drawString font.func_238407_a_(stack, ITextProperties.func_240652_a_(blockData.getEntryName()), left + 40, top + 7, 0xFFFFFF); font.func_238407_a_(stack, ITextProperties.func_240652_a_(blockData.isDrawing() ? "Enabled" : "Disabled"), left + 40, top + 17, blockData.isDrawing() ? Color.GREEN.getRGB() : Color.RED.getRGB()); RenderHelper.enableStandardItemLighting(); Minecraft.getInstance().getItemRenderer().renderItemAndEffectIntoGUI(blockData.getItemStack(), left + 15, top + 7); RenderHelper.disableStandardItemLighting(); if (mouseX > left && mouseX < (left + entryWidth) && mouseY > top && mouseY < (top + entryHeight) && mouseY < (this.parent.getTop() + this.parent.getHeight()) && mouseY > this.parent.getTop()) { this.parent.parent.func_238654_b_( stack, Arrays.asList(new TranslationTextComponent("xray.tooltips.edit1"), new TranslationTextComponent("xray.tooltips.edit2")), left + 15, (entryIdx == this.parent.func_231039_at__().size() - 1 ? (top - (entryHeight - 20)) : (top + (entryHeight + 15))) // @mcp: func_231039_at__ = getEntries ); // @mcp: func_230457_a_ = renderTooltip } RenderSystem.enableAlphaTest(); RenderSystem.enableBlend(); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); Minecraft.getInstance().getRenderManager().textureManager.bindTexture(GuiSelectionScreen.CIRCLE); GuiBase.drawTexturedQuadFit((left + entryWidth) - 37, top + (entryHeight / 2f) - 9, 14, 14, new int[]{255, 255, 255}, 50f); GuiBase.drawTexturedQuadFit((left + entryWidth) - 35, top + (entryHeight / 2f) - 7, 10, 10, blockData.getColor()); RenderSystem.disableAlphaTest(); RenderSystem.disableBlend(); }
Example #6
Source File: ScrollingList.java From XRay-Mod with GNU General Public License v3.0 | 5 votes |
@Override // @mcp: func_230430_a_ = render public void func_230430_a_(MatrixStack stack, int mouseX, int mouseY, float partialTicks) { double scale = Minecraft.getInstance().getMainWindow().getGuiScaleFactor(); GL11.glEnable(GL11.GL_SCISSOR_TEST); GL11.glScissor((int)(this.field_230675_l_ * scale), (int)(Minecraft.getInstance().getMainWindow().getFramebufferHeight() - ((this.field_230672_i_ + this.field_230671_e_) * scale)), (int)(this.field_230670_d_ * scale), (int)(this.field_230671_e_ * scale)); super.func_230430_a_(stack, mouseX, mouseY, partialTicks); GL11.glDisable(GL11.GL_SCISSOR_TEST); }
Example #7
Source File: GuiBlockList.java From XRay-Mod with GNU General Public License v3.0 | 5 votes |
@Override // @mcp; render public void func_230432_a_(MatrixStack stack, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTicks) { FontRenderer font = this.parent.field_230668_b_.fontRenderer; // @mcp: field_230668_b_ = minecraft ResourceLocation resource = this.block.getItemStack().getItem().getRegistryName(); font.func_238407_a_(stack,this.block.getItemStack().getItem().getName(), left + 40, top + 7, Color.WHITE.getRGB()); // @mcp: func_238407_a_ = drawString font.func_238407_a_(stack, ITextProperties.func_240652_a_(resource != null ? resource.getNamespace() : ""), left + 40, top + 17, Color.WHITE.getRGB()); // @mcp: func_238407_a_ = drawString // @mcp: func_240652_a_ = unknown... Code recommendation RenderHelper.enableStandardItemLighting(); this.parent.field_230668_b_.getItemRenderer().renderItemAndEffectIntoGUI(this.block.getItemStack(), left + 15, top + 7); // @mcp: field_230668_b_ = minecraft RenderHelper.disableStandardItemLighting(); }
Example #8
Source File: GuiSelectionScreen.java From XRay-Mod with GNU General Public License v3.0 | 5 votes |
@Override public void renderExtra(MatrixStack stack, int x, int y, float partialTicks) { this.search.func_230430_a_(stack, x, y, partialTicks); // @mcp: func_230430_a_ = render this.scrollList.func_230430_a_(stack, x, y, partialTicks ); // @mcp: func_230430_a_ = render // @mcp: func_238405_a_ = drawStringWithShadow if (!search.func_230999_j_() && search.getText().equals("")) // @mcp: func_230999_j_ = isFocused XRay.mc.fontRenderer.func_238405_a_(stack, I18n.format("xray.single.search"), (float) getWidth() / 2 - 130, (float) getHeight() / 2 - 101, Color.GRAY.getRGB()); }
Example #9
Source File: GuiEdit.java From XRay-Mod with GNU General Public License v3.0 | 5 votes |
@Override public void renderExtra(MatrixStack stack, int x, int y, float partialTicks) { getFontRender().func_238405_a_(stack, this.block.getItemStack().getDisplayName().getString(), getWidth() / 2f - 138, getHeight() / 2f - 90, 0xffffff); // @mcp: func_238405_a_ = drawtextwithshadow oreName.func_230430_a_(stack, x, y, partialTicks); // @mcp: func_230430_a_ = render GuiAddBlock.renderPreview(getWidth() / 2 - 138, getHeight() / 2 - 40, (float) redSlider.getValue(), (float) greenSlider.getValue(), (float) blueSlider.getValue()); RenderHelper.enableStandardItemLighting(); this.field_230707_j_.renderItemAndEffectIntoGUI(this.block.getItemStack(), getWidth() / 2 + 50, getHeight() / 2 - 105); // @mcp: field_230707_j_ = itemRenderer RenderHelper.disableStandardItemLighting(); }
Example #10
Source File: DryingRackScreen.java From Survivalist with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override protected void func_230450_a_(MatrixStack matrixStack, float p_230450_2_, int p_230450_3_, int p_230450_4_) { RenderSystem.color4f(1.0f, 1.0f, 1.0f, 1.0f); int x = (field_230708_k_ - xSize) / 2; int y = (field_230709_l_ - ySize) / 2; field_230706_i_.textureManager.bindTexture(guiTextureLocation); this.func_238474_b_(matrixStack, x, y, 0, 0, xSize, ySize); for (int s = 0; s < container.dryTimeRemainingArray.size(); s++) { int mt = DryingRecipe.getDryingTime(field_230706_i_.world, container.getSlot(s).getStack()); int ct = container.dryTimeRemainingArray.get(s); if (ct > 0 && mt > 0) { int sx = x + 44 + 36 * s; int ny = (int) Math.ceil(ct * 20.0 / mt); int sy = 20 - ny; this.func_238474_b_(matrixStack, sx, y + 32 + sy, 176, sy, 9, ny); } } }
Example #11
Source File: GuiAddBlock.java From XRay-Mod with GNU General Public License v3.0 | 5 votes |
@Override public void renderExtra(MatrixStack stack, int x, int y, float partialTicks) { // @mcp: func_238405_a_ = drawStringWithShadow // @mcp: func_235333_g_ = getNameTextComponent getFontRender().func_238405_a_(stack, selectBlock.func_235333_g_().getString(), getWidth() / 2f - 100, getHeight() / 2f - 90, 0xffffff); oreName.func_230430_a_(stack, x, y, partialTicks); // @mcp: func_230430_a_ = render renderPreview(getWidth() / 2 - 100, getHeight() / 2 - 40, (float) redSlider.getValue(), (float) greenSlider.getValue(), (float) blueSlider.getValue()); RenderHelper.enableStandardItemLighting(); this.field_230707_j_.renderItemAndEffectIntoGUI(this.itemStack, getWidth() / 2 + 85, getHeight() / 2 - 105); // @mcp: field_230707_j_ = itemRender RenderHelper.disableStandardItemLighting(); }
Example #12
Source File: GuiHelp.java From XRay-Mod with GNU General Public License v3.0 | 5 votes |
@Override public void renderExtra(MatrixStack stack, int x, int y, float partialTicks) { float lineY = (getHeight() / 2f) - 85; for (LinedText linedText : areas) { for (String line : linedText.getLines()) { lineY += 12; this.getFontRender().func_238405_a_(stack, line,(getWidth() / 2f) - 176, lineY, Color.WHITE.getRGB()); // @mcp: func_238405_a_ = drawtextwithshadow } lineY += 10; } }
Example #13
Source File: ChoppingBlockRenderer.java From Survivalist with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void render(ChoppingBlockTileEntity te, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffer, int p_225616_5_, int p_225616_6_) { BlockState state = te.getWorld().getBlockState(te.getPos()); if (!(state.getBlock() instanceof ChoppingBlock)) return; //if (destroyStage < 0) { matrixStack.push(); ItemRenderer itemRenderer = mc.getItemRenderer(); LazyOptional<IItemHandler> linv = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY); linv.ifPresent((inv) -> { ItemStack stack = inv.getStackInSlot(0); if (stack.getCount() > 0) { matrixStack.push(); matrixStack.translate(0.5, 0.5, 0.5); matrixStack.translate(0, -4.5 / 16.0f, 0); matrixStack.scale(2, 2, 2); IBakedModel ibakedmodel = itemRenderer.getItemModelWithOverrides(stack, te.getWorld(), (LivingEntity) null); itemRenderer.renderItem(stack, ItemCameraTransforms.TransformType.GROUND, true, matrixStack, buffer, p_225616_5_, p_225616_6_, ibakedmodel); /*int breakStage = te.getBreakStage(); if (breakStage >= 0) { renderItem(stack, ItemCameraTransforms.TransformType.GROUND, breakStage); }*/ matrixStack.pop(); } }); matrixStack.pop(); } }
Example #14
Source File: WrappedItemModel.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
protected void renderWrapped(ItemStack stack, TransformType transformType, MatrixStack mStack, IRenderTypeBuffer getter, int packedLight, int packedOverlay) { IBakedModel model = wrapped.getOverrides().getModelWithOverrides(wrapped, stack, world, entity); ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); RenderType rType = RenderTypeLookup.getRenderType(stack); if (transformType == TransformType.GUI && Objects.equals(rType, Atlases.getTranslucentBlockType())) { rType = Atlases.getTranslucentCullBlockType(); } IVertexBuilder builder = ItemRenderer.getBuffer(getter, rType, true, stack.hasEffect()); itemRenderer.renderModel(model, stack, packedLight, packedOverlay, mStack, builder); }
Example #15
Source File: AbstractBakedPropertiesModel.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
@Override public IBakedModel handlePerspective(TransformType transformType, MatrixStack mat) { if (properties instanceof PerspectiveProperties) { ImmutableMap<TransformType, TransformationMatrix> transforms = ((PerspectiveProperties) properties).getTransforms(); return PerspectiveMapWrapper.handlePerspective(this, transforms, transformType, mat); } return IModelParticleProvider.super.handlePerspective(transformType, mat); }
Example #16
Source File: CCBlockRendererDispatcher.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void renderBlock(BlockState blockStateIn, MatrixStack matrixStackIn, IRenderTypeBuffer bufferTypeIn, int combinedLightIn, int combinedOverlayIn, IModelData modelData) { Optional<ICCBlockRenderer> renderOpt = BlockRenderingRegistry.getBlockRenderers().stream().filter(e -> e.canHandleEntity(blockStateIn)).findFirst(); if (renderOpt.isPresent()) { renderOpt.get().renderEntity(blockStateIn, matrixStackIn, bufferTypeIn, combinedLightIn, combinedOverlayIn, modelData); } else { parentDispatcher.renderBlock(blockStateIn, matrixStackIn, bufferTypeIn, combinedLightIn, combinedOverlayIn, modelData); } }
Example #17
Source File: CCBlockRendererDispatcher.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void renderModel(BlockState state, BlockPos pos, ILightReader world, MatrixStack matrixStackIn, IVertexBuilder vertexBuilderIn, IModelData data) { Optional<ICCBlockRenderer> renderOpt = BlockRenderingRegistry.getBlockRenderers().stream().filter(e -> e.canHandleBlock(world, pos, state)).findFirst(); if (renderOpt.isPresent()) { renderOpt.get().renderBreaking(state, pos, world, matrixStackIn, vertexBuilderIn, data); } else { parentDispatcher.renderModel(state, pos, world, matrixStackIn, vertexBuilderIn, data); } }
Example #18
Source File: BlockOverlayRender.java From MiningGadgets with MIT License | 5 votes |
public static void render(RenderWorldLastEvent event, ItemStack item) { final Minecraft mc = Minecraft.getInstance(); IRenderTypeBuffer.Impl buffer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource(); int range = MiningProperties.getBeamRange(item); BlockRayTraceResult lookingAt = VectorHelper.getLookingAt(mc.player, RayTraceContext.FluidMode.NONE, range); if (mc.world.getBlockState(VectorHelper.getLookingAt(mc.player, item, range).getPos()) == Blocks.AIR.getDefaultState()) { return; } List<BlockPos> coords = MiningCollect.collect(mc.player, lookingAt, mc.world, MiningProperties.getRange(item)); Vec3d view = mc.gameRenderer.getActiveRenderInfo().getProjectedView(); MatrixStack matrix = event.getMatrixStack(); matrix.push(); matrix.translate(-view.getX(), -view.getY(), -view.getZ()); IVertexBuilder builder; builder = buffer.getBuffer(MyRenderType.BlockOverlay); coords.forEach(e -> { if (mc.world.getBlockState(e).getBlock() != ModBlocks.RENDER_BLOCK.get()) { matrix.push(); matrix.translate(e.getX(), e.getY(), e.getZ()); matrix.translate(-0.005f, -0.005f, -0.005f); matrix.scale(1.01f, 1.01f, 1.01f); matrix.rotate(Vector3f.YP.rotationDegrees(-90.0F)); Matrix4f positionMatrix = matrix.getLast().getMatrix(); BlockOverlayRender.render(positionMatrix, builder, e, Color.GREEN); matrix.pop(); } }); matrix.pop(); RenderSystem.disableDepthTest(); buffer.finish(MyRenderType.BlockOverlay); }
Example #19
Source File: TankLayerRenderer.java From EnderStorage with MIT License | 5 votes |
@Override public void render(MatrixStack mStack, IRenderTypeBuffer getter, int packedLight, AbstractClientPlayerEntity entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { if (UUIDS.contains(entity.getUniqueID())) { CCRenderState ccrs = CCRenderState.instance(); ccrs.brightness = packedLight; ccrs.overlay = OverlayTexture.NO_OVERLAY; Matrix4 mat = new Matrix4(mStack); mat.rotate(MathHelper.torad * 180, Vector3.X_POS); mat.scale(0.5); if (entity.isShiftKeyDown()) { mat.translate(0, -0.5, 0); } if (entity.isElytraFlying()) { headPitch = -45; } mat.rotate(netHeadYaw * MathHelper.torad, Vector3.Y_NEG); mat.rotate(headPitch * MathHelper.torad, Vector3.X_POS); mat.translate(-0.5, 1, -0.5); RenderTileEnderTank.renderTank(ccrs, mat, getter, 0, (float) (MathHelper.torad * 90F), 0, BLANK, 0); FluidStack stack = FluidUtils.water.copy(); float bob = 0.45F + RenderUtils.getPearlBob(ClientUtils.getRenderTime()) * 2; stack.setAmount((int) MathHelper.map(bob, 0.2, 0.6, 1000, 14000)); mat.translate(-0.5, 0, -0.5); RenderTileEnderTank.renderFluid(ccrs, mat, getter, stack); } }
Example #20
Source File: CCRenderItem.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void renderItem(ItemStack stack, ItemCameraTransforms.TransformType transformType, boolean leftHand, MatrixStack mStack, IRenderTypeBuffer getter, int packedLight, int packedOverlay, IBakedModel modelIn) { if (modelIn instanceof IItemRenderer) { mStack.push(); IBakedModel handled = ForgeHooksClient.handleCameraTransforms(mStack, modelIn, transformType, leftHand); mStack.translate(-0.5D, -0.5D, -0.5D); //If anyone doesnt return an IItemRenderer from here, your doing it wrong. ((IItemRenderer) handled).renderItem(stack, transformType, mStack, getter, packedLight, packedOverlay); mStack.pop(); } super.renderItem(stack, transformType, leftHand, mStack, getter, packedLight, packedOverlay, modelIn); }
Example #21
Source File: RenderTileEnderChest.java From EnderStorage with MIT License | 5 votes |
@Override public void render(TileEnderChest enderChest, float partialTicks, MatrixStack mStack, IRenderTypeBuffer getter, int packedLight, int packedOverlay) { CCRenderState ccrs = CCRenderState.instance(); ccrs.brightness = packedLight; ccrs.overlay = packedOverlay; double yToCamera = enderChest.getPos().getY() - renderDispatcher.renderInfo.getProjectedView().y; renderChest(ccrs, mStack, getter, enderChest.rotation, yToCamera, enderChest.getFrequency(), (float) enderChest.getRadianLidAngle(partialTicks), RenderUtils.getTimeOffset(enderChest.getPos())); }
Example #22
Source File: RenderTileEnderChest.java From EnderStorage with MIT License | 5 votes |
public static void renderChest(CCRenderState ccrs, MatrixStack mStack, IRenderTypeBuffer getter, int rotation, double yToCamera, Frequency freq, float lidAngle, int pearlOffset) { Matrix4 mat = new Matrix4(mStack); if (lidAngle != 0) {//Micro optimization, lid closed, dont render starfield. renderEndPortal.render(mat, getter, yToCamera); } ccrs.reset(); mStack.push(); mStack.translate(0, 1.0, 1.0); mStack.scale(1.0F, -1.0F, -1.0F); mStack.translate(0.5, 0.5, 0.5); mStack.rotate(new Quaternion(0, rotation * 90, 0, true)); mStack.translate(-0.5, -0.5, -0.5); model.chestLid.rotateAngleX = lidAngle; model.render(mStack, getter.getBuffer(chestType), ccrs.brightness, ccrs.overlay, freq.hasOwner()); mStack.pop(); //Buttons ccrs.bind(buttonType, getter); EnumColour[] colours = freq.toArray(); for (int i = 0; i < 3; i++) { CCModel button = ButtonModelLibrary.button.copy(); button.apply(BlockEnderChest.buttonT[i]); button.apply(new Translation(0.5, 0, 0.5)); button.apply(new Rotation(lidAngle, 1, 0, 0).at(new Vector3(0, 9D / 16D, 1 / 16D))); button.apply(new Rotation((-90 * (rotation)) * MathHelper.torad, Vector3.Y_POS).at(new Vector3(0.5, 0, 0.5))); button.render(ccrs, mat, new UVTranslation(0.25 * (colours[i].getWoolMeta() % 4), 0.25 * (colours[i].getWoolMeta() / 4))); } mat.translate(0.5, 0, 0.5); //Pearl if (lidAngle != 0) {//Micro optimization, lid closed, dont render pearl. double time = ClientUtils.getRenderTime() + pearlOffset; Matrix4 pearlMat = RenderUtils.getMatrix(mat.copy(), new Vector3(0, 0.2 + lidAngle * -0.5 + RenderUtils.getPearlBob(time), 0), new Rotation(time / 3, new Vector3(0, 1, 0)), 0.04); ccrs.brightness = 15728880; ccrs.bind(pearlType, getter); CCModelLibrary.icosahedron4.render(ccrs, pearlMat); } ccrs.reset(); }
Example #23
Source File: RenderTileEnderTank.java From EnderStorage with MIT License | 5 votes |
@Override public void render(TileEnderTank enderTank, float partialTicks, MatrixStack mStack, IRenderTypeBuffer getter, int packedLight, int packedOverlay) { CCRenderState ccrs = CCRenderState.instance(); ccrs.brightness = packedLight; ccrs.overlay = packedOverlay; float valveRot = (float) MathHelper.interpolate(enderTank.pressure_state.b_rotate, enderTank.pressure_state.a_rotate, partialTicks) * 0.01745F; int pearlOffset = RenderUtils.getTimeOffset(enderTank.getPos()); Matrix4 mat = new Matrix4(mStack); double yToCamera = enderTank.getPos().getY() - renderDispatcher.renderInfo.getProjectedView().y; renderTank(ccrs, mat.copy(), getter, enderTank.rotation, valveRot, yToCamera, enderTank.getFrequency(), pearlOffset); renderFluid(ccrs, mat, getter, enderTank.liquid_state.c_liquid); ccrs.reset(); }
Example #24
Source File: ModelEnderChest.java From EnderStorage with MIT License | 5 votes |
public void render(MatrixStack stack, IVertexBuilder builder, int packedLight, int packedOverlay, boolean personal) { chestKnob.rotateAngleX = chestLid.rotateAngleX; diamondKnob.rotateAngleX = chestLid.rotateAngleX; chestLid.render(stack, builder, packedLight, packedOverlay); chestBelow.render(stack, builder, packedLight, packedOverlay); if (personal) { diamondKnob.render(stack, builder, packedLight, packedOverlay); } else { chestKnob.render(stack, builder, packedLight, packedOverlay); } }
Example #25
Source File: EnderTankItemRender.java From EnderStorage with MIT License | 5 votes |
@Override public void renderItem(ItemStack stack, TransformType transformType, MatrixStack mStack, IRenderTypeBuffer getter, int packedLight, int packedOverlay) { CCRenderState ccrs = CCRenderState.instance(); ccrs.reset(); ccrs.brightness = packedLight; ccrs.overlay = packedOverlay; Frequency freq = Frequency.readFromStack(stack); FluidStack fluid = TankSynchroniser.getClientLiquid(freq); Matrix4 mat = new Matrix4(mStack); RenderTileEnderTank.renderTank(ccrs, mat, getter, 2, (float) (MathHelper.torad * 90F), 0, freq, 0); mat.translate(-0.5, 0, -0.5); RenderTileEnderTank.renderFluid(ccrs, mat, getter, fluid); }
Example #26
Source File: EnderChestItemRender.java From EnderStorage with MIT License | 5 votes |
@Override public void renderItem(ItemStack stack, TransformType transformType, MatrixStack mStack, IRenderTypeBuffer getter, int packedLight, int packedOverlay) { CCRenderState ccrs = CCRenderState.instance(); ccrs.reset(); Frequency freq = Frequency.readFromStack(stack); ccrs.brightness = packedLight; ccrs.overlay = packedOverlay; RenderTileEnderChest.renderChest(ccrs, mStack, getter, 2, 0, freq, 0, 0); }
Example #27
Source File: RenderMiningLaser.java From MiningGadgets with MIT License | 4 votes |
private static void drawLasers(RenderWorldLastEvent event, Vec3d from, RayTraceResult trace, double xOffset, double yOffset, double zOffset, float r, float g, float b, float thickness, PlayerEntity player, float ticks, float speedModifier) { Hand activeHand; if (player.getHeldItemMainhand().getItem() instanceof MiningGadget) { activeHand = Hand.MAIN_HAND; } else if (player.getHeldItemOffhand().getItem() instanceof MiningGadget) { activeHand = Hand.OFF_HAND; } else { return; } ItemStack stack = player.getHeldItem(activeHand); double distance = from.subtract(trace.getHitVec()).length(); long gameTime = player.world.getGameTime(); double v = gameTime * speedModifier; float additiveThickness = (thickness * 3.5f) * calculateLaserFlickerModifier(gameTime); BufferBuilder wr = Tessellator.getInstance().getBuffer(); Vec3d view = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView(); MatrixStack matrix = event.getMatrixStack(); matrix.translate(view.getX(), view.getY(), view.getZ()); if( trace.getType() == RayTraceResult.Type.MISS ) matrix.translate(-from.x, -from.y, -from.z); RenderSystem.pushMatrix(); RenderSystem.multMatrix(matrix.getLast().getMatrix()); RenderSystem.enableColorMaterial(); // This makes it so we don't clip into the world, we're effectively drawing on it RenderSystem.disableDepthTest(); RenderSystem.enableBlend(); //This makes it so multiplayer doesn't matter which side the player is standing on to see someone elses laser RenderSystem.disableCull(); RenderSystem.enableTexture(); RenderSystem.rotatef(MathHelper.lerp(ticks, -player.rotationYaw, -player.prevRotationYaw), 0, 1, 0); RenderSystem.rotatef(MathHelper.lerp(ticks, player.rotationPitch, player.prevRotationPitch), 1, 0, 0); // additive laser beam RenderSystem.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); RenderSystem.color4f(r, g, b, 0.7f); Minecraft.getInstance().getTextureManager().bindTexture(laserBeamGlow); drawBeam(xOffset, yOffset, zOffset, additiveThickness, activeHand, distance, wr, 0.5, 1, ticks); // main laser, colored part RenderSystem.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); RenderSystem.color4f(r, g, b, 1.0f); Minecraft.getInstance().getTextureManager().bindTexture(laserBeam2); drawBeam(xOffset, yOffset, zOffset, thickness, activeHand, distance, wr, v, v + distance * 1.5, ticks); // white core RenderSystem.color4f(MiningProperties.getColor(stack, MiningProperties.COLOR_RED_INNER) / 255f, MiningProperties.getColor(stack, MiningProperties.COLOR_GREEN_INNER) / 255f, MiningProperties.getColor(stack, MiningProperties.COLOR_BLUE_INNER) / 255f, 1.0f); Minecraft.getInstance().getTextureManager().bindTexture(laserBeam); drawBeam(xOffset, yOffset, zOffset, thickness / 2, activeHand, distance, wr, v, v + distance * 1.5, ticks); RenderSystem.enableDepthTest(); RenderSystem.enableCull(); RenderSystem.popMatrix(); }
Example #28
Source File: RenderMiningLaser2.java From MiningGadgets with MIT License | 4 votes |
private static void drawLasers(RenderWorldLastEvent event, Vec3d from, RayTraceResult trace, double xOffset, double yOffset, double zOffset, float r, float g, float b, float thickness, PlayerEntity player, float ticks, float speedModifier) { Hand activeHand; if (player.getHeldItemMainhand().getItem() instanceof MiningGadget) { activeHand = Hand.MAIN_HAND; } else if (player.getHeldItemOffhand().getItem() instanceof MiningGadget) { activeHand = Hand.OFF_HAND; } else { return; } IVertexBuilder builder; ItemStack stack = player.getHeldItem(activeHand); double distance = from.subtract(trace.getHitVec()).length(); long gameTime = player.world.getGameTime(); double v = gameTime * speedModifier; float additiveThickness = (thickness * 3.5f) * calculateLaserFlickerModifier(gameTime); float beam2r = MiningProperties.getColor(stack, MiningProperties.COLOR_RED_INNER) / 255f; float beam2g = MiningProperties.getColor(stack, MiningProperties.COLOR_GREEN_INNER) / 255f; float beam2b =MiningProperties.getColor(stack, MiningProperties.COLOR_BLUE_INNER) / 255f; Vec3d view = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView(); IRenderTypeBuffer.Impl buffer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource(); MatrixStack matrix = event.getMatrixStack(); matrix.push(); matrix.translate(-view.getX(), -view.getY(), -view.getZ()); matrix.translate(from.x, from.y, from.z); matrix.rotate(Vector3f.YP.rotationDegrees(MathHelper.lerp(ticks, -player.rotationYaw, -player.prevRotationYaw))); matrix.rotate(Vector3f.XP.rotationDegrees(MathHelper.lerp(ticks, player.rotationPitch, player.prevRotationPitch))); MatrixStack.Entry matrixstack$entry = matrix.getLast(); Matrix3f matrixNormal = matrixstack$entry.getNormal(); Matrix4f positionMatrix = matrixstack$entry.getMatrix(); //additive laser beam builder = buffer.getBuffer(MyRenderType.LASER_MAIN_ADDITIVE); drawBeam(xOffset, yOffset, zOffset, builder, positionMatrix, matrixNormal, additiveThickness, activeHand, distance, 0.5, 1, ticks, r,g,b,0.7f); //main laser, colored part builder = buffer.getBuffer(MyRenderType.LASER_MAIN_BEAM); drawBeam(xOffset, yOffset, zOffset, builder, positionMatrix, matrixNormal, thickness, activeHand, distance, v, v + distance * 1.5, ticks, r,g,b,1f); //core builder = buffer.getBuffer(MyRenderType.LASER_MAIN_CORE); drawBeam(xOffset, yOffset, zOffset, builder, positionMatrix, matrixNormal, thickness/2, activeHand, distance, v, v + distance * 1.5, ticks, beam2r,beam2g,beam2b,1f); matrix.pop(); RenderSystem.disableDepthTest(); buffer.finish(); }
Example #29
Source File: GuiBlockList.java From XRay-Mod with GNU General Public License v3.0 | 4 votes |
@Override public void renderExtra(MatrixStack stack, int x, int y, float partialTicks) { search.func_230430_a_(stack, x, y, partialTicks); // @mcp: func_230430_a_ = render blockList.func_230430_a_(stack, x, y, partialTicks); // @mcp: func_230430_a_ = render }
Example #30
Source File: DryingRackRenderer.java From Survivalist with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void render(DryingRackTileEntity te, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffer, int combinedLightIn, int combinedOverlayIn) { BlockState state = te.getWorld().getBlockState(te.getPos()); if (state.getBlock() != SurvivalistBlocks.RACK.get()) return; te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).ifPresent((inv) -> { matrixStack.push(); // pushMatrix float angle = -state.get(DryingRackBlock.FACING).getHorizontalAngle(); matrixStack.translate(0.5, 0.5, 0.5); // translate matrixStack.rotate(Vector3f.YP.rotationDegrees(angle)); // rotate matrixStack.translate(-0.5, -0.5, -0.5); // translate //matrixStack.func_227863_a_(Vector3f.field_229183_f_.func_229187_a_(180)); Minecraft mc = Minecraft.getInstance(); ItemRenderer itemRenderer = mc.getItemRenderer(); for (int i = 0; i < 4; i++) { ItemStack stack = inv.getStackInSlot(i); if (stack.getCount() > 0) { matrixStack.push(); // pushMatrix float zz = (i - 1.5f) * 0.1875f; matrixStack.translate(0, 0, zz); // translate matrixStack.scale(0.7f, 0.7f, 0.7f); // scale matrixStack.translate(0.715, 0.93, 0.635); // translate matrixStack.rotate(Vector3f.YP.rotationDegrees(180)); // rotate IBakedModel ibakedmodel = itemRenderer.getItemModelWithOverrides(stack, te.getWorld(), (LivingEntity) null); itemRenderer.renderItem(stack, ItemCameraTransforms.TransformType.FIXED, true, matrixStack, buffer, combinedLightIn, combinedOverlayIn, ibakedmodel); // renderItem matrixStack.pop(); // popMatrix } } matrixStack.pop(); // popMatrix }); }