Jump to content

Is this a good idea?


NuclearFej

Recommended Posts

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!

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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?

 

 

Link to comment
Share on other sites

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?

 

 

Link to comment
Share on other sites

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. xD

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.