Jump to content

[1.15.2] How to stop an Item from rendering on your head?


Fuffles
 Share

Recommended Posts

Hey all,
Im currently trying to make a special armor using an Entity Layer (Long Story/Short, it uses a Tile Ent renderer and I want to display that, and I kinda dont wanna make a new BipedModel extension for all the models it uses...) and it all works super well, but the Item still displays on the head for some reason, resulting in the proper one (The Layer) and the other one (The Item in its block state) to show...
Is there a way to force stop it from rendering on the Head? Or do I have to scrap the Entity Layer idea and go with a different way?

Also, is it possible to make the Event only add the layer once? Im pretty sure with this:

Quote

private static Class<?>[] armorWearers =
    {
        ClientPlayerEntity.class,
        DrownedEntity.class,
        GiantEntity.class,
        HuskEntity.class,
        SkeletonEntity.class,
        StrayEntity.class,
        PlayerEntity.class,
        WitherSkeletonEntity.class,
        ZombieEntity.class,
        ZombiePigmanEntity.class,
        ZombieVillagerEntity.class,
    };
    
    public static void onLivingRender(final RenderLivingEvent.Post<?, ?> renderLivingEvent)
    {
        LivingEntity entity = renderLivingEvent.getEntity();
        LivingRenderer<?, ?> entityRenderer = renderLivingEvent.getRenderer();
        for (Class<?> entityClass : armorWearers)
        {
            if (entity.getClass() == entityClass)
            {
                if (entity.isAddedToWorld())
                {
                    JustAnotherHeadMod.LOGGER.info("PUSH FOR " + entity.getClass().toString());
                    entityRenderer.addLayer(new AnotherHeadLayer(entityRenderer));
                }
            }
        }
    }

It's generating more than 1 of these layers, creating lag when you wear it on your head

Edited by Fuffles
Link to comment
Share on other sites

Bump
Alright maybe more info is needed;
My Item  is a Block that you can place in the world, but also equipable on the head. It uses an ISTER (ItemStackTileEntityRegister) and as with all blocks/items it displays on your head. Due to the fact that I am using an LivingEntRenderer and a Layer, like the Elytra, Head or HeldItem it displays it twice, the actual Layer that  I want and the displayed Item/Block which is unwanted. I'd like to get rid of that display, but I dont know how to.

