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 have a capability of an int array that assigns 5 values to each chunk. I also have an Item that is supposed to read the array in the chunk that the player is currently in. 

How do I use these packets? I already made them and I get the general idea of how they work, but I just don't know how to send them.

 

My major problem is that i need an EntityPlayerMP, which is the same player as the one who activated the item "playerIn" but I don't know how to pass that on from EntityPlayer to EntityPlayerMP, since casting is out of the question

Spoiler

@Override
	public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
    {
        //TODO sense the stuff
			Chunk chunk = worldIn.getChunkFromBlockCoords(playerIn.getPosition());
			IArcana a = chunk.getCapability(ArcanaProvider.ARCANA_CAP, null);
			int[] s = a.getArcana();
			//TODO find a way to convert single player to multiplayer
			GrandSorcery.handler.INSTANCE.sendTo(new ElementMessage(s), entityPlayerMP);
			
	
		if(worldIn.isRemote) {
			int f = element[0];
			int ai = element[1];
			int ea = element[2];
			int w = element[3];
			int ar = element[4];
			playerIn.sendMessage(new TextComponentTranslation("Fire: "+f+" Air: "+ai+" Earth: "+ea+" Water: "+w+" Arcana: "+ar));
			Util.logger.info("Fire: "+f+" Air: "+ai+" Earth: "+ea+" Water: "+w+" Arcana: "+ar);
		}
		return new ActionResult<ItemStack>(EnumActionResult.PASS, playerIn.getHeldItem(handIn));
    }
	
	public static void setElement(int[] val) {
		element = val;
	}

 

 

 

Edited by GooberGunter

  • Author

Is there some sort of way to link the EntityPlayer from the method to EntityPlayerMP?

Edited by GooberGunter
Accidentally thought I found a bigger problem but it was just because I was loading from an older save

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.