Jump to content

[1.16.4] Custom renderer issues


TheOrangeInd

Recommended Posts

I have a custom fluid tank tileentity with attached special renderer for internal fluid. The problem is that fluid rendering does not happen when the player is not looking at any block. If I remove the interface with the F1 key, the rendering also fails. Does anyone know what could be causing this renderer behavior?

This is how I registering my Renderer:

private void setupClient(final FMLClientSetupEvent event)
    {
        RenderTypeLookup.setRenderLayer(RegistryHandler.BLOCK_FLUID_TANK.get(), RenderType.getTranslucent());
        ClientRegistry.bindTileEntityRenderer(HTUTileEntityType.FLUID_TANK.get(), RendererFluidTank::new);
    }

 

Link to comment
Share on other sites

Ok. This is how the renderer looks now:

Spoiler


public class RendererFluidTank extends TileEntityRenderer<TileEntityFluidTank>
{
    public RendererFluidTank(TileEntityRendererDispatcher rendererDispatcherIn)
    {
        super(rendererDispatcherIn);
    }

    @Override
    public void render(TileEntityFluidTank tileEntity, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn)
    {
        FluidStack fluid = tileEntity.getFluidInTank(0);
        if(!fluid.isEmpty())
        {
            int capacity = tileEntity.getTankCapacity(0);
            renderFluid(tileEntity.getWorld(), tileEntity.getPos(), fluid.getFluid(), fluid.getAmount() / (float) capacity, matrixStackIn, bufferIn);
        }
    }

    protected void renderFluid(IBlockDisplayReader world, BlockPos pos, Fluid fluid, float percent, MatrixStack matrix, IRenderTypeBuffer buffer)
    {
        matrix.push();
        matrix.translate(0.5d, 0.5d, 0.5d);
        Matrix4f matrixLast = matrix.getLast().getMatrix();
        Matrix3f normalMatrix = matrix.getLast().getNormal();
        int color = fluid.getAttributes().getColor(world, pos);
        TextureAtlasSprite fluidSprite = getFluidSprite(fluid);
        IVertexBuilder builder = buffer.getBuffer(RenderType.getText(fluidSprite.getAtlasTexture().getTextureLocation()));
        for (int i = 0; i < 4; i++)
        {
            renderFluidSide(fluidSprite, matrixLast, normalMatrix, builder, color, percent);
            matrix.rotate(Vector3f.YP.rotationDegrees(90f));
        }

        if(percent < 1.0f) renderFluidTop(fluidSprite, matrixLast, normalMatrix, builder, color, percent);
        matrix.pop();
    }

    private void renderFluidSide(TextureAtlasSprite fluidSprite, Matrix4f matrix, Matrix3f normalMatrix, IVertexBuilder builder, int color, float percent)
    {
        float b = ((color)&0xFF) / 255f;
        float g = ((color>>8)&0xFF) / 255f;
        float r = ((color>>16)&0xFF) / 255f;
        float a = ((color>>24)&0xFF) / 255f;

        float width = 0.75f; //12 pixels of 16

        float minU = fluidSprite.getInterpolatedU(3);
        float maxU = fluidSprite.getInterpolatedU(13);
        float minV = fluidSprite.getInterpolatedV(1);
        float maxV = fluidSprite.getInterpolatedV(15 * percent);

        builder.pos(matrix, -width / 2, percent - 0.5f, -width / 2 + 0.001f)
                .color(r, g, b, a).tex(minU, minV).overlay(OverlayTexture.NO_OVERLAY)
                .lightmap(15728880).normal(normalMatrix, 0, 0, 1)
                .endVertex();

        builder.pos(matrix, width / 2, percent - 0.5f, -width / 2 + 0.001f)
                .color(r, g, b, a).tex(maxU, minV).overlay(OverlayTexture.NO_OVERLAY)
                .lightmap(15728880).normal(normalMatrix, 0, 0, 1)
                .endVertex();

        builder.pos(matrix, width / 2, -0.5f, -width / 2 + 0.001f)
                .color(r, g, b, a).tex(maxU, maxV).overlay(OverlayTexture.NO_OVERLAY)
                .lightmap(15728880).normal(normalMatrix, 0, 0, 1)
                .endVertex();

        builder.pos(matrix, -width / 2, -0.5f, -width / 2 + 0.001f)
                .color(r, g, b, a).tex(minU, maxV).overlay(OverlayTexture.NO_OVERLAY)
                .lightmap(15728880).normal(normalMatrix, 0, 0, 1)
                .endVertex();
    }