On the other hand, whenever I equip the item, lags seem to spike, I believe this is due to the fact that the renderEvent happens constantly which adds infinite layers. If it would be possible to get the Layer data, which its not since it has not a get() and it's protected, this wouldnt be a problem. Is there any way to add the layer otherwise or should I look into a different method? I'd prefer not to have to make 20 BipedModel extensions for all the forms the Item has and use the ModelBases

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
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.

 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • The version you are using is no longer supported on this forum. Please update to a modern version of Minecraft to receive support. Currently supported versions are 1.19.2 (Latest) and 1.18.2 (LTS).
    • I was trying to change item models with Model backer and ItemOverrides but it's too annoying so I looked for alternative ways: but for that I need to make many items, in this case for each model one item, however each item would have five models and I want to make about 30 items. That way I would have to make 600 items? this is a lot, can the forge handle it?
    • I originally posted here in error, as the issue I was having was for fabric, not forge, so I don't know anything about your issue but I solved my issue by downgrading my graphics drivers, here's a link to a post I made on Minecraft forum, I made an edit on the post with the solution that worked for me:   https://www.minecraftforum.net/forums/support/java-edition-support/3164709-solved-minecraft-fabric-modpack-crash-when#c4
    • 20:14:21.373 net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer main Found mod file forge-1.19.2-43.1.43-universal.jar of type MOD with provider net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@5c92166b 20:14:21.386 net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer main Failed to build unique mod list after mod discovery. net.minecraftforge.fml.loading.EarlyLoadingException: Duplicate mods found at MC-BOOTSTRAP/fmlloader@1.19.2-43.1.43/net.minecraftforge.fml.loading.UniqueModListBuilder.buildUniqueList(UniqueModListBuilder.java:78) at MC-BOOTSTRAP/fmlloader@1.19.2-43.1.43/net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer.discoverMods(ModDiscoverer.java:105) at MC-BOOTSTRAP/fmlloader@1.19.2-43.1.43/net.minecraftforge.fml.loading.FMLLoader.beginModScan(FMLLoader.java:166) at MC-BOOTSTRAP/fmlloader@1.19.2-43.1.43/net.minecraftforge.fml.loading.FMLServiceProvider.beginScanning(FMLServiceProvider.java:86) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.TransformationServiceDecorator.runScan(TransformationServiceDecorator.java:112) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.TransformationServicesHandler.lambda$runScanningTransformationServices$8(TransformationServicesHandler.java:100) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1779) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.TransformationServicesHandler.runScanningTransformationServices(TransformationServicesHandler.java:102) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.TransformationServicesHandler.initializeTransformationServices(TransformationServicesHandler.java:55) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.Launcher.run(Launcher.java:87) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.Launcher.main(Launcher.java:77) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) at cpw.mods.bootstraplauncher@1.1.2/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) 20:14:21.399 net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer main Mod Discovery failed. Skipping dependency discovery. 20:14:21.990 launcher main Exception in thread "main" java.lang.IllegalStateException: Failed to find system mod: minecraft at MC-BOOTSTRAP/fmlloader@1.19.2-43.1.43/net.minecraftforge.fml.loading.ModSorter.detectSystemMods(ModSorter.java:181) at MC-BOOTSTRAP/fmlloader@1.19.2-43.1.43/net.minecraftforge.fml.loading.ModSorter.buildUniqueList(ModSorter.java:145) at MC-BOOTSTRAP/fmlloader@1.19.2-43.1.43/net.minecraftforge.fml.loading.ModSorter.sort(ModSorter.java:53) at MC-BOOTSTRAP/fmlloader@1.19.2-43.1.43/net.minecraftforge.fml.loading.moddiscovery.ModValidator.stage2Validation(ModValidator.java:101) at MC-BOOTSTRAP/fmlloader@1.19.2-43.1.43/net.minecraftforge.fml.loading.FMLLoader.completeScan(FMLLoader.java:175) at MC-BOOTSTRAP/fmlloader@1.19.2-43.1.43/net.minecraftforge.fml.loading.FMLServiceProvider.completeScan(FMLServiceProvider.java:91) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.TransformationServiceDecorator.onCompleteScan(TransformationServiceDecorator.java:174) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.TransformationServicesHandler.lambda$triggerScanCompletion$24(TransformationServicesHandler.java:145) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1779) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.TransformationServicesHandler.triggerScanCompletion(TransformationServicesHandler.java:147) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.Launcher.run(Launcher.java:94) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.Launcher.main(Launcher.java:77) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) at cpw.mods.bootstraplauncher@1.1.2/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) 20:14:21.990 monitor Process Monitor Process crashed with exit code 1
    • I am created a packet that spawns 3 golems and adds a timer to their persistant data along with the name of the owner who spawned them. public boolean handle(Supplier<NetworkEvent.Context> supplier){ NetworkEvent.Context context = supplier.get(); context.enqueueWork(()-> { Player p = context.getSender(); if(p.getPersistentData().contains(XprtData.SALUS_CLASS)){ if(!p.getPersistentData().contains(XprtData.SALUS_DEFENDER_TIMER)){ for(int i=0;i<3;i++){ IronGolem golem = (IronGolem) EntityType.IRON_GOLEM.spawn(p.createCommandSourceStack().getLevel(), null, null, p.blockPosition(), MobSpawnType.MOB_SUMMONED, true, false); golem.getPersistentData().putInt(XprtData.SALUS_DEFENDER_TIMER, Utils.Seconds(50)); golem.getPersistentData().putString(XprtData.SALUS_DEFENDER_OWNER, p.getScoreboardName()); golem.setCustomName(Component.literal(ChatFormatting.GOLD + "" + p.getScoreboardName() + "'s Defender")); } p.getPersistentData().putInt(XprtData.SALUS_DEFENDER_TIMER, Utils.Seconds(5)); } else { int time = p.getPersistentData().getInt(XprtData.SALUS_DEFENDER_TIMER); Utils.Message(p, ChatFormatting.RED + "You cannot summon defenders right now, " + Utils.TicksToSeconds(time) + " seconds remaining."); } } }); return true; } the problem is when I call upon their data in an external class here @SubscribeEvent public static void onLivingTick(LivingEvent.LivingTickEvent e){ LivingEntity entity = e.getEntity(); if(entity instanceof IronGolem){ if(entity.getPersistentData().contains(XprtData.SALUS_DEFENDER_TIMER)){ Mob mob = (Mob)entity; for(LivingEntity target : Utils.getNear(entity, 8)){ if(target instanceof Player || target instanceof Villager || target instanceof Wolf || target instanceof IronGolem){ mob.setTarget(null); } else { mob.setTarget(target); } } } if(entity.getPersistentData().contains(XprtData.SALUS_DEFENDER_OWNER)){ String owner = entity.getPersistentData().getString(XprtData.SALUS_DEFENDER_OWNER); for(String pNames : entity.getServer().getPlayerNames()){ if(pNames.equals(owner)){ Player p = entity.getServer().getPlayerList().getPlayerByName(owner); if(entity.distanceTo(p) >= 7f){ entity.teleportTo(p.getBlockX(), p.getBlockY()+1, p.getBlockZ()); } } } } } } neither XprtData.SALUS_DEFENDER_TIMER nor XprtData.SALUS_DEFENDER_OWNER contain any data, for the timer it starts off at 0 when it should be (22*50) and defender owner should contain the players name which instead contains a blank.   This isnt my first time doing something like this, ive done it will illagers and it worked perfectly but when it comes to golems it doesnt work at all. I could do with it the timer killing them at -(22*50) but it wont help that i still need the owners name to teleport them to the owner if they move to far away. Any Ideas? Im calling this packet from a keybind by the way   EDIT:  I figured out the issue, I guess when the packet is received by server and the entity is created there is a delay before the persistant data is created I guess, im not too sure...  Anyways I fixed it by just calling the persistant data twice 
  • Topics

×
×
  • Create New...

Important Information

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