FLUFFY2 Posted August 22, 2014 Posted August 22, 2014 Right now im using: if(player.inventory.mainInventory[8] != null && player.inventory.mainInventory[8].getItem() == Amnesia.LanternOn) But thats client only. So how can i make so that other players know that an item is in a hotbar slot? I need a method that works both side and still can detect a specified inventory slot. Thanks! Quote
FLUFFY2 Posted August 23, 2014 Author Posted August 23, 2014 Lol, okey. So than how can i notice other players to render the item if its in my hotbar slot? Send a packet to all players or what? Thanks! Quote
FLUFFY2 Posted August 23, 2014 Author Posted August 23, 2014 Okey, than im probably doing something wrong. I can see the render other cannot. Slot detect: if(!world.isRemote){ if(player.inventory.mainInventory[8] != null && player.inventory.mainInventory[8].getItem() == Amnesia.LanternOn){ if(!props.isQuickEquipped()){ Amnesia.snw.sendTo(new HotbarLanternMessageHandler(true), (EntityPlayerMP)player); props.setQuickEquipped(true); } }else{ if(props.isQuickEquipped()){ Amnesia.snw.sendTo(new HotbarLanternMessageHandler(false), (EntityPlayerMP)player); props.setQuickEquipped(false); } } } Packet handler(only onMessage): @Override public IMessage onMessage(HotbarLanternMessageHandler message, MessageContext ctx) { ExtendedPlayerPropertiesHandler.get(Minecraft.getMinecraft().thePlayer).setHotbarLantern(message.isWorn); return null; } This is the render part: @SubscribeEvent public void render(RenderPlayerEvent.Specials.Pre event){ EntityPlayer player = event.entityPlayer; ExtendedPlayerPropertiesHandler props = ExtendedPlayerPropertiesHandler.get(player); if(props.hotbarLantern()){ GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(lanternOnTexture); GL11.glRotatef(5F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(-40F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(165F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0.0F, -1.4F, -0.12F); float scale = 0.1F; GL11.glScalef(scale, scale, scale); model.renderAll(); GL11.glPopMatrix(); } } Thanks for helping! Quote
FLUFFY2 Posted August 23, 2014 Author Posted August 23, 2014 I know that the client is know whats in my hand. I just don't uderstand how can i inform other players that i have it in there. I know you said pakets, but you also said not to all player. That confuses me a bit. Can you tell me what steps is bad because i doing the following: Check hotbar on sevrer side -> Send a packet to the client -> Set a boolean to true -> Render. But i will try this aswell: Check hotbar client side -> Send packet to the server than send a return packet to others client and set the boolean -> Render Thanks for helping and for your patience. Quote
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.