Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[Solved] [1.16.5] Custom Trident, issues with in GUI, GROUND and FIXED ItemCameraTransform rendering


Recommended Posts

Hi all,

I am attempting to add my own custom Trident into my Mod. I have 90% of things working currently, however the GUI, ItemEntity and ItemFrame (I assume from FIXED) rendering is very strange.

Below are picures of the Issue, and any related code.
 

Spoiler

2021-03-22_20_11.42_.png.c19c07d21cd4dbc55a435a7410a1098e.png

2021-03-22_20_12.16_.png.868d5a11c9156d4a28d3f5ba4885e56a.png

The item is supposed to look like this:

trident.png.a9d0bb6d5da7ecfc0d2b01a89e65faad.png

 

dimensional_trident.json:

Spoiler

{
    "parent": "item/generated",
    "textures": {
        "layer0": "dimensionalpocketsii:items/tool/trident"
    },
     "overrides": [
         {
            "predicate": {
                "throwing": 0
            },
            "model": "dimensionalpocketsii:item/dimensional_trident__"
        },
        {
            "predicate": {
                "throwing": 1
            },
            "model": "dimensionalpocketsii:item/dimensional_trident_throwing"
        }
    ]
}

 

dimensional_trident__.json:

Spoiler

{
    "parent": "builtin/entity",
    "gui_light": "front",
    "textures": {
        "particle": "dimensionalpocketsii:items/tool/trident"
    },
    "display": {
        "thirdperson_righthand": {
            "rotation": [ 0, 60, 0 ],
            "translation": [ 11, 17, -2 ],
            "scale": [ 1, 1, 1 ]
        },
        "thirdperson_lefthand": {
            "rotation": [ 0, 60, 0 ],
            "translation": [ 3, 17, 12 ],
            "scale": [ 1, 1, 1 ]
        },
        "firstperson_righthand": {
            "rotation": [ 0, -90, 25 ],
            "translation": [ -3, 17, 1],
            "scale": [ 1, 1, 1 ]
        },
        "firstperson_lefthand": {
            "rotation": [ 0, 90, -25 ],
            "translation": [ 13, 17, 1],
            "scale": [ 1, 1, 1 ]
        },
        "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": {
                "throwing": 1
            },
            "model": "dimensionalpocketsii:item/dimensional_trident_throwing"
        }
    ]
}

 

dimensional_trident_throwing.json:

Spoiler

{
    "parent": "builtin/entity",
    "gui_light": "front",
    "textures": {
        "particle": "dimensionalpocketsii:items/tool/trident"
    },
    "display": {
        "thirdperson_righthand": {
            "rotation": [ 0, 90, 180 ],
            "translation": [ 8, -17, 9 ],
            "scale": [ 1, 1, 1 ]
        },
        "thirdperson_lefthand": {
            "rotation": [ 0, 90, 180 ],
            "translation": [ 8, -17, -7 ],
            "scale": [ 1, 1, 1 ]
        },
        "firstperson_righthand": {
            "rotation": [ 0, -90, 25 ],
            "translation": [ -3, 17, 1],
            "scale": [ 1, 1, 1 ]
        },
        "firstperson_lefthand": {
            "rotation": [ 0, 90, -25 ],
            "translation": [  13, 17, 1],
            "scale": [ 1, 1, 1 ]
        },
        "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]
        }
    }
}

 

ItemStackTileEntityRenderer.class:

Spoiler

package com.tcn.dimensionalpocketsii.client.renderer;

import org.lwjgl.opengl.GL11;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.tcn.dimensionalpocketsii.core.management.CoreModBusManager;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.entity.model.TridentModel;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)
public class TridentItemStackRenderer extends ItemStackTileEntityRenderer {
    private final DimensionalTridentModel tridentModel = new DimensionalTridentModel();

    @Override
    public void renderByItem(ItemStack stackIn, ItemCameraTransforms.TransformType transformIn, MatrixStack matrixStack, IRenderTypeBuffer typeBuffer, int p_239207_5_, int p_239207_6_) {
        Item item = stackIn.getItem();
        
        ItemRenderer renderer = Minecraft.getInstance().getItemRenderer();
        IBakedModel model = null;

        if (item == CoreModBusManager.DIMENSIONAL_TRIDENT) {
            boolean flag = transformIn == ItemCameraTransforms.TransformType.GUI || transformIn == ItemCameraTransforms.TransformType.GROUND || transformIn == ItemCameraTransforms.TransformType.FIXED;
            if (flag) {
                model = Minecraft.getInstance().getModelManager().getModel(new ModelResourceLocation("dimensionalpocketsii:dimensional_trident#inventory")).getBakedModel();
                
                float scale = 1.5F;
                
                matrixStack.pushPose();
                GL11.glPushMatrix();
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                //matrixStack.scale(scale, scale, scale);
                
                renderer.render(stackIn, transformIn, true, matrixStack, typeBuffer, 0, 0, model);
                GL11.glPopMatrix();
                matrixStack.popPose();
                
            } else {
                matrixStack.pushPose();
                matrixStack.scale(1.0F, -1.0F, -1.0F);
                IVertexBuilder ivertexbuilder1 = ItemRenderer.getFoilBufferDirect(typeBuffer, this.tridentModel.renderType(TridentModel.TEXTURE), false, stackIn.hasFoil());
                this.tridentModel.renderToBuffer(matrixStack, ivertexbuilder1, p_239207_5_, p_239207_6_, 1.0F, 1.0F, 1.0F, 1.0F);
                matrixStack.popPose();
            }
        }
    }

}

 

