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

Hello,

I wanna make an enchantment, that allows player to break bocks in 3x3 area. However, I need to know, on which side of block is the player looking, when he breaks it. The problem is, that I'm using  BreakEvent and it seems to trigger when the block is already broken, so I can't get the side by Minecraft.getMinecraft().objectMouseOver.sideHit. Does anyone have an idea, how to solve this problem?

Hello,

I wanna make an enchantment, that allows player to break bocks in 3x3 radium. However, I need to know, on which side of block is the player looking, when he breaks it. The problem is, that I'm using  BreakEvent and it seems to trigger when the block is already broken, so I can't get the side by Minecraft.getMinecraft().objectMouseOver.sideHit. Does anyone have an idea, how to solve this problem?

The event gives you a player you shouldn't be using Minecraft.getMinecraft()... in most events anyways. Just use.

event.getPlayer().getHorizontalFacing().opposite(); // Gives you the face of the block. 

 

Edit: Side note "radium" is not a word, but I think you meant radius, which is not the proper word; what you meant is area.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author

This didn't solve my problem. This only works horizontaly (west, east, south, north), but not verticaly (up, down). It also returns the direction the player is looking at, but not the side of the block he is looking at.

This didn't solve my problem. This only works horizontaly (west, east, south, north), but not verticaly (up, down). It also returns the direction the player is looking at, but not the side of the block he is looking at.

Idk if it is a clean way to do this, but I just used in Block#onBlockStartBreak:

if(world.isRemote) 
{
this.side = Minecraft.getMinecraft().objectMouseOver.sideHit;
}

This didn't solve my problem. This only works horizontaly (west, east, south, north), but not verticaly (up, down). It also returns the direction the player is looking at, but not the side of the block he is looking at.

Then you did not think hard enough about what I gave you. If it is North or South you will break the same blocks regardless, same with East and West. Then if it is neither of those it can only be up and down, which guess what will break the same blocks regardless.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author

Even if you're looking up or down it's one of that four directions. It' s basicly the direction the player is facing. And it' s not completely accurate. The side of block palyer is looking at may not be the same af the side player is facing.

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.