Jump to content

[1.18.2] Overriding player skin overlay after equipping certain armor


DERPZ774

Recommended Posts

On 8/19/2022 at 3:12 AM, diesieben07 said:

You can use RenderPlayerEvent.Pre to hide these parts of the model. Look at PlayerRenderer#setModelProperties for how to modify their visibility.

I ran into an issue while running it on a server.  https://hastebin.com/qajuvasifo.properties

 

@SubscribeEvent public static void renderPlayerPre(RenderPlayerEvent.Pre event) { if (event.getPlayer().getInventory().getArmor(2).is(ModItems.VAULT_SUIT.get())) { event.getRenderer().getModel().leftSleeve.visible = false; event.getRenderer().getModel().rightSleeve.visible = false; //event.getRenderer().getModel().hat.visible = false; event.getRenderer().getModel().jacket.visible = false; event.getRenderer().getModel().leftPants.visible = false; event.getRenderer().getModel().rightPants.visible = false; event.getRenderer().getModel().head.visible = false; } /// TODO: 8/19/2022 edit statements here for all armor /// TODO: 8/20/2022 Fix server crashing }

this is the code

Link to comment
Share on other sites

2 minutes ago, Luis_ST said:

Move your EventHandler in a client only class, you can achieve this by setting the value "value" in the EventBusSubscriber annotation to Dist#CLIENT.

Doing this fixed the server issue, however now the client wont load https://hastebin.com/yunamudeqi.properties
Code :
 

@Mod.EventBusSubscriber(modid = FalloutMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class ModEventClientBusEvents {


    @SubscribeEvent
    public static void clientSetup(final FMLClientSetupEvent event) {
        ItemBlockRenderTypes.setRenderLayer(ModBlocks.LAMP.get(), RenderType.cutout());
        ModItemProperties.addCustomItemProperties();
        MenuScreens.register(ModMenuTypes.NUKA_COLA_OPENER_MENU.get(), NukaColaOpenerScreen::new);
        EntityRenderers.register(ModEntityTypes.TEST.get(), TestRenderer::new);

    }


    @SubscribeEvent
    public static void renderPlayerPre(RenderPlayerEvent.Pre event)
    {

        if (event.getPlayer().getInventory().getArmor(2).is(ModItems.VAULT_SUIT.get())) {
            event.getRenderer().getModel().leftSleeve.visible = false;
            event.getRenderer().getModel().rightSleeve.visible = false;
            //event.getRenderer().getModel().hat.visible = false;
            event.getRenderer().getModel().jacket.visible = false;
            event.getRenderer().getModel().leftPants.visible = false;
            event.getRenderer().getModel().rightPants.visible = false;
            event.getRenderer().getModel().head.visible = false;
        }


        /// TODO: 8/19/2022 edit statements here for all armor
        /// TODO: 8/20/2022 Fix server crashing
    }


    @SubscribeEvent
    public static void registerArmorRenderer(final EntityRenderersEvent.AddLayers event) {
        GeoArmorRenderer.registerArmorRenderer(UnderArmorItem.class, new UnderArmorRenderer());
        /// TODO: 8/19/2022 Armor renders here
    }



}

 

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.



×
×
  • Create New...

Important Information

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