net.minecraft.client.renderer.texture.OverlayTexture Java Examples
The following examples show how to use
net.minecraft.client.renderer.texture.OverlayTexture.
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: 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 #2
Source File: RenderMiningLaser2.java From MiningGadgets with MIT License | 4 votes |
private static void drawBeam(double xOffset, double yOffset, double zOffset, IVertexBuilder builder, Matrix4f positionMatrix, Matrix3f matrixNormalIn, float thickness, Hand hand, double distance, double v1, double v2, float ticks, float r, float g, float b, float alpha) { Vector3f vector3f = new Vector3f(0.0f, 1.0f, 0.0f); vector3f.transform(matrixNormalIn); ClientPlayerEntity player = Minecraft.getInstance().player; // Support for hand sides remembering to take into account of Skin options if( Minecraft.getInstance().gameSettings.mainHand != HandSide.RIGHT ) hand = hand == Hand.MAIN_HAND ? Hand.OFF_HAND : Hand.MAIN_HAND; float startXOffset = -0.25f; float startYOffset = -.115f; float startZOffset = 0.65f + (1 - player.getFovModifier()); if (hand == Hand.OFF_HAND) { startYOffset = -.120f; startXOffset = 0.25f; } float f = (MathHelper.lerp(ticks, player.prevRotationPitch, player.rotationPitch) - MathHelper.lerp(ticks, player.prevRenderArmPitch, player.renderArmPitch)); float f1 = (MathHelper.lerp(ticks, player.prevRotationYaw, player.rotationYaw) - MathHelper.lerp(ticks, player.prevRenderArmYaw, player.renderArmYaw)); startXOffset = startXOffset + (f1 / 100000000); startYOffset = startYOffset + (f / 100000000); Vector4f vec1 = new Vector4f(startXOffset, -thickness + startYOffset, startZOffset, 1.0F); vec1.transform(positionMatrix); Vector4f vec2 = new Vector4f((float) xOffset, -thickness + (float) yOffset, (float) distance + (float) zOffset, 1.0F); vec2.transform(positionMatrix); Vector4f vec3 = new Vector4f((float) xOffset, thickness + (float) yOffset, (float) distance + (float) zOffset, 1.0F); vec3.transform(positionMatrix); Vector4f vec4 = new Vector4f(startXOffset, thickness + startYOffset, startZOffset, 1.0F); vec4.transform(positionMatrix); if (hand == Hand.MAIN_HAND) { builder.addVertex(vec4.getX(), vec4.getY(), vec4.getZ(), r, g, b, alpha, 0, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec3.getX(), vec3.getY(), vec3.getZ(), r, g, b, alpha, 0, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec2.getX(), vec2.getY(), vec2.getZ(), r, g, b, alpha, 1, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec1.getX(), vec1.getY(), vec1.getZ(), r, g, b, alpha, 1, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); //Rendering a 2nd time to allow you to see both sides in multiplayer, shouldn't be necessary with culling disabled but here we are.... builder.addVertex(vec1.getX(), vec1.getY(), vec1.getZ(), r, g, b, alpha, 1, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec2.getX(), vec2.getY(), vec2.getZ(), r, g, b, alpha, 1, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec3.getX(), vec3.getY(), vec3.getZ(), r, g, b, alpha, 0, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec4.getX(), vec4.getY(), vec4.getZ(), r, g, b, alpha, 0, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); } else { builder.addVertex(vec1.getX(), vec1.getY(), vec1.getZ(), r, g, b, alpha, 1, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec2.getX(), vec2.getY(), vec2.getZ(), r, g, b, alpha, 1, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec3.getX(), vec3.getY(), vec3.getZ(), r, g, b, alpha, 0, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec4.getX(), vec4.getY(), vec4.getZ(), r, g, b, alpha, 0, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); //Rendering a 2nd time to allow you to see both sides in multiplayer, shouldn't be necessary with culling disabled but here we are.... builder.addVertex(vec4.getX(), vec4.getY(), vec4.getZ(), r, g, b, alpha, 0, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec3.getX(), vec3.getY(), vec3.getZ(), r, g, b, alpha, 0, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec2.getX(), vec2.getY(), vec2.getZ(), r, g, b, alpha, 1, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec1.getX(), vec1.getY(), vec1.getZ(), r, g, b, alpha, 1, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); } }
Example #3
Source File: ICCBlockRenderer.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 3 votes |
/** * Called when vanilla is rendering breaking texture over your block. * Usually just render out your normal quads. * * @param state Your state. * @param pos Position. * @param world World. * @param mStack The {@link MatrixStack}. * @param builder The {@link IVertexBuilder} to add quads to. * @param data Any ModelData. */ default void renderBreaking(BlockState state, BlockPos pos, ILightReader world, MatrixStack mStack, IVertexBuilder builder, IModelData data) { CCRenderState ccrs = CCRenderState.instance(); ccrs.overlay = OverlayTexture.NO_OVERLAY; ccrs.brightness = WorldRenderer.getPackedLightmapCoords(world, state, pos); mStack.push(); renderBlock(state, pos, world, mStack, builder, new Random(), data); mStack.pop(); }