Posted December 13, 20177 yr 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 December 14, 20177 yr by GooberGunter
December 14, 20177 yr Author Is there some sort of way to link the EntityPlayer from the method to EntityPlayerMP? Edited December 14, 20177 yr 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.