Im not sure what the issue is. Ive looked through vanilla code to see if i could locate the source of the issue, no dice. I have also read a few forum posts on the Modder Support Forum, and others have had other issues but none like this.

 

Any help is appreciated!

Edited by Zeher_Monkey
Issue was Solved.
Link to post
Share on other sites

So quick update, The weird scale was caused by the 

GUI, GROUND, FIXED 

Inside the dimensional_trident__.json and the dimensional_trident_throwing.json

 

So thats fixed. However the colour is still not correct.

Link to post
Share on other sites
On 3/22/2021 at 8:28 PM, Zeher_Monkey said:

So quick update, The weird scale was caused by the 


GUI, GROUND, FIXED 

Inside the dimensional_trident__.json and the dimensional_trident_throwing.json

 

So thats fixed. However the colour is still not correct.

 

Okay so I fixed this issue, turns out I wasn't passing in the values 

int p_239207_5_, int p_239207_6_

Into the 

renderer.render(stackIn, transformIn, true, matrixStack, typeBuffer, 0 (Should have been p_239207_5_), 0 (Should have been p_239207_6_), model);

Function. The item now correctly renders with the correct colour and scale.

Link to post
Share on other sites
  • Zeher_Monkey changed the title to [Solved] [1.16.5] Custom Trident, issues with in GUI, GROUND and FIXED ItemCameraTransform rendering

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
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

    • protected static final DimensionType NETHER_TYPE = new DimensionType(OptionalLong.of(18000L), false, true, true, false, 8.0D, false, true, false, true, false, 128, FuzzedBiomeMagnifier.INSTANCE, BlockTags.INFINIBURN_NETHER.getName(), THE_NETHER_ID, 0.1F); This code in DimensionType class. I found that 8.0D its what i need but i dosent know how to change this or override nether_type. If mod with same functionality exist you can give me url (i need it for my mod pack).
    • Please post your server log, it should give a clue what's going on.
    • It looks like you may be trying to reply to someone's support post, you instead you created a new one.
    • compactstorage-1.16.5-5.1b17.jarcarryon-1.16.5-1.15.5.15.jarAdHooks-1.16.4-6.1.5.0-build.0124.jarXaerosWorldMap_1.14.1_Forge_1.16.5.jarXaeros_Minimap_21.10.0.3_Forge_1.16.5.jartrashcans-1.0.10-mc1.16.5.jarSuperTools-1.2_1.16.5.jarSpartanShields-1.16.5-2.1.2.jarrandomite-1.16.4-1.0.1.jaroverloadedarmorbar-5.1.0.jaroresplusmod_1.16.5,0.1.0.jarturtle_armor-1.3.4.jartoyguns-0.1-1.16.4.jartoughnessbar-6.1.jartorchmaster-2.3.7.jarToast-Control-1.16.4-4.3.1.jartitanium-1.16.5-3.2.8.4-10.jarthermal_expansion-1.16.4-1.2.0.jartheoneprobe-1.16-3.1.4.jarthedragonlib-1.16.3-1.1.0.jarswingthroughgrass-1.16.4-1.5.3.jarsuper+armor-5.0.4(EN).jarStorageDrawers-1.16.3-8.2.2.jarsteveGolemMod_1.3.0.jarSteelArmory.jarSoulBound-1.1.3-1.16.5.jarSimplyBetter.jarSimple guns reworked 1.16.5 v1.4.jarsilent-lib-1.16.3-4.9.6.jarRunelic-1.16.5-7.0.1.jarrftoolsbase-1.16-2.0.10.jarReAuth-1.16-Forge-3.9.3.jarrandompatches-2.4.4-forge.jarprecious_armor-1.16.5.jarPlacebo-1.16.4-4.5.0.jarPatchouli-1.16.4-51.jaroverloadedarmorbar-5.1.0.jarOreExcavation-1.8.157.jarOp Armor Plus 1.16.5 0.6.jarobserverlib-1.16.5-1.5.3.jarobfuscate-0.6.2-1.16.3.jarnetheritehorsearmor-1.7.jarNeat 1.7-27.jarNaturesCompass-1.16.5-1.9.0.jarMouseTweaks-2.14-mc1.16.2.jarMorpheus-1.16.5-4.2.70.jarMoreOresArmorsAndTools 1.2.5.jarMoreArmor-1-4-0.jarMekanismTools-1.16.5-10.0.21.448.jarMekanismGenerators-1.16.5-10.0.21.448.jarmcjtylib-1.16-5.0.19.jarMantle-1.16.5-1.6.103.jarMachineBoy's ArmorTool v1.2b1.jarJustEnoughResources-1.16.5-0.12.1.121.jarJEITweaker-1.16.5-1.0.1.28.jarjei-1.16.5-7.7.0.106.jarJ0T0S0 Weapons 1.0.0.jarironchest-1.16.4-11.2.10.jarillagersweararmor-1.0.4.jariChunUtil-1.16.5-10.4.1.jarhitscan-1.0.1.jarHandyGuns2.0.jargunswithoutroses-1.16.5-1.0.9.jarGuns'N'Glory-2.0.jarGuns and Rifes.jarftb-backups-2.1.1.6.jarForgeEndertech-1.16.4-7.1.0.0-build.0075.jarFluxNetworks-1.16.5-6.1.7.12.jarFastWorkbench-1.16.4-4.5.1.jarFastLeafDecay-v25.jarFastFurnace-1.16.4-4.4.0.jarfabric-api-0.35.0+1.16.jarExtraArmor-1.12.1-1.16.5.jarEnderStorage-1.16.4-2.7.1.166-universal.jarEnchantmentDescriptions-1.16.5-7.0.8.jarEnameledArmor-1.16.2-1.0.0.8.jaremeraldtoolsandarmor1.16.x.jarEmeraldArmorAndTools.jarelevatorid-1.16.5-1.7.13.jarDiceMC-TieredArmor-1.16.5-1.1a.jarDefaultOptions_1.16.5-12.2.1.jarDecraftHorseArmor-1.16.5-r1.jarDarkUtilities-1.16.5-8.0.10.jarCyclopsCore-1.16.5-1.11.7.jarCurious Armor Stands-1.16.5-2.1.1.jarcurios-forge-1.16.5-4.0.5.2.jarCucumber-1.16.4-4.1.10.jarCTM-MC1.16.1-1.1.2.6.jarCraftingTweaks_1.16.5-12.2.1.jarCraftableChainmail-1.16.5-1.1.0.jarcraftable_chainmail_1.16.5.jarOresAboveDiamonds-1.16.4-v6.3.3.jarCraftable Saddle and Horse Armors.jarCosmeticArmorReworked-1.16.5-v3a.jarCookingForBlockheads_1.16.5-9.3.2.jarControlling-7.0.0.23.jarcomforts-forge-1.16.5-4.0.0.4.jarColtCosmeticArmorMod-1.2.5.jarCodeChickenLib-1.16.4-3.5.1.408-universal.jarClumps-6.0.0.25.jarcitadel-1.7.1-1.16.5.jarchiselsandbits-0.3.4-RELEASE.jarcarryon-1.16.5-1.15.5.15.jarbuildinggadgets-1.16.5-3.8.0.jarBookshelf-1.16.5-10.1.11.jarBomb and guns.jarBlockArmor-1.16.5-2.6.2.jarBetterMineshafts-Forge-1.16.4-2.0.4.jarBetterHorseArmor-1.16.3-1.0.1.1.jarBetterAdvancements-1.16.5-0.1.0.108.jarBedrock Armor 1.16.5-1.0.2.jarAutoRegLib-1.6-49.jararmor-visibility-2.0.1-forge.jarArmorUp-1.0.5-BETA.jarArmorUnlocked-1.16.3-1.0.1.jararmorunder-mc1.16.5-2.0b11.jararmor-stand-editor-1.1.0.jarArmorPoser-1.16.5-1.0.1.jararmorpointspp-1.16.5-2.0.0.jararmorhotswap-1.16-1.8.jarArmoredElytra-1.0.8.jararmorcurve-2.3.jarAquaculture-1.16.5-2.1.19.jarAppleSkin-mc1.16.2-forge-1.0.14.jarApotheosis-1.16.4-4.6.1.jarAncientGuns_3.2_1.16.4.jarAkashicTome-1.4-16.jar1.7.4.1-1.16.5ATOp.jar[1.16.5] BobLib-0.2.0.jar[1.16.5] Armor Status HUD-1.4.0.jarEmerald armor and tools 1.15.16 v3.jarYungsApi-1.16.4-Forge-6.jaryeni modum.jarxnet-1.16-3.0.13.jarwolveswitharmor-1.1.0-1.16.2.jarWaystones_1.16.5-7.6.2.jarvisiblearmorslots-2.0-1.16.5.jarNeat 1.7-27.jarNaturesCompass-1.16.5-1.9.0.jarMoreOresInONE-1.2_1.16.5.jarmcw-windows-1.0.3-mc1.16.5.jarmcw-bridges-1.0.5-mc1.16.5-4.jarlongfallboots-1.6.0a.jarJustEnoughResources-1.16.5-0.12.1.121.jarjei-1.16.5-7.7.0.106.jarForgeEndertech-1.16.4-7.1.0.0-build.0075.jarextcaves-2.4.jarcurios-forge-1.16.5-4.0.5.2.jarcorpse-1.16.5-1.0.5.jarAdHooks-1.16.4-6.1.5.0-build.0124.jar
    • Dude, then try to click the down arrow near "Open" then select   Java(TM) Platform SE binary then it should work or if it doesn't work then it means you don't have Java or you computer is broken.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.