deenkayros Posted February 5, 2015 Posted February 5, 2015 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. Quote
Belpois Posted February 5, 2015 Posted February 5, 2015 You could look for the items the player is wearing and set them to invisible too Quote I require Java, both the coffee and the code
deenkayros Posted February 5, 2015 Author Posted February 5, 2015 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... Quote
Belpois Posted February 5, 2015 Posted February 5, 2015 You can maybe apply the invisible potion on the player Quote I require Java, both the coffee and the code
deenkayros Posted February 5, 2015 Author Posted February 5, 2015 You can maybe apply the invisible potion on the player Yes, I tried but my player still visible to me ... Quote
Belpois Posted February 5, 2015 Posted February 5, 2015 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. Quote I require Java, both the coffee and the code
nekpek Posted February 5, 2015 Posted February 5, 2015 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. Quote Naturalis - The easy way for nature.! Esquire - A helping hand for your adventure. Jimanju - The Random Disasters!
deadrecon98 Posted February 5, 2015 Posted February 5, 2015 Just make a render for the armor and then make it not render the armor when the player is invisible. Quote
deenkayros Posted February 5, 2015 Author Posted February 5, 2015 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 ... Quote
deenkayros Posted February 5, 2015 Author Posted February 5, 2015 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()); } } Quote
deenkayros Posted February 5, 2015 Author Posted February 5, 2015 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... Quote
deenkayros Posted February 5, 2015 Author Posted February 5, 2015 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 .... Quote
deenkayros Posted February 5, 2015 Author Posted February 5, 2015 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 ... Quote
Belpois Posted February 6, 2015 Posted February 6, 2015 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. Quote I require Java, both the coffee and the code
deenkayros Posted February 6, 2015 Author Posted February 6, 2015 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? Quote
Belpois Posted February 6, 2015 Posted February 6, 2015 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. Quote I require Java, both the coffee and the code
Belpois Posted February 6, 2015 Posted February 6, 2015 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 Quote I require Java, both the coffee and the code
Recommended Posts
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.