Posted February 4, 201411 yr SO, I'm going to break it down without code, fast and easy. I'm using an AABB to detect the player standing on my block (AABB is client side only) The tile entity from the block starts a counter and when it reaches 0 it opens a gui. On LAN however, this gui is opened for all players because (i think) it is done client side only (i dont have that when i use like right click on a block to open it, which is both sides) if i send a packet to the server to open the gui, the screen wont show, because it's not send client side. Anyone got any advice ? Or needs more info ? Thank you very much; Subaraki https://minecraft.curseforge.com/members/Subaraki/projects
February 4, 201411 yr Author as stated above, i use it to detect with AABB if a player is standing on the block. without using AABB, I can't check for the player, and I don't have a player to open a gui. unless i can check for the player differently. https://minecraft.curseforge.com/members/Subaraki/projects
February 4, 201411 yr How is AABB client-side only? Neither the method World.getEntitiesWithinAABB nor the AxisAlignedAABB class itself are client-side only... what are you using? Perhaps posting the specific code would make it more clear. http://i.imgur.com/NdrFdld.png[/img]
February 5, 201411 yr Author if(ownerName.equals("UNIVERSAL") && !telepadname.equals("Universal Pad")){ this.telepadname = "Universal Pad"; } if(worldObj.isRemote){//client only AxisAlignedBB aabb = this.getRenderBoundingBox().copy().expand(-0.5, 0.5, -0.5); List<EntityPlayer> playerInAabb = worldObj.getEntitiesWithinAABB(EntityPlayer.class, aabb); if(isStandingOnPlatform){ if(playerInAabb.isEmpty() || !playerInAabb.contains(playerStandingOnPad)){ changePlatformState(false); } } for(EntityPlayer p : playerInAabb){ if(p!=null){ if(isStandingOnPlatform == false)//check to prevent packet from spamming changePlatformState(true); if(counter >=0) counter --; } if(counter <= 0){ if(p != null && Minecraft.getMinecraft().currentScreen == null){ if(p.inventory.hasItem(mod_telepads.padLocator.itemID)){ for(int i = 0; i < p.inventory.getSizeInventory(); i++){ if(p.inventory.getStackInSlot(i) != null && p.inventory.getStackInSlot(i).getItem() instanceof ItemPadLocations){ ItemStack stack = p.inventory.getStackInSlot(i);//the telepad register //for nitwits that put in a new list from creative or trough 'cheating' if(!stack.hasTagCompound()){ ResetAndNotify("Damn, that's not the right TelePad Register..."); break; }else{ if(p.username.equals(ownerName) || ownerName.equals("UNIVERSAL")){ allCoords = new ArrayList<int[]>(); allNames = new ArrayList<String>(); allDims = new ArrayList<Integer>(); int size = stack.getTagCompound().getInteger(ItemPadLocations.SIZE); for(int c =0; c < size; c++){ int[] ray = new int[3]; ray[0] = stack.getTagCompound().getIntArray(ItemPadLocations.LOCATION_+c)[0]; ray[1] = stack.getTagCompound().getIntArray(ItemPadLocations.LOCATION_+c)[1]; ray[2] = stack.getTagCompound().getIntArray(ItemPadLocations.LOCATION_+c)[2]; String padName = stack.getTagCompound().getString("TelePadName_"+c); int dim = stack.getTagCompound().getInteger(ItemPadLocations.DIM_+c); allCoords.add(ray); allNames.add(padName); allDims.add(dim); } setRegisterToPad(stack); // setMCGuiSettingToRegister(stack); stack.getTagCompound().setInteger("originalGUIScale", Minecraft.getMinecraft().gameSettings.guiScale); // ... and open gui //SEND a packet to open gui. openng a gui client side only will result in all players //having the gui open on LAN. //p.openGui(mod_telepads.instance, 0, worldObj, xCoord, yCoord, zCoord); //FMLNetworkHandler.openGui(p, mod_telepads.instance, 0, worldObj, xCoord, yCoord, zCoord); updatePlayerInPad(p.username, 0); // playerNameOnPad = p.username; // CanTeleportNow = true; break; }else{ ResetAndNotify("Oops, this is not my TelePad."); break; } } } } }else{ if(p.username.equals(ownerName)) updatePlayerInPad(p.username ,2); //p.openGui(mod_telepads.instance, 2, worldObj, xCoord, yCoord, zCoord); ResetAndNotify("Damn, I forgot my TelePad Register..."); break; } } } } } } getRenderBoundingBox is client side only. https://minecraft.curseforge.com/members/Subaraki/projects
February 5, 201411 yr Why are you using the render bounding box instead of a regular bounding box? If this is in a client-only class, then try sending a packet to the server telling it to search for entities instead. http://i.imgur.com/NdrFdld.png[/img]
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.