Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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!

  • Author

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!

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?

 

 

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?

 

 

 

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?

 

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?

  • Author
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?

  • Author

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

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.