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

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

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

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.