Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

You could look for the items the player is wearing and set them to invisible too

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

  • Author

You could look for the items the player is wearing and set them to invisible too

 

How? I cant see any "Item.isVisible" property to modify ...

 

I think about something render prohibition instead...

You can maybe apply the invisible potion on the player

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

  • Author

You can maybe apply the invisible potion on the player

 

Yes, I tried but my player still visible to me ...

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 :)

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!

  • Author

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

  • Author

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());
   }
}

  • Author

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

  • Author

You need to cancel the Pre version of the event. And that should make all players invisible on screen.

 

Yes, i do:

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

 

but seems can't fire this event at all ....

  • Author

How are you testing this? Without other players online or in 3rd person this event will not fire.

 

oh, i need to do this strictly in 3rd person ... xD

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 :)

  • Author

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?

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 :)

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 :)

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.