Posted December 22, 20177 yr So, I have an Item, when it is right clicked it fetches the capability data stored in the player's current chunk: Spoiler public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { //TODO sense arcana if(!worldIn.isRemote) { Chunk chunk = worldIn.getChunkFromBlockCoords(playerIn.getPosition()); Chunk chunk2 = Minecraft.getMinecraft().world.getChunkFromBlockCoords(playerIn.getPosition()); IArcana a = chunk.getCapability(ArcanaProvider.ARCANA_CAP, null); IArcana a1 = chunk2.getCapability(ArcanaProvider.ARCANA_CAP, null); int[] s = a.getArcana(); int[] s1 = a1.getArcana(); int f = s[0]; int ai = s[1]; int ea = s[2]; int w = s[3]; int ar = s[4]; int f1 = s1[0]; int ai1 = s1[1]; int ea1 = s1[2]; int w1 = s1[3]; int ar1 = s1[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); playerIn.sendMessage(new TextComponentTranslation("TEST Fire: "+f1+" Air: "+ai1+" Earth: "+ea1+" Water: "+w1+" Arcana: "+ar1)); } return new ActionResult<ItemStack>(EnumActionResult.PASS, playerIn.getHeldItem(handIn)); } However, while I was testing some gui code that also fetched the same data, I noticed a difference in the result leading to the above test. In the first test, I get an instance of the Chunk from the worldIn object In the second test, I get an instance of the Chunk from Minecraft's (I think it's called a singleton) main world instance I then print both and get two different outcomes. Question: Why are they different? Can I just run my code (i.e. subtracting and adding to the chunk capability) based off of Minecraft::world without any consequences? Edited December 22, 20177 yr by GooberGunter
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.