Jump to content

[1.8] make player completely invisible [UNSOLVED]


deenkayros

Recommended Posts

Hello,

 

I tried to make the player invisible at all by this code:

player.setInvisible(true);

 

But I noted that the armor and the held item still visible .... then I tried this code in addiction:

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

 

but nothing to do ... please help.

Link to comment
Share on other sites

I got this from the MC Wiki

 

http://minecraft.gamepedia.com/Potion

Makes player model disappear and mobs will act neutral towards the player if the player is not wearing armor (leave chunk to perform). In splash form it is able to make mobs or other players invisible. Armor and items held in hand are not affected by this. Some mob 'Armor' (sheep's wool, mushrooms of a mooshroom, eyes of spiders/enderman, 'Arrows' and a snow golem's pumpkin) is still visible.

 

Seems like even vanilla MC doesn't hide the armor.

I require Java, both the coffee and the code :)

Link to comment
Share on other sites

I got this from the MC Wiki

 

http://minecraft.gamepedia.com/Potion

Makes player model disappear and mobs will act neutral towards the player if the player is not wearing armor (leave chunk to perform). In splash form it is able to make mobs or other players invisible. Armor and items held in hand are not affected by this. Some mob 'Armor' (sheep's wool, mushrooms of a mooshroom, eyes of spiders/enderman, 'Arrows' and a snow golem's pumpkin) is still visible.

Seems like even vanilla MC doesn't hide the armor.

 

 

I think that was what he was referring to from the beginning.

 

@deenkayros

You could see what the Player.setInvisble do and do something similar with the items in hes inventory

or perhaps hook into the render and "temporary" stop it from rendering the items.

 

 

Naturalis - The easy way for nature.!

Esquire - A helping hand for your adventure.

Jimanju - The Random Disasters!

Link to comment
Share on other sites

Canceling the RenderPlayerEvent should work fine.

 

yes, i tried this:

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

or

@SubscribeEvent
public void pre(RenderPlayerEvent event) {
	event.setCanceled(true);
}

 

But seems wont work ...

Link to comment
Share on other sites

Main class:

@SidedProxy(clientSide = "ClientProxy", serverSide = "ServerProxy")

 

ClientProxy class:

public class ClientProxy
   extends CommonProxy
{
   public void registerEvents()
   {
     super.registerEvents();
     //FMLCommonHandler.instance().bus().register(new ServerTickHandler());
    }
}

 

ServerProxy class:

public class ServerProxy
   extends CommonProxy
{
   public void registerEvents()
   {
     super.registerEvents();
     //FMLCommonHandler.instance().bus().register(new ServerTickHandler());
   }
}

 

CommonProxy class:

public class CommonProxy
   implements IProxy
{
   public void registerEvents()
   {
     FMLCommonHandler.instance().bus().register(new ServerTickHandler());
   }
}

Link to comment
Share on other sites

RenderPlayerEvent is a forge event, it will not be fired on FML's EventBus.

 

I added a new class:

 

RenderTickHandler class:

public class RenderTickHandler {

@SubscribeEvent
public void pre(RenderPlayerEvent event) {
	//if (event.entityPlayer.isInvisible()) {
		event.setCanceled(true);
	//}
}
}

 

And into CommonProxy:

       MinecraftForge.EVENT_BUS.register(new RenderTickHandler());

 

but nothing to do...

Link to comment
Share on other sites

I just wrote the code in my mod and it works, also in 3rd person mode. Obviously other players need to receive a packet to know that they don't have to show the player model.

 

Image:

 

 

Note that i'm holding ta block in my hand, and the placed block is for reference.

262a92s.jpg

 

 

 

Start a different MC in debug mode and open to LAN so you can test this, with multiple players.

I require Java, both the coffee and the code :)

Link to comment
Share on other sites

I just wrote the code in my mod and it works, also in 3rd person mode. Obviously other players need to receive a packet to know that they don't have to show the player model.

 

Image:

 

 

Note that i'm holding ta block in my hand, and the placed block is for reference.

262a92s.jpg

 

 

 

Start a different MC in debug mode and open to LAN so you can test this, with multiple players.

 

What method or function you have used?

Link to comment
Share on other sites

I just wrote the code in my mod and it works, also in 3rd person mode. Obviously other players need to receive a packet to know that they don't have to show the player model.

 

Image:

 

 

Note that i'm holding ta block in my hand, and the placed block is for reference.

262a92s.jpg

 

 

 

Start a different MC in debug mode and open to LAN so you can test this, with multiple players.

 

What method or function you have used?

 

The same one that was mentioned in this forum:

 

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

 

The class I implemented it in, is hooked with both the Forge Event bus and FML event bus. Try both see which one will trigger it.

I require Java, both the coffee and the code :)

Link to comment
Share on other sites

Try both see which one will trigger it.

No. Please no.

 

Ok ok, I checked it's the forge event bus :) Hooking it up with the forge event bus makes it work.

 

Even armor is hidden and anything in my hand.

 

PPPatternClientGuiManager ppPatternClientGuiManager = new PPPatternClientGuiManager();
MinecraftForge.EVENT_BUS.register(ppPatternClientGuiManager);
this.guiManagers.put(GuiPPPattern.class, ppPatternClientGuiManager);

 

ignore the names, I just stuck it in a handler to check if the code works or not :P

I require Java, both the coffee and the code :)

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.