Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

minecraftplayre14141

Members
  • Joined

  • Last visited

Everything posted by minecraftplayre14141

  1. package net.testname.testmod.entity.client; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.ArrowRenderer; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.testname.testmod.TestMod; import net.testname.testmod.world.entity.projectile.CoolArrow; //import these import net.minecraft.client.renderer.RenderType; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.math.Matrix3f; import com.mojang.math.Matrix4f; import com.mojang.math.Vector3f; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.util.Mth; @OnlyIn(Dist.CLIENT) public class CoolArrowRenderer extends ArrowRenderer<CoolArrow> { public CoolArrowRenderer(EntityRendererProvider.Context context) { super(context); } public static final ResourceLocation TEXTURE = new ResourceLocation(TestMod.MOD_ID, "textures/entity/projectiles/cool_arrow_model.png"); private static final RenderType RENDER_TYPE = RenderType.entityCutoutNoCull(TEXTURE); @Override public ResourceLocation getTextureLocation(CoolArrow p_114482_) { return TEXTURE; } public void render(CoolArrow pEntity, float pEntityYaw, float pPartialTicks, PoseStack pMatrixStack, MultiBufferSource pBuffer, int pPackedLight) { pMatrixStack.pushPose(); pMatrixStack.mulPose(Vector3f.YP.rotationDegrees(Mth.lerp(pPartialTicks, pEntity.yRotO, pEntity.getYRot()) - 90.0F)); pMatrixStack.mulPose(Vector3f.ZP.rotationDegrees(Mth.lerp(pPartialTicks, pEntity.xRotO, pEntity.getXRot()))); int i = 0; float f = 0.0F; float f1 = 0.5F; float f2 = 0.0F; float f3 = 0.15625F; float f4 = 0.0F; float f5 = 0.15625F; float f6 = 0.15625F; float f7 = 0.3125F; float f8 = 0.05625F; float f9 = (float)pEntity.shakeTime - pPartialTicks; if (f9 > 0.0F) { float f10 = -Mth.sin(f9 * 3.0F) * f9; pMatrixStack.mulPose(Vector3f.ZP.rotationDegrees(f10)); } pMatrixStack.mulPose(Vector3f.XP.rotationDegrees(45.0F)); pMatrixStack.scale(0.05625F, 0.05625F, 0.05625F); pMatrixStack.translate(-4.0D, 0.0D, 0.0D); VertexConsumer vertexconsumer = pBuffer.getBuffer(RENDER_TYPE); //Buffer wants a RenderType, hence the private static field above! PoseStack.Pose posestack$pose = pMatrixStack.last(); Matrix4f matrix4f = posestack$pose.pose(); Matrix3f matrix3f = posestack$pose.normal(); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, -2, -2, 0.0F, 0.15625F, -1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, -2, 2, 0.15625F, 0.15625F, -1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, 2, 2, 0.15625F, 0.3125F, -1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, 2, -2, 0.0F, 0.3125F, -1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, 2, -2, 0.0F, 0.15625F, 1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, 2, 2, 0.15625F, 0.15625F, 1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, -2, 2, 0.15625F, 0.3125F, 1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, -2, -2, 0.0F, 0.3125F, 1, 0, 0, pPackedLight); for(int j = 0; j < 4; ++j) { pMatrixStack.mulPose(Vector3f.XP.rotationDegrees(90.0F)); this.vertex(matrix4f, matrix3f, vertexconsumer, -8, -2, 0, 0.0F, 0.0F, 0, 1, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, 8, -2, 0, 0.5F, 0.0F, 0, 1, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, 8, 2, 0, 0.5F, 0.15625F, 0, 1, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -8, 2, 0, 0.0F, 0.15625F, 0, 1, 0, pPackedLight); } pMatrixStack.popPose(); super.render(pEntity, pEntityYaw, pPartialTicks, pMatrixStack, pBuffer, pPackedLight); } public void vertex(Matrix4f pMatrix, Matrix3f pNormals, VertexConsumer pVertexBuilder, int pOffsetX, int pOffsetY, int pOffsetZ, float pTextureX, float pTextureY, int pNormalX, int p_113835_, int p_113836_, int pPackedLight) { pVertexBuilder.vertex(pMatrix, (float)pOffsetX, (float)pOffsetY, (float)pOffsetZ).color(255, 255, 255, 255).uv(pTextureX, pTextureY).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(pPackedLight).normal(pNormals, (float)pNormalX, (float)p_113836_, (float)p_113835_).endVertex(); } } when I run the code everything runs fine but I don't know how to change the render to use my own json model
  2. package net.testname.testmod.entity.client; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.ArrowRenderer; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.testname.testmod.TestMod; import net.testname.testmod.world.entity.projectile.CoolArrow; //import these import net.minecraft.client.renderer.RenderType; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.math.Matrix3f; import com.mojang.math.Matrix4f; import com.mojang.math.Vector3f; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.util.Mth; @OnlyIn(Dist.CLIENT) public class CoolArrowRenderer extends ArrowRenderer<CoolArrow> { public CoolArrowRenderer(EntityRendererProvider.Context context) { super(context); } public static final ResourceLocation TEXTURE = new ResourceLocation(TestMod.MOD_ID, "textures/entity/projectiles/cool_arrow_model.png"); private static final RenderType RENDER_TYPE = RenderType.entityCutoutNoCull(TEXTURE); public void render(CoolArrow pEntity, float pEntityYaw, float pPartialTicks, PoseStack pMatrixStack, MultiBufferSource pBuffer, int pPackedLight) { pMatrixStack.pushPose(); pMatrixStack.mulPose(Vector3f.YP.rotationDegrees(Mth.lerp(pPartialTicks, pEntity.yRotO, pEntity.getYRot()) - 90.0F)); pMatrixStack.mulPose(Vector3f.ZP.rotationDegrees(Mth.lerp(pPartialTicks, pEntity.xRotO, pEntity.getXRot()))); int i = 0; float f = 0.0F; float f1 = 0.5F; float f2 = 0.0F; float f3 = 0.15625F; float f4 = 0.0F; float f5 = 0.15625F; float f6 = 0.15625F; float f7 = 0.3125F; float f8 = 0.05625F; float f9 = (float)pEntity.shakeTime - pPartialTicks; if (f9 > 0.0F) { float f10 = -Mth.sin(f9 * 3.0F) * f9; pMatrixStack.mulPose(Vector3f.ZP.rotationDegrees(f10)); } pMatrixStack.mulPose(Vector3f.XP.rotationDegrees(45.0F)); pMatrixStack.scale(0.05625F, 0.05625F, 0.05625F); pMatrixStack.translate(-4.0D, 0.0D, 0.0D); VertexConsumer vertexconsumer = pBuffer.getBuffer(RENDER_TYPE); //Buffer wants a RenderType, hence the private static field above! PoseStack.Pose posestack$pose = pMatrixStack.last(); Matrix4f matrix4f = posestack$pose.pose(); Matrix3f matrix3f = posestack$pose.normal(); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, -2, -2, 0.0F, 0.15625F, -1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, -2, 2, 0.15625F, 0.15625F, -1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, 2, 2, 0.15625F, 0.3125F, -1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, 2, -2, 0.0F, 0.3125F, -1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, 2, -2, 0.0F, 0.15625F, 1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, 2, 2, 0.15625F, 0.15625F, 1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, -2, 2, 0.15625F, 0.3125F, 1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, -2, -2, 0.0F, 0.3125F, 1, 0, 0, pPackedLight); for(int j = 0; j < 4; ++j) { pMatrixStack.mulPose(Vector3f.XP.rotationDegrees(90.0F)); this.vertex(matrix4f, matrix3f, vertexconsumer, -8, -2, 0, 0.0F, 0.0F, 0, 1, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, 8, -2, 0, 0.5F, 0.0F, 0, 1, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, 8, 2, 0, 0.5F, 0.15625F, 0, 1, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -8, 2, 0, 0.0F, 0.15625F, 0, 1, 0, pPackedLight); } pMatrixStack.popPose(); super.render(pEntity, pEntityYaw, pPartialTicks, pMatrixStack, pBuffer, pPackedLight); } @Override public ResourceLocation getTextureLocation(CoolArrow p_114482_) { return new ResourceLocation("textures/entity/projectiles/cool_arrow_model.png"); } public void vertex(Matrix4f pMatrix, Matrix3f pNormals, VertexConsumer pVertexBuilder, int pOffsetX, int pOffsetY, int pOffsetZ, float pTextureX, float pTextureY, int pNormalX, int p_113835_, int p_113836_, int pPackedLight) { pVertexBuilder.vertex(pMatrix, (float)pOffsetX, (float)pOffsetY, (float)pOffsetZ).color(255, 255, 255, 255).uv(pTextureX, pTextureY).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(pPackedLight).normal(pNormals, (float)pNormalX, (float)p_113836_, (float)p_113835_).endVertex(); } } How do I use my own json model for the arrow
  3. package net.testname.testmod.entity.client; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.ArrowRenderer; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.testname.testmod.TestMod; import net.testname.testmod.world.entity.projectile.CoolArrow; //import these import net.minecraft.client.renderer.RenderType; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.math.Matrix3f; import com.mojang.math.Matrix4f; import com.mojang.math.Vector3f; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.util.Mth; @OnlyIn(Dist.CLIENT) public class CoolArrowRenderer extends ArrowRenderer<CoolArrow> { public CoolArrowRenderer(EntityRendererProvider.Context context) { super(context); } public static final ResourceLocation TEXTURE = new ResourceLocation(TestMod.MOD_ID, "textures/entity/projectiles/cool_arrow_model.png"); private static final RenderType RENDER_TYPE = RenderType.entityCutoutNoCull(TEXTURE); @Override public ResourceLocation getTextureLocation(CoolArrow pEntity) { return new ResourceLocation(TestMod.MOD_ID, "textures/entity/projectiles//cool_arrow_model.png"); } public void render(T pEntity, float pEntityYaw, float pPartialTicks, PoseStack pMatrixStack, MultiBufferSource pBuffer, int pPackedLight) { pMatrixStack.pushPose(); pMatrixStack.mulPose(Vector3f.YP.rotationDegrees(Mth.lerp(pPartialTicks, pEntity.yRot0, pEntity.getYRot()) - 90.0F)); pMatrixStack.mulPose(Vector3f.ZP.rotationDegrees(Mth.lerp(pPartialTicks, pEntity.xRotO, pEntity.getXRot()))); int i = 0; float f = 0.0F; float f1 = 0.5F; float f2 = 0.0F; float f3 = 0.15625F; float f4 = 0.0F; float f5 = 0.15625F; float f6 = 0.15625F; float f7 = 0.3125F; float f8 = 0.05625F; float f9 = (float)pEntity.shakeTime - pPartialTicks; if (f9 > 0.0F) { float f10 = -Mth.sin(f9 * 3.0F) * f9; pMatrixStack.mulPose(Vector3f.ZP.rotationDegrees(f10)); } pMatrixStack.mulPose(Vector3f.XP.rotationDegrees(45.0F)); pMatrixStack.scale(0.05625F, 0.05625F, 0.05625F); pMatrixStack.translate(-4.0D, 0.0D, 0.0D); VertexConsumer vertexconsumer = pBuffer.getBuffer(RENDER_TYPE); //Buffer wants a RenderType, hence the private static field above! PoseStack.Pose posestack$pose = pMatrixStack.last(); Matrix4f matrix4f = posestack$pose.pose(); Matrix3f matrix3f = posestack$pose.normal(); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, -2, -2, 0.0F, 0.15625F, -1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, -2, 2, 0.15625F, 0.15625F, -1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, 2, 2, 0.15625F, 0.3125F, -1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, 2, -2, 0.0F, 0.3125F, -1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, 2, -2, 0.0F, 0.15625F, 1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, 2, 2, 0.15625F, 0.15625F, 1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, -2, 2, 0.15625F, 0.3125F, 1, 0, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -7, -2, -2, 0.0F, 0.3125F, 1, 0, 0, pPackedLight); for(int j = 0; j < 4; ++j) { pMatrixStack.mulPose(Vector3f.XP.rotationDegrees(90.0F)); this.vertex(matrix4f, matrix3f, vertexconsumer, -8, -2, 0, 0.0F, 0.0F, 0, 1, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, 8, -2, 0, 0.5F, 0.0F, 0, 1, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, 8, 2, 0, 0.5F, 0.15625F, 0, 1, 0, pPackedLight); this.vertex(matrix4f, matrix3f, vertexconsumer, -8, 2, 0, 0.0F, 0.15625F, 0, 1, 0, pPackedLight); } pMatrixStack.popPose(); super.render(T pEntity, pEntityYaw, pPartialTicks, pMatrixStack, pBuffer, pPackedLight); } public void vertex(Matrix4f pMatrix, Matrix3f pNormals, VertexConsumer pVertexBuilder, int pOffsetX, int pOffsetY, int pOffsetZ, float pTextureX, float pTextureY, int pNormalX, int p_113835_, int p_113836_, int pPackedLight) { pVertexBuilder.vertex(pMatrix, (float)pOffsetX, (float)pOffsetY, (float)pOffsetZ).color(255, 255, 255, 255).uv(pTextureX, pTextureY).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(pPackedLight).normal(pNormals, (float)pNormalX, (float)p_113836_, (float)p_113835_).endVertex(); } } thank youu but I don't understand why some things are red. Am I missing an import statement, I can't find any that are missing. public void render(T pEntity, float pEntityYaw, float pPartialTicks, PoseStack pMatrixStack, MultiBufferSource pBuffer, int pPackedLight) the T is red pMatrixStack.mulPose(Vector3f.YP.rotationDegrees(Mth.lerp(pPartialTicks, pEntity.yRot0, pEntity.getYRot()) - 90.0F)); pMatrixStack.mulPose(Vector3f.ZP.rotationDegrees(Mth.lerp(pPartialTicks, pEntity.xRotO, pEntity.getXRot()))); pEntity.yRot0, pEntity.getYRot and pEntity.xRotO, pEntity.getXRot is red float f9 = (float)pEntity.shakeTime - pPartialTicks; pEntity.shakeTime is also red
  4. // CoolArrowRenderer.java package net.testname.testmod.entity.client; import com.mojang.math.Vector3f; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.ArrowRenderer; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.testname.testmod.TestMod; import net.testname.testmod.world.entity.projectile.CoolArrow; @OnlyIn(Dist.CLIENT) public class CoolArrowRenderer extends ArrowRenderer<CoolArrow> { public CoolArrowRenderer(EntityRendererProvider.Context context) { super(context); } @Override public ResourceLocation getTextureLocation(CoolArrow pEntity) { return new ResourceLocation(TestMod.MOD_ID, "textures/entity/projectiles//cool_arrow_model.png"); } }

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.