net.minecraft.client.render.RenderLayer Java Examples
The following examples show how to use
net.minecraft.client.render.RenderLayer.
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: HallowedRenderLayers.java From the-hallow with MIT License | 7 votes |
public static void init() { BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getTranslucent(), HallowedBlocks.TAINTED_GLASS, HallowedBlocks.TAINTED_GLASS_PANE, HallowedBlocks.SOUL_GLASS, HallowedBlocks.SOUL_GLASS_PANE, HallowedBlocks.HALLOWED_GATE, HallowedBlocks.WITCH_WATER_BUBBLE_COLUMN); BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutoutMipped(), HallowedBlocks.DECEASED_GRASS_BLOCK); BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), HallowedBlocks.BREAD_CRUMBS, HallowedBlocks.HALLOWED_TREASURE_CHEST, HallowedBlocks.INFUSION_ALTAR_BLOCK, HallowedBlocks.INFUSION_PILLAR_BLOCK, HallowedBlocks.RESTLESS_CACTUS, HallowedBlocks.TINY_PUMPKIN, HallowedBlocks.TOMBSTONE, HallowedBlocks.BRAMBLES, HallowedBlocks.DEADER_BUSH, HallowedBlocks.GLOOMSHROOM, HallowedBlocks.EERIE_GRASS, HallowedBlocks.TALL_EERIE_GRASS, HallowedBlocks.DEADWOOD_SAPLING, HallowedBlocks.DEADWOOD_DOOR, HallowedBlocks.DEADWOOD_TRAPDOOR, HallowedBlocks.DEADWOOD_VINES); BlockRenderLayerMap.INSTANCE.putFluids(RenderLayer.getSolid(), HallowedFluids.BLOOD, HallowedFluids.FLOWING_BLOOD); BlockRenderLayerMap.INSTANCE.putFluids(RenderLayer.getTranslucent(), HallowedFluids.WITCH_WATER, HallowedFluids.FLOWING_WITCH_WATER); }
Example #2
Source File: TreasureChestModel.java From the-hallow with MIT License | 7 votes |
public TreasureChestModel() { super(RenderLayer::getEntityCutoutNoCull); this.lid.addCuboid(0.0F, -5.0F, -14.0F, 14, 5, 14, 0.0F); this.lid.pivotX = 1.0F; this.lid.pivotY = 7.0F; this.lid.pivotZ = 15.0F; this.hatch = (new ModelPart(this, 0, 0)).setTextureSize(64, 64); this.hatch.addCuboid(-1.0F, -2.0F, -15.0F, 2, 4, 1, 0.0F); this.hatch.pivotX = 8.0F; this.hatch.pivotY = 7.0F; this.hatch.pivotZ = 15.0F; this.base = (new ModelPart(this, 0, 19)).setTextureSize(64, 64); this.base.addCuboid(0.0F, 0.0F, 0.0F, 14, 10, 14, 0.0F); this.base.pivotX = 1.0F; this.base.pivotY = 6.0F; this.base.pivotZ = 1.0F; }
Example #3
Source File: HallowedTreasureChestEntityRenderer.java From the-hallow with MIT License | 6 votes |
@Override public void render(HallowedTreasureChestEntity chest, float yaw, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light) { matrixStack.push(); // initial size and position matrixStack.translate(-0.275, 0.57, 0.275); matrixStack.multiply(INITIAL_ROTATION_X); matrixStack.scale(0.57f, 0.57f, 0.57f); // calculate interpolated render rotation from last rotation float interpolated = chest.previousRotation + (chest.rotation - chest.previousRotation) * tickDelta; matrixStack.translate(0.5, 0.5, 0.5); matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(interpolated)); matrixStack.translate(-0.5, -0.5, -0.5); // jiggle after finishing spin if (chest.getEndProgress() != 0) { matrixStack.translate(0.5, 0.5, 0.5); matrixStack.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion((float) MathHelper.sin(chest.getEndProgress()))); matrixStack.translate(-0.5f, -0.5f, -0.5f); } // render chest updateHingeProgress(chest, chestModel); chestModel.render(matrixStack, vertexConsumerProvider.getBuffer(RenderLayer.getEntityCutout(TEXTURE)), light, OverlayTexture.DEFAULT_UV, 1f, 1f, 1f, 1f); // finish matrixStack.pop(); }
Example #4
Source File: MixinSpriteIdentifier.java From MineLittlePony with MIT License | 6 votes |
@Inject(method = "getVertexConsumer(" + "Lnet/minecraft/client/render/VertexConsumerProvider;" + "Ljava/util/function/Function;" + ")" + "Lnet/minecraft/client/render/VertexConsumer;", at = @At("HEAD"), cancellable = true ) public void onGetBuffer(VertexConsumerProvider provider, Function<Identifier, RenderLayer> layerFunction, CallbackInfoReturnable<VertexConsumer> info) { if (LevitatingItemRenderer.usesTransparency()) { SpriteIdentifier self = (SpriteIdentifier)(Object)this; info.setReturnValue(self.getSprite().getTextureSpecificVertexConsumer(provider.getBuffer(LevitatingItemRenderer.getRenderLayer(self.getAtlasId())))); } }
Example #5
Source File: MagicGlow.java From MineLittlePony with MIT License | 6 votes |
public static RenderLayer getTintedTexturedLayer(Identifier texture, float red, float green, float blue, float alpha) { return RenderLayer.of("mlp_tint_layer", VertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL, 7, 256, true, true, RenderLayer.MultiPhaseParameters.builder() .texture(new Color(texture, red, green, blue, alpha)) .writeMaskState(COLOR_MASK) .alpha(ONE_TENTH_ALPHA) .transparency(GLOWING_TRANSPARENCY) .lightmap(DISABLE_LIGHTMAP) .overlay(DISABLE_OVERLAY_COLOR) .cull(DISABLE_CULLING) .build(true)); }
Example #6
Source File: ArmourFeature.java From MineLittlePony with MIT License | 6 votes |
private static <T extends LivingEntity, V extends BipedEntityModel<T> & IArmour> void renderArmourPart( MatrixStack matrices, VertexConsumerProvider provider, int light, boolean glint, V model, float r, float g, float b, IArmourTextureResolver<T> resolver, ArmourLayer layer, Identifier texture) { VertexConsumer vertices = ItemRenderer.method_27952(provider, RenderLayer.getArmorCutoutNoCull(texture), false, glint); model.setVariant(resolver.getArmourVariant(layer, texture)); model.render(matrices, vertices, light, OverlayTexture.DEFAULT_UV, r, g, b, 1); }
Example #7
Source File: LevitatingItemRenderer.java From MineLittlePony with MIT License | 5 votes |
public static RenderLayer getRenderLayer(Identifier texture) { if (!usesTransparency()) { return RenderLayer.getEntityTranslucent(texture); } return MagicGlow.getTintedTexturedLayer(texture, Color.r(tint), Color.g(tint), Color.b(tint), 0.8F); }
Example #8
Source File: LevitatingItemRenderer.java From MineLittlePony with MIT License | 5 votes |
public static RenderLayer getRenderLayer() { return getRenderLayer(SpriteAtlasTexture.BLOCK_ATLAS_TEX); }
Example #9
Source File: GlowingEyesFeature.java From MineLittlePony with MIT License | 5 votes |
public <V extends FeatureRendererContext<T, M> & IPonyRenderContext<T, M> & IGlowingRenderer> GlowingEyesFeature(V renderer) { super(renderer); layer = RenderLayer.getEyes(renderer.getEyeTexture()); }
Example #10
Source File: GlowingEyesFeature.java From MineLittlePony with MIT License | 5 votes |
@Override public RenderLayer getEyesTexture() { return layer; }
Example #11
Source File: CapeFeature.java From MineLittlePony with MIT License | 5 votes |
@Override public void render(MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, AbstractClientPlayerEntity player, float limbDistance, float limbAngle, float tickDelta, float age, float headYaw, float headPitch) { M model = getContextModel(); if (player.hasSkinTexture() && !player.isInvisible() && player.isPartVisible(PlayerModelPart.CAPE) && player.getCapeTexture() != null && player.getEquippedStack(EquipmentSlot.CHEST).getItem() != Items.ELYTRA) { stack.push(); model.transform(BodyPart.BODY, stack); stack.translate(0, 0.24F, 0); model.getBodyPart(BodyPart.BODY).rotate(stack); double capeX = MathHelper.lerp(tickDelta, player.capeX, player.prevCapeX) - MathHelper.lerp(tickDelta, player.prevX, player.getX()); double capeY = MathHelper.lerp(tickDelta, player.capeY, player.prevCapeY) - MathHelper.lerp(tickDelta, player.prevY, player.getY()); double capeZ = MathHelper.lerp(tickDelta, player.capeZ, player.prevCapeZ) - MathHelper.lerp(tickDelta, player.prevZ, player.getZ()); float motionYaw = player.prevBodyYaw + (player.bodyYaw - player.prevBodyYaw); double sin = MathHelper.sin(motionYaw * PI / 180); double cos = (-MathHelper.cos(motionYaw * PI / 180)); float capeMotionY = (float) capeY * 10; if (capeMotionY < -6) capeMotionY = -6; if (capeMotionY > 32) capeMotionY = 32; float capeMotionX = (float) (capeX * sin + capeZ * cos) * 100; float diagMotion = (float) (capeX * cos - capeZ * sin) * 100; if (capeMotionX < 0) capeMotionX = 0; float camera = MathHelper.lerp(tickDelta, player.prevStrideDistance, player.strideDistance); capeMotionY += MathHelper.sin(MathHelper.lerp(tickDelta, player.prevHorizontalSpeed, player.horizontalSpeed) * 6) * 32 * camera; stack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(2 + capeMotionX / 12 + capeMotionY)); stack.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion( diagMotion / 2)); stack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-diagMotion / 2)); stack.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(180)); stack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(90)); VertexConsumer vertices = renderContext.getBuffer(RenderLayer.getEntitySolid(player.getCapeTexture())); model.renderCape(stack, vertices, lightUv, OverlayTexture.DEFAULT_UV); stack.pop(); } }
Example #12
Source File: ParaspriteModel.java From MineLittlePony with MIT License | 5 votes |
public ParaspriteModel() { super(RenderLayer::getEntityTranslucent); child = false; textureHeight = 64; }
Example #13
Source File: AbstractGear.java From MineLittlePony with MIT License | 5 votes |
public AbstractGear() { super(RenderLayer::getEntitySolid); textureWidth = 64; textureHeight = 64; }
Example #14
Source File: MixinTexturedRenderLayers.java From MineLittlePony with MIT License | 5 votes |
@Inject(method = "getEntityCutout()Lnet/minecraft/client/render/RenderLayer;", at = @At("HEAD"), cancellable = true) private static void onGetItemOpaque(CallbackInfoReturnable<RenderLayer> info) { if (LevitatingItemRenderer.usesTransparency()) { info.setReturnValue(LevitatingItemRenderer.getRenderLayer()); } }
Example #15
Source File: MixinTexturedRenderLayers.java From MineLittlePony with MIT License | 5 votes |
@Inject(method = "getEntityTranslucentCull()Lnet/minecraft/client/render/RenderLayer;", at = @At("HEAD"), cancellable = true) private static void onGetItemTranslucent(CallbackInfoReturnable<RenderLayer> info) { if (LevitatingItemRenderer.usesTransparency()) { info.setReturnValue(LevitatingItemRenderer.getRenderLayer()); } }
Example #16
Source File: MixinItemRenderer.java From MineLittlePony with MIT License | 5 votes |
@Inject(method = "getArmorVertexConsumer(" + VertexConsumerProvider + RenderLayer + Boolean + Boolean + ")" + VertexConsumer, at = @At("HEAD"), cancellable = true) private static void onGetArmorVertexConsumer(VertexConsumerProvider provider, RenderLayer layer, boolean solid, boolean glint, CallbackInfoReturnable<VertexConsumer> info) { if (LevitatingItemRenderer.usesTransparency()) { info.setReturnValue(provider.getBuffer(LevitatingItemRenderer.getRenderLayer())); } }
Example #17
Source File: HallowedTreasureChestBlockEntityRenderer.java From the-hallow with MIT License | 5 votes |
@Override public void render(HallowedTreasureChestBlockEntity treasureChest, float partialTicks, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, int j) { matrixStack.push(); BlockState state; if(treasureChest.hasWorld()) { state = treasureChest.getCachedState(); } else { state = HallowedBlocks.HALLOWED_TREASURE_CHEST.getDefaultState(); } // initial translation to center chest -- default renders upside down. matrixStack.multiply(RIGHTSIDE_UP); matrixStack.translate(0.215, -0.57, -0.215); // rotate based on facing direction if (state.contains(HallowedTreasureChestBlock.FACING)) { switch (state.get(HallowedTreasureChestBlock.FACING)) { case NORTH: matrixStack.translate(0.57, 0, 0); matrixStack.multiply(SOUTH_ROTATION_QUAT); break; case EAST: matrixStack.translate(0.57, 0, -0.57); matrixStack.multiply(EAST_ROTATION_QUAT); break; case SOUTH: matrixStack.translate(0, 0, -0.57); matrixStack.multiply(NORTH_ROTATION_QUAT); break; case WEST: matrixStack.multiply(WEST_ROTATION_QUAT); break; default: break; } } // flip & scale to size matrixStack.multiply(NORTH_ROTATION_QUAT); matrixStack.scale(0.57f, 0.57f, 0.57f); // render chest chestModel.render(matrixStack, vertexConsumerProvider.getBuffer(RenderLayer.getEntityCutout(TEXTURE)), i, j, 1f, 1f, 1f, 1f); matrixStack.pop(); }
Example #18
Source File: GearFeature.java From MineLittlePony with MIT License | 4 votes |
private void renderGear(M model, T entity, IGear gear, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, float limbDistance, float limbAngle, float tickDelta) { gear.setLivingAnimations(model, entity); gear.setRotationAndAngles(model.getAttributes().isGoingFast, entity.getUuid(), limbDistance, limbAngle, model.getWobbleAmount(), tickDelta); RenderLayer layer = RenderLayer.getEntityTranslucent(gear.getTexture(entity, getContext())); VertexConsumer vertexConsumer = renderContext.getBuffer(layer); gear.renderPart(stack, vertexConsumer, lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1, entity.getUuid()); }
Example #19
Source File: MagicGlow.java From MineLittlePony with MIT License | 4 votes |
public static RenderLayer getRenderLayer() { return MAGIC; }
Example #20
Source File: IForgeBlock.java From patchwork-api with GNU Lesser General Public License v2.1 | 2 votes |
/** * Queries if this block should render in a given layer. * A custom {@link net.minecraft.client.render.model.BakedModel} can use {@link net.minecraftforge.client.MinecraftForgeClient#getRenderLayer()} to alter the model based on layer. */ default boolean canRenderInLayer(BlockState state, RenderLayer layer) { return this.getBlock().getRenderLayer() == layer; }
Example #21
Source File: IForgeBlockState.java From patchwork-api with GNU Lesser General Public License v2.1 | 2 votes |
/** * Queries if this block should render in a given layer. * A custom {@link net.minecraft.client.render.model.BakedModel} can use {@link net.minecraftforge.client.MinecraftForgeClient#getRenderLayer()} to alter the model based on layer. */ default boolean canRenderInLayer(RenderLayer layer) { return patchwork$getForgeBlock().canRenderInLayer(getBlockState(), layer); }