Posted November 22, 20204 yr I have created a custom shield but now it works not perfectly so my questions are: 1. how to set a costum texture because my shield has either the normal texture or no texture This is the Render class: package net.luis.cave.render; import java.util.List; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.mojang.datafixers.util.Pair; import net.luis.cave.model.EnderiteShieldModel; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.entity.model.ShieldModel; import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.client.renderer.model.ModelBakery; import net.minecraft.client.renderer.model.RenderMaterial; import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.client.renderer.tileentity.BannerTileEntityRenderer; import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; import net.minecraft.item.DyeColor; import net.minecraft.item.ItemStack; import net.minecraft.item.ShieldItem; import net.minecraft.tileentity.BannerPattern; import net.minecraft.tileentity.BannerTileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; public class EnderiteShieldRender extends ItemStackTileEntityRenderer { private final ShieldModel modelShield = new EnderiteShieldModel(); public void func_239207_a_(ItemStack p_239207_1_, ItemCameraTransforms.TransformType p_239207_2_, MatrixStack p_239207_3_, IRenderTypeBuffer p_239207_4_, int p_239207_5_, int p_239207_6_) { boolean flag = p_239207_1_.getChildTag("BlockEntityTag") != null; p_239207_3_.push(); p_239207_3_.scale(1.0F, -1.0F, -1.0F); RenderMaterial rendermaterial = new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation("cave:entity/enderite_shield.png")); // Show the Vanilla Textures -> RenderMaterial rendermaterial = flag ? ModelBakery.LOCATION_SHIELD_BASE : ModelBakery.LOCATION_SHIELD_NO_PATTERN; IVertexBuilder ivertexbuilder = rendermaterial.getSprite().wrapBuffer(ItemRenderer.func_239391_c_(p_239207_4_, this.modelShield .getRenderType(rendermaterial.getAtlasLocation()), true, p_239207_1_.hasEffect())); this.modelShield.func_228294_b_().render(p_239207_3_, ivertexbuilder, p_239207_5_, p_239207_6_, 1.0F, 1.0F, 1.0F, 1.0F); if (flag) { List<Pair<BannerPattern, DyeColor>> list = BannerTileEntity.func_230138_a_(ShieldItem.getColor(p_239207_1_), BannerTileEntity.func_230139_a_(p_239207_1_)); BannerTileEntityRenderer.func_241717_a_(p_239207_3_, p_239207_4_, p_239207_5_, p_239207_6_, this.modelShield.func_228293_a_(), rendermaterial, false, list, p_239207_1_.hasEffect()); } else { this.modelShield.func_228293_a_().render(p_239207_3_, ivertexbuilder, p_239207_5_, p_239207_6_, 1.0F, 1.0F, 1.0F, 1.0F); } p_239207_3_.pop(); } @Mod.EventBusSubscriber public static class ModAtlasTextures { @SubscribeEvent public static void onTextureStitchEvent(TextureStitchEvent.Pre event) { if (event.getMap().getTextureLocation() == AtlasTexture.LOCATION_BLOCKS_TEXTURE) { event.addSprite(ModelBakery.LOCATION_SHIELD_BASE.getAtlasLocation()); } } } } and my second Question: I use the vanila item models but the blocking model dosent work so what i have to change in the model: this is the shield model: { "parent": "builtin/entity", "gui_light": "front", "textures": { "particle": "block/dark_oak_planks" }, "display": { "thirdperson_righthand": { "rotation": [ 0, 90, 0 ], "translation": [ 10, 6, -4 ], "scale": [ 1, 1, 1 ] }, "thirdperson_lefthand": { "rotation": [ 0, 90, 0 ], "translation": [ 10, 6, 12 ], "scale": [ 1, 1, 1 ] }, "firstperson_righthand": { "rotation": [ 0, 180, 5 ], "translation": [ -10, 2, -10 ], "scale": [ 1.25, 1.25, 1.25 ] }, "firstperson_lefthand": { "rotation": [ 0, 180, 5 ], "translation": [ 10, 0, -10 ], "scale": [ 1.25, 1.25, 1.25 ] }, "gui": { "rotation": [ 15, -25, -5 ], "translation": [ 2, 3, 0 ], "scale": [ 0.65, 0.65, 0.65 ] }, "fixed": { "rotation": [ 0, 180, 0 ], "translation": [ -2, 4, -5], "scale":[ 0.5, 0.5, 0.5] }, "ground": { "rotation": [ 0, 0, 0 ], "translation": [ 4, 4, 2], "scale":[ 0.25, 0.25, 0.25] } }, "overrides": [ { "predicate": { "blocking": 1 }, "model": "cave:item/enderite_shield_blocking" } ] } and the blocking_shield model: { "parent": "builtin/entity", "gui_light": "front", "textures": { "particle": "block/dark_oak_planks" }, "display": { "thirdperson_righthand": { "rotation": [ 45, 135, 0 ], "translation": [ 3.51, 11, -2 ], "scale": [ 1, 1, 1 ] }, "thirdperson_lefthand": { "rotation": [ 45, 135, 0 ], "translation": [ 13.51, 3, 5 ], "scale": [ 1, 1, 1 ] }, "firstperson_righthand": { "rotation": [ 0, 180, -5 ], "translation": [ -15, 5, -11 ], "scale": [ 1.25, 1.25, 1.25 ] }, "firstperson_lefthand": { "rotation": [ 0, 180, -5 ], "translation": [ 5, 5, -11 ], "scale": [ 1.25, 1.25, 1.25 ] }, "gui": { "rotation": [ 15, -25, -5 ], "translation": [ 2, 3, 0 ], "scale": [ 0.65, 0.65, 0.65 ] } } }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.