Posted February 5, 201510 yr 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.
February 5, 201510 yr 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
February 5, 201510 yr 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...
February 5, 201510 yr You can maybe apply the invisible potion on the player I require Java, both the coffee and the code
February 5, 201510 yr Author You can maybe apply the invisible potion on the player Yes, I tried but my player still visible to me ...
February 5, 201510 yr 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
February 5, 201510 yr 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!
February 5, 201510 yr Just make a render for the armor and then make it not render the armor when the player is invisible.
February 5, 201510 yr 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 ...
February 5, 201510 yr 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()); } }
February 5, 201510 yr 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...
February 5, 201510 yr 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 ....
February 5, 201510 yr 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 ...
February 6, 201510 yr 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. 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
February 6, 201510 yr 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. 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?
February 6, 201510 yr 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. 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
February 6, 201510 yr 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 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.