NuclearFej Posted April 25, 2013 Posted April 25, 2013 Just want to know if this is good practice or not. What I'm doing is adding sets of armor identical to the original ones with the exception (no pun intended) of one thing: the player must be at a certain level to equip the armor. What I did to achieve this is: I created my own armor class and overrode the isValidArmor method, so that I can check if the player is of a high enough level. Problem is, there is no way to get the player from the given parameters, namely, an ItemStack and an int. So, I did the following: Minecraft.getMinecraft().thePlayer Will this cause any problems down the line? I know it's a bit hacky. Thanks! Quote
NuclearFej Posted April 25, 2013 Author Posted April 25, 2013 Just want to know if this is good practice or not. What I'm doing is adding sets of armor identical to the original ones with the exception (no pun intended) of one thing: the player must be at a certain level to equip the armor. What I did to achieve this is: I created my own armor class and overrode the isValidArmor method, so that I can check if the player is of a high enough level. Problem is, there is no way to get the player from the given parameters, namely, an ItemStack and an int. So, I did the following: Minecraft.getMinecraft().thePlayer Will this cause any problems down the line? I know it's a bit hacky. Thanks! Quote
rob_bb Posted April 25, 2013 Posted April 25, 2013 I hope so because I am doing this: EntityLiving player = Minecraft.getMinecraft().thePlayer; int dir = MathHelper.floor_double((double)((player.rotationYaw * 4F) / 360F) + 0.5D) & 3; double x = event.entityItem.posX; double y = event.entityItem.posY; double z = event.entityItem.posZ; inside ItemTossEvent to get a players location, is their any other way? Also, is their a way to get the block that the player is looking at in the cross hairs? Quote
rob_bb Posted April 25, 2013 Posted April 25, 2013 I hope so because I am doing this: EntityLiving player = Minecraft.getMinecraft().thePlayer; int dir = MathHelper.floor_double((double)((player.rotationYaw * 4F) / 360F) + 0.5D) & 3; double x = event.entityItem.posX; double y = event.entityItem.posY; double z = event.entityItem.posZ; inside ItemTossEvent to get a players location, is their any other way? Also, is their a way to get the block that the player is looking at in the cross hairs? Quote
vdvman1 Posted April 25, 2013 Posted April 25, 2013 Just to let you know, the Minecraft class is only available on the client side Quote
vdvman1 Posted April 25, 2013 Posted April 25, 2013 Just to let you know, the Minecraft class is only available on the client side Quote
rob_bb Posted April 25, 2013 Posted April 25, 2013 The location would still be valid wouldn't it? That is the x,y,z in the client will relate to the same x,y,z on the server? Quote
rob_bb Posted April 25, 2013 Posted April 25, 2013 The location would still be valid wouldn't it? That is the x,y,z in the client will relate to the same x,y,z on the server? Quote
NuclearFej Posted April 27, 2013 Author Posted April 27, 2013 Maybe submit a PullRequest to add another version of the method with a player parameter? (Shouldn't be that hard as there is a ContainerPlayer in SlotArmor). I edit the patches, correct? Quote
NuclearFej Posted April 28, 2013 Author Posted April 28, 2013 When I run update_patches.bat, only commands.patch is updated. I assume this is wrong because none of my code is in the file. This is wrong, right? Of course, I had to change update_patches.bat because the paths were incorrect. I have a feeling that this is what is causing the problem. Of course, the script runs, but it only changes commands.patch. update_patches.bat: @echo off ..\mcp\runtime\bin\python\python_mcp update_patches.py ..\mcp . Output: Creating patches Creating commands.py patch Thanks for the info! EDIT: My apologies. I was running the wrong one. Quote
Recommended Posts
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.