• Recently Browsing

    No registered users viewing this page.

  • Posts

    • Hello! I'm rendering a model with a TileEntityRenderer. The rendering works fine apart from the texture, which looks like all textures in MC pasted together. I've tried to use TextureManager#bindTexture(ResourceLocation), but it doesn't affect the rendering at all.   package net.anju.larus.renderer; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import net.anju.larus.LarusMod; import net.anju.larus.block.CrucibleBlock; import net.anju.larus.block.LarusBlocks; import net.anju.larus.tileentity.CrucibleTileEntity; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.model.ModelRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.vector.Vector3f; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import javax.annotation.ParametersAreNonnullByDefault; @OnlyIn(Dist.CLIENT) public class CrucibleTER extends TileEntityRenderer<CrucibleTileEntity> { private final CrucibleModel crucible; private final ResourceLocation resourceLocation = new ResourceLocation(LarusMod.MODID, "textures/block/crucible/crucible.png"); public CrucibleTER(TileEntityRendererDispatcher rendererDispatcherIn) { super(rendererDispatcherIn); this.crucible = new CrucibleModel(); } @Override @ParametersAreNonnullByDefault public void render(CrucibleTileEntity tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { World world = tileEntityIn.getWorld(); boolean flag = world != null; BlockState blockState = flag ? tileEntityIn.getBlockState() : LarusBlocks.CRUCIBLE.get().getDefaultState(); if (blockState.get(CrucibleBlock.TILTING)) { matrixStackIn.push(); float rotation = blockState.get(CrucibleBlock.FACING).getHorizontalAngle(); boolean warm = blockState.get(CrucibleBlock.WARM); matrixStackIn.translate(0.5D, 0.5D, 0.5D); matrixStackIn.rotate(Vector3f.YP.rotationDegrees(-rotation)); matrixStackIn.rotate(Vector3f.XP.rotationDegrees(50F * tileEntityIn.getCrucibleAngle(partialTicks))); matrixStackIn.translate(-0.5D, -0.5D, -0.5D); IVertexBuilder iVertexBuilder = bufferIn.getBuffer(RenderType.getSolid()); /*float angle = tileEntityIn.getCrucibleAngle(partialTicks); angle = 1.0F - angle; angle = 1.0F - angle * angle * angle; angle = -(angle * ((float) Math.PI / 2F));*/ crucible.render(matrixStackIn, iVertexBuilder, combinedLightIn, combinedOverlayIn, tileEntityIn.getContentLevel()); matrixStackIn.pop(); //Anrza: you must #push() before you pop, or it will crash } } private class CrucibleModel { private final ModelRenderer bottom; private final ModelRenderer front; private final ModelRenderer back; private final ModelRenderer right; private final ModelRenderer left; private final ModelRenderer level_1; private final ModelRenderer level_2; private final ModelRenderer level_3; public CrucibleModel() { int twi = 48; int thi = 16; //Bottom this.bottom = new ModelRenderer(twi, thi, 0, 0); this.bottom.addBox(2, 3, 2, 12, 1, 12, 0); //Front this.front = new ModelRenderer(twi, thi, 0, 0); this.front.addBox(2, 4, 12, 12, 12, 2); //Back this.back = new ModelRenderer(twi, thi, 0, 0); this.back.addBox(2, 4, 2, 12, 12, 2); //Left this.left = new ModelRenderer(twi, thi, 0, 0); this.left.addBox(2, 4, 4, 2, 12, 8); //Right this.right = new ModelRenderer(twi, thi, 0, 0); this.right.addBox(12, 4, 4, 2, 12, 8); //Levels this.level_1 = new ModelRenderer(twi, thi, 0, 0); this.level_1.addBox(4, 4, 4, 8, 2, 8); //Levels this.level_2 = new ModelRenderer(twi, thi, 0, 0); this.level_2.addBox(4, 4, 4, 8, 6, 8); //Levels this.level_3 = new ModelRenderer(twi, thi, 0, 0); this.level_3.addBox(4, 4, 4, 8, 11, 8); } public void render(MatrixStack matrixStackIn, IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, int level) { renderDispatcher.textureManager.bindTexture(resourceLocation); this.bottom.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn); this.front.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn); this.back.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn); this.left.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn); this.right.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn); switch (level) { case 1: { level_1.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn); break; } case 2: { level_2.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn); break; } case 3: { level_3.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn); break; } } } } }  
    • I've seen a lot of tutorials around the web, but they're just focused on creating a certain mod, which is completely useless if you want to create something different. I want to learn minecraft modding with forge, but the documentation seems to be outdated and sometimes it doesn't look like a documentation, instead, it looks like a API Reference. All i can do is watch the minecraft's code, but it doesn't make so much sense to me. If you give me advices, i will be grateful, thank u ♥
    • 1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    • Hello everyone again, I was wondering how you add in custom settings into the options menu, I can't find out how to add it into a deferred register: public static final DeferredRegister<NameHere> I can't find out what to put at NameHere. Any help is appreciated, if you need me to elaborate, just ask. Thank you.
  • Topics

  • Who's Online (See full list)