    protected void renderFluidTop(TextureAtlasSprite fluidSprite, Matrix4f matrix, Matrix3f normalMatrix, IVertexBuilder builder, int color, float percent)
    {
        float b = ((color)&0xFF) / 255f;
        float g = ((color>>8)&0xFF) / 255f;
        float r = ((color>>16)&0xFF) / 255f;
        float a = ((color>>24)&0xFF) / 255f;

        float width = 0.75f; //12 pixels of 16

        float minU = fluidSprite.getInterpolatedU(3);
        float maxU = fluidSprite.getInterpolatedU(13);
        float minV = fluidSprite.getInterpolatedV(1);
        float maxV = fluidSprite.getInterpolatedV(13);

        builder.pos(matrix, -width / 2, percent - 0.5f, -width / 2)
                .color(r, g, b, a).tex(minU, minV).overlay(OverlayTexture.NO_OVERLAY)
                .lightmap(15728880).normal(normalMatrix, 0, 1, 0)
                .endVertex();

        builder.pos(matrix, -width / 2, percent - 0.5f, width / 2)
                .color(r, g, b, a).tex(minU, maxV).overlay(OverlayTexture.NO_OVERLAY)
                .lightmap(15728880).normal(normalMatrix, 0, 1, 0)
                .endVertex();

        builder.pos(matrix, width / 2, percent - 0.5f, width / 2)
                .color(r, g, b, a).tex(maxU, maxV).overlay(OverlayTexture.NO_OVERLAY)
                .lightmap(15728880).normal(normalMatrix, 0, 1, 0)
                .endVertex();

        builder.pos(matrix, width / 2, percent - 0.5f, -width / 2)
                .color(r, g, b, a).tex(maxU, minV).overlay(OverlayTexture.NO_OVERLAY)
                .lightmap(15728880).normal(normalMatrix, 0, 1, 0)
                .endVertex();
    }

    protected TextureAtlasSprite getFluidSprite(Fluid fluid)
    {
        return Minecraft.getInstance().getAtlasSpriteGetter(PlayerContainer.LOCATION_BLOCKS_TEXTURE).apply(fluid.getAttributes().getStillTexture());
    }
}

 

 

Edited by TheOrangeInd
Link to comment
Share on other sites

As a result, I came to the conclusion that the problem was a conflict between the render of the fluid and its tank. That is, a tank whose render type was set to Translucent simply did not allow fluids with similar render types to be rendered. I'm not sure if there is a way to fix this, but for now I decided to just change the render type of the tank.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I'm struggling so hard to find a way to allow players to use my config file to modify where structures are being created. I have checked for events in the documentation but none of them seem to be of use for this. Why pointing Biome is not enough? Well Certain mods like Lost cities use vanilla generation, causing many structures to spawn in, completely disrupting the dimension generation. Is there a way to control dimensional spawning of structures? Please Im still trying very hard to find how to do this.
    • I'm new to modpack making, but familiar with file management and mod development. I cannot locate which mod is causing the crash. If it's more than one, Im not sure how to locate it. Any clues as to whats causing this? I have read through different possible causes but every thing is different, and none of the solves issues are the solution to my problem. This problem started occurring after adding about 5 mods, but once I removed them, the problem continued. It worked fine before.   Here is the crash report.
    • Nvm, added EMF and ETF to a Primarily Create using Modpack, it works, but with Rechiseled it softlocks in the initialization screen of Forge and just sits there..cuz the CPU load just goes to 0%.
    • Everytime i try to join my server my minecraft closes and crashes. Im using the void launcher right now to play this mod. Can someone please help im not sure why this is happening. This is the crash report   ---- Minecraft Crash Report ---- // Uh... Did I do that? Time: 6/25/24 7:05 PM Description: Unexpected error java.lang.NullPointerException: Unexpected error     at net.minecraft.crash.CrashReportCategory.func_85069_a(CrashReportCategory.java:145)     at net.minecraft.crash.CrashReport.func_85057_a(CrashReport.java:333)     at net.minecraft.crash.CrashReport.func_85058_a(CrashReport.java:303)     at net.minecraft.client.Minecraft.func_71407_l(Unknown Source)     at net.minecraft.client.Minecraft.func_71411_J(Unknown Source)     at net.minecraft.client.Minecraft.func_99999_d(Unknown Source)     at net.minecraft.client.main.Main.main(SourceFile:148)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)     at java.lang.reflect.Method.invoke(Unknown Source)     at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)     at net.minecraft.launchwrapper.Launch.main(Launch.java:28) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details:     Minecraft Version: 1.7.10     Operating System: Windows 10 (amd64) version 10.0     Java Version: 1.8.0_271, Oracle Corporation     Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation     Memory: 1743850688 bytes (1663 MB) / 3333947392 bytes (3179 MB) up to 3817865216 bytes (3641 MB)     JVM Flags: 11 total; -Xms1024M -Xmx4096M -XX:MaxPermSize=256M -XX:+UseParallelGC -XX:ParallelGCThreads=6 -XX:+UseSplitVerifier -XX:+FailOverToOldVerifier -XX:-HeapDumpOnOutOfMemoryError -XX:+UseCompressedOops -XX:+ScavengeBeforeFullGC -XX:+PrintCommandLineFlags     AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used     IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0     FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1558 94 mods loaded, 93 mods active     States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored     UCHIJA    mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)      UCHIJA    FML{7.10.99.99} [Forge Mod Loader] (forge-1.7.10-10.13.4.1558-1.7.10-universal.jar)      UCHIJA    Forge{10.13.4.1558} [Minecraft Forge] (forge-1.7.10-10.13.4.1558-1.7.10-universal.jar)      UCHIJA    CodeChickenCore{1.0.7.46} [CodeChicken Core] (minecraft.jar)      UCHIJA    ivtoolkit{1.2.1} [IvToolkit] (minecraft.jar)      UCHIJA    OldModelLoader{1.0} [OldModelLoader] (minecraft.jar)      UCHIJA    MobiusCore{1.2.5} [MobiusCore] (minecraft.jar)      UCHIJA    NotEnoughItems{1.0.5.111} [Not Enough Items] (NotEnoughItemsuniversal.jar)      UCHIJA    voltzenginepreloader{0.0.1} [Voltz Engine Preloader] (minecraft.jar)      UCHIJA    FastCraft{1.25} [FastCraft] (fastcraft.jar)      UCHIJA    Baubles{1.0.1.10} [Baubles] (Baubles.jar)      UCHIJA    surpriseeggs{1.0.6} [Surprise Eggs] (AdventureBackpack.jar)      UCHIJA    adventurebackpack{1.7.10-0.8b} [Adventure Backpack] (AdventureBackpack.jar)      UCHIJA    AnimationAPI{1.2.4} [AnimationAPI] (AnimationAPI.jar)      UCHIJA    MovingWorld{1.7.10-1.8.1} [Moving World] (MovingWorld.jar)      UCHIJA    ArchimedesShipsPlus{1.7.10-1.8.1} [Archimedes' Ships Plus] (ArchimedesPlus.jar)      UCHIJA    asielib{0.2.7} [asielib] (asielib.jar)      UCHIJA    BiblioCraft{1.10.5} [BiblioCraft] (BiblioCraft.jar)      UCHIJA    CarpentersBlocks{3.3.6} [Carpenter's Blocks] (CarpentersBlocks.jar)      UCHIJA    ChestTransporter{2.0.6} [Chest Transporter] (ChestTransporter.jar)      UCHIJA    Railcraft{9.12.2.0} [Railcraft] (Railcraft.jar)      UCHIJA    chisel{2.3.10.37} [Chisel 2] (Chisel.jar)      UCHIJA    chunkpregenerator{2.1} [Chunk Pregenerator] (ChunkPregeneratorV.jar)      UCHIJA    lucky{5.1.0} [Lucky Block] (LuckyBlocks.jar)      UCHIJA    Waila{1.5.10} [Waila] (Waila.jar)      UCHIJA    ColorfulMobs{1.1.0} [Colorful Mobs] (ColorfulMobsMC.jar)      UCHIJA    controlling{1.0.0} [Controlling] (Controlling.jar)      UCHIJA    custommenu{2.0.0.3} [Custom Menu] (CustomMenu.jar)      UCHIJA    customnpcs{1.7.10d} [CustomNpcs] (CustomNpcs.jar)      UCHIJA    DamageIndicatorsMod{3.2.3} [Damage Indicators] (DamageIndicators.jar)      UCHIJA    darkcore{0.3} [Dark Core] (DarkCore.jar)      UCHIJA    PTRModelLib{1.0.0} [PTRModelLib] (Decocraft.jar)      UCHIJA    props{2.4.2} [Decocraft] (Decocraft.jar)      UCHIJA    FoodExpansion{1.0} [Food Expansion] (FoodExpansionmc.jar)      UCHIJA    FoodPlus{3.2rS} [ bFood Plus] (FoodPlus.jar)      UCHIJA    iChunUtil{4.2.2} [iChunUtil] (iChunUtil.jar)      UCHIJA    GraviGun{4.0.0-beta} [GraviGun] (GravityGun.jar)      UCHIJA    HardcoreEnderExpansion{1.8.6} [Hardcore Ender Expansion] (HardcoreEnderExpansionMCv.jar)      UCHIJA    Hats{4.0.1} [Hats] (Hats.jar)      UCHIJA    HatStand{4.0.0} [HatStand] (HatStand.jar)      UCHIJA    hbm{1.0.27 BETA (3815)} [Hbm's Nuclear Tech] (hbmBETA.jar)      UCHIJA    voltzengine{1.11.0.491} [Voltz Engine] (VoltzEngine.jar)      UCHIJA    icbmclassic{2.16.4.3} [ICBM-Classic] (ICBM.jar)      UCHIJA    InventoryPets{1.5.2} [Inventory Pets] (inventorypetsuniversal.jar)      UCHIJA    inventorytweaks{1.59-dev-152-cf6e263} [Inventory Tweaks] (InventoryTweaksdev.jar)      UCHIJA    IronChest{6.0.62.742} [Iron Chest] (ironchestuniversal.jar)      UCHIJA    journeymap{5.1.4p2} [JourneyMap] (journeymappunlimited.jar)      UCHIJA    pacman{1.0} [Pacman] (KillerPacman.jar)      UCHIJA    legends{6.15} [Legends Mod] (Legends.jar)      UCHIJA    levelup{0.10} [Level Up!] (LevelUp.jar)      UCHIJA    lmmx{1.0} [lmmx] (littleMaidMobXx.jar)      UCHIJA    MMMLibX{1.7.x-srg-1} [MMMLibX] (littleMaidMobXx.jar)      UCHIJA    zabuton{1.0} [zabuton] (littleMaidMobXx.jar)      UCHIJA    luckyegg{1.2.1} [LuckyEgg] (LuckyEgg.jar)      UCHIJA    malisiscore{1.7.10-0.14.3} [MalisisCore] (malisiscore.jar)      UCHIJA    malisisdoors{1.7.10-1.13.2} [Malisis' Doors] (malisisdoors.jar)      UCHIJA    mcheli{1.0.4} [MC Helicopter] (MCHeli.zip)      UCHIJA    battlegear2{1.7.10} [Mine & Blade Battlegear 2 - Bullseye] (MineBladeBattlegearBullseye.jar)      UCHIJA    MobProperties{0.4.0} [Mob Properties] (MobProperties.jar)      UCHIJA    nolpfij_mobstatues{0.1.1} [mobstatues] (MobStatues.jar)      UCHIJA    cfm{3.4.7} [ 9MrCrayfish's Furniture Mod] (MrCrayfishsFurnitureMod.jar)      UCHIJA    MutantCreatures{1.4.8} [Mutant Creatures] (MutantCreatures.jar)      UCHIJA    NEIAddons{1.12.10.33} [NEI Addons] (NEIAddons.jar)      UCHIJA    NEIAddons|AppEng{1.12.10.33} [NEI Addons: Applied Energistics 2] (NEIAddons.jar)      UCHIJA    NEIAddons|Botany{1.12.10.33} [NEI Addons: Botany] (NEIAddons.jar)      UCHIJA    NEIAddons|Forestry{1.12.10.33} [NEI Addons: Forestry] (NEIAddons.jar)      UCHIJA    NEIAddons|CraftingTables{1.12.10.33} [NEI Addons: Crafting Tables] (NEIAddons.jar)      UCHIJA    NEIAddons|ExNihilo{1.12.10.33} [NEI Addons: Ex Nihilo] (NEIAddons.jar)      UCHIJA    neiintegration{1.1.2} [NEI Integration] (NEIIntegrationMC.jar)      UCHIJA    recipehandler{1.7.10} [NoMoreRecipeConflict] (NoMoreRecipeConflict.jar)      UCHIJA    OreSpawn{1.7.10.20.3} [OreSpawn] (orespawn.zip)      UCHIJA    origin{3.3.0} [Origin] (Origin.jar)      UCHIJA    pandorasbox{2.0.1} [Pandora's Box] (PandorasBox.jar)      UCHIJA    PortalGun{4.0.0-beta-4} [PortalGun] (PortalGunbeta.jar)      UCHIJA    ProjectE{1.7.10-PE1.10.1} [ProjectE] (ProjectE.jar)      UCHIJA    recipescramble{1.7.5} [Recipe Scramble] (RecipeScramble.jar)      UCHIJA    reccomplex{0.9.7.1.1} [Recurrent Complex] (RecurrentComplex.jar)      UCHIJA    SaintsCore{0.8} [Saintscore] (Saintscore.jar)      UCHIJA    secretroomsmod{4.7.1} [The SecretRoomsMod] (secretroomsmod.jar)      UCHIJA    securitycraft{v1.8.13} [SecurityCraft] (SecurityCraftv.jar)      UCHIJA    SSTOW{1.7.10-0.1-RC9-7} [Soul Shards: The Old Ways] (SoulShardsTheOldWays.jar)      UCHIJA    statues{2.1.3} [Statues] (Statues.jar)      UCHIJA    StorageDrawers{1.7.10-1.10.9} [Storage Drawers] (StorageDrawers.jar)      UCHIJA    TardisMod{0.99} [Tardis Mod] (TardisMod.jar)      UCHIJA    TragicMC{2.46.2879} [TragicMC 2] (TragicMC.jar)      UCHIJA    TrailMix{4.0.0} [TrailMix] (TrailMix.jar)      UCHIJA    VeinMiner{0.36.0_1.7.10-28a7f13} [Vein Miner] (VeinMiner-1.7.10-0.36.0.496+28a7f13.jar)      UCHIJA    VeinMinerModSupport{0.36.0_1.7.10-28a7f13} [Mod Support] (VeinMiner-1.7.10-0.36.0.496+28a7f13.jar)      UCHIJA    voltzenginemodcompat{1.11.0.491} [Voltz Engine Mod Compatibility Loader] (VoltzEngine.jar)      UCHIJA    voltzenginemodflag{1.11.0.491} [VoltzEngine mod protection, flag, and region system] (VoltzEngine.jar)      UCHIJA    weepingangels{3.3.2} [Weeping Angels] (WeepingAngels.jar)      UCHIJA    thejungle{1.0.9} [Welcome to the Jungle] (WelcomeToTheJungle.jar)      UCHIJA    witchery{0.24.1} [Witchery] (Witchery.jar)      UD    asielibcore{} [AsieLib CoreMod] (minecraft.jar)      GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 522.25' Renderer: 'NVIDIA GeForce RTX 3050/PCIe/SSE2'     Launched Version: 1.7.10     LWJGL: 2.9.1     OpenGL: NVIDIA GeForce RTX 3050/PCIe/SSE2 GL version 4.6.0 NVIDIA 522.25, NVIDIA Corporation     GL Caps: Using GL 1.3 multitexturing. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Anisotropic filtering is supported and maximum anisotropy is 16. Shaders are available because OpenGL 2.1 is supported.     Is Modded: Definitely; Client brand changed to 'fml,forge'     Type: Client (map_client.txt)     Resource Packs: []     Current Language: English (US)     Profiler Position: N/A (disabled)     Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used     Anisotropic Filtering: Off (1)
    • Yes, I downloaded the driver off of the official website and downloaded AMD Software: Adrenalin Edition in the process. It's showing me that my driver is up to date. I could try uninstalling and reinstalling it to see if there was anything I missed during the installation process, maybe? Edit: Update, I downloaded the AMD stuff again following the exact instructions in the FAQ, and I am still getting the same issue.
  • Topics

×
×
  • Create New...

Important Information

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