Jump to content

Toggleable Invisibility//1.12.2


Blaez

Recommended Posts

I've Tried this with success however I can't re-enable the rendering event so player remains invisible aswell as being unsure if this would just target one player or if it disables all. which isn't my intent..

@SubscribeEvent
public void pre(RenderPlayerEvent.Pre event) {
  if (RWBYSword.runhideevent){
	event.setCanceled(true);
  }
}

This has same problem as above not being able to reset the render of the player aswell as the problems of below.

    @SubscribeEvent
    public void renderPlayerPostEvent(RenderPlayerEvent.Post e) {

        FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
        EntityPlayer player = Minecraft.getMinecraft().player;
        ModelPlayer model = (ModelPlayer) e.getRenderer().getMainModel();

        if (e.getEntityPlayer() != null && e.getRenderer().getMainModel() instanceof ModelPlayer) {
            if (RWBYSword.runhideevent)
            model.bipedLeftArm.isHidden =
                    model.bipedLeftArmwear.isHidden =
                    model.bipedBody.isHidden =
                            model.bipedBodyWear.isHidden =
                                    model.bipedHead.isHidden =
                                            model.bipedHeadwear.isHidden =
                                                    model.bipedRightArm.isHidden =
                                                            model.bipedRightArmwear.isHidden =
                                                                    model.bipedLeftLeg.isHidden =
                                                                            model.bipedLeftLegwear.isHidden =
                                                                                    model.bipedRightLeg.isHidden =
                                                                                            model.bipedLeftLegwear.isHidden = true;

        }}

These all have similar effects ie armour and held item will still render which isn't what I'm trying to accomplish

player.setInvisible(true);
PotionEffect potioneff = new PotionEffect(MobEffects.INVISIBILITY, 10, 5, true, false);
playerIn.addPotionEffect(potioneff);

In Addition to These: Which didn't do anything, which I've put down to being deprecated as my event handler will fire the other events just fine

    @SubscribeEvent
    public void onArmorEvent(RenderPlayerEvent.SetArmorModel e) {
        if (e.getEntityPlayer() !=null) {
            if (RWBYSword.runhideevent){
                e.setCanceled(true);
        }}
    }

    @SubscribeEvent public void onSpecials(RenderPlayerEvent.Specials en){
        if (en.getEntityPlayer() !=null){
            if (RWBYSword.runhideevent){
            en.setCanceled(true);
        }}
    }

 

I'm open to any suggestions on how to get complete toggle-able invisibility of the target player as my attempts don't seem to be working.

the effect I'd like to achieve is very similar to /vanish from bukkit or similar. any help would be appreciated.

Link to comment
Share on other sites

Canceling the event does work. however as I said not entirely, It won't start rendering the player again unless you restart the game. I'm just wondering if there is a way to force the player to be rendered again after canceling the event as it doesn't seem to want to restart or render the player again on its own.

Link to comment
Share on other sites

Thanks for that information. it is much appreciated. I worked it out with a bit of a timer delay and have achieved the desired effect for the most part. however this currently cancels rendering of all players. is there a way to specify just one player say with a player instance? or something like that?

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.

Announcements



×
×
  • Create New...

Important Information

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