Posted May 3, 201510 yr Hello, trying to increase range of players hand public static void setExtraReach(EntityLivingBase entity, float reach) { if(entity instanceof EntityPlayerMP) ((EntityPlayerMP) entity).theItemInWorldManager.setBlockReachDistance(Math.max(5, ((EntityPlayerMP) entity).theItemInWorldManager.getBlockReachDistance() + reach)); } This Method doesnt work my question is why ? and how to fix it ? I'm beginner in java and in minecraft modding. Please be specific. Any code examples are appreciated. Sorry for my english i'm from Czech republic. Please hit that thank you button if i helped
May 3, 201510 yr When is this methode called? cause this seems good to me, but I dont see how the game can reach this methode. Projects: Discontinued: - N2ConfigAPI - Meachanical Crafting Table Latest: - CollectionUtils Coöperations: - InGameConfigManager
May 3, 201510 yr Author In My eventhandler class @SubscribeEvent public void checksomething (LivingUpdateEvent event) { if(event.entityLiving instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.entityLiving; if(player.inventory.hasItem(ItemsHandler.Corn)) { System.out.println("SOMETHING !"); FMTMethods.setExtraReach(player, 3.5F); } } } This will get printed out but the setExtraEach doesnt work System.out.println("SOMETHING !"); I'm beginner in java and in minecraft modding. Please be specific. Any code examples are appreciated. Sorry for my english i'm from Czech republic. Please hit that thank you button if i helped
May 3, 201510 yr I know this might be onfusing, but you check in the event handler if entity instaceof EntityPlayer. But keep in mind that it aint the same as EntityPlayerMP(wich you check in the extendReach() methode. So the methode might be called. But the check will always be false i this case (EntityPlayer != EntityPlayerMP) Projects: Discontinued: - N2ConfigAPI - Meachanical Crafting Table Latest: - CollectionUtils Coöperations: - InGameConfigManager
May 3, 201510 yr Jabelar recently made tutorial on this, best thing is to write your own attack manager (tho I went othwer way and made own hook). http://jabelarminecraft.blogspot.com/p/minecraft-modding-extending-reach-of.html 1.7.10 is no longer supported by forge, you are on your own.
May 3, 201510 yr The reach distance on the client is determined in the PlayerControllerMP class, in the getBlockReachDistance method. You can't change the values returned there, but you can change the Minecraft#playerController field to return a custom class extending PlayerControllerMP, in which you do have full control over the method (and return your own values). Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
May 3, 201510 yr Author Ok thank you all im gonna try it I'm beginner in java and in minecraft modding. Please be specific. Any code examples are appreciated. Sorry for my english i'm from Czech republic. Please hit that thank you button if i helped
May 4, 201510 yr The reach distance on the client is determined in the PlayerControllerMP class, in the getBlockReachDistance method. You can't change the values returned there, but you can change the Minecraft#playerController field to return a custom class extending PlayerControllerMP, in which you do have full control over the method (and return your own values). I think this may have a problem though. That method is used by the EntityRenderer#getMouseOver() method. But that method seems to clamp the value to 3.0D (or 6.0D if in creative mode). Here's the relevant code: this.mc.pointedEntity = null; double d0 = (double)this.mc.playerController.getBlockReachDistance(); this.mc.objectMouseOver = this.mc.renderViewEntity.rayTrace(d0, p_78473_1_); double d1 = d0; Vec3 vec3 = this.mc.renderViewEntity.getPosition(p_78473_1_); if (this.mc.playerController.extendedReach()) { d0 = 6.0D; d1 = 6.0D; } else { if (d0 > 3.0D) { d1 = 3.0D; } d0 = d1; } if (this.mc.objectMouseOver != null) { d1 = this.mc.objectMouseOver.hitVec.distanceTo(vec3); } Doesn't that prevent values over 3.0D? This is why I chose to try creating my own mouse over method instead. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
May 4, 201510 yr I suppose you can change the whole EntityRenderer instance in the Minecraft class, but that might be a bit rediculous for what you are trying to do. BTW Jabelar, isn't your mouse over method only for entities? Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
May 4, 201510 yr BTW Jabelar, isn't your mouse over method only for entities? No, while I used the method to show attacking an entity, it is really just a copy of the mouse over method with a reach you can specify. It returns a moving object position so (although I didn't confirm it) I think it will return a block if it doesn't hit an entity. The method basically works by first doing a ray trace on the look vector which returns a block, and then iterates along the vector to that block to see if there is an entity in the way. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
May 5, 201510 yr BTW Jabelar, isn't your mouse over method only for entities? No, while I used the method to show attacking an entity, it is really just a copy of the mouse over method with a reach you can specify. It returns a moving object position so (although I didn't confirm it) I think it will return a block if it doesn't hit an entity. The method basically works by first doing a ray trace on the look vector which returns a block, and then iterates along the vector to that block to see if there is an entity in the way. Nice, maybe I'll use it in the future! Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
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.