Posted December 17, 20168 yr 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?
December 17, 20168 yr 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.
December 17, 20168 yr 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.
December 17, 20168 yr 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; }
December 17, 20168 yr 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.
December 17, 20168 yr 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.