Jump to content

Recommended Posts

Posted

Hi all,

I need to make a tool that breaks a 3x3 area around the block you break.

For that I need to know which side of the block the player is pointing at, but I haven't found a way to do it.

 

I know that onItemUse has a way to do it, but I want to make the tool be used with the left mouse button, not with the right one.

 

Is there any way to do that ?

 

Thanks,

Max

Posted

There is a way to know if player look at +X -X +Z -Z

 

I do this:

int var6 = MathHelper.floor_double((double)(EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

The variable can take 4 values, from 0 to 3, each case is a direction that the player is looking at (can't remember which is everyone, just try them).

 

Hope this help :)

If yo want to say thanks, push the button!

  • 2 weeks later...
  • 3 months later...
Posted
  On 1/24/2013 at 11:57 AM, VictorZombie said:

There is a way to know if player look at +X -X +Z -Z

 

I do this:

int var6 = MathHelper.floor_double((double)(EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

The variable can take 4 values, from 0 to 3, each case is a direction that the player is looking at (can't remember which is everyone, just try them).

 

Hope this help :)

Sorry for my noob question, how do i get the blocks in a 3x3 in a wall? , i mean, i know how to do it on the floor but i had the same problem as Maexx

 

  • 6 years later...
Posted
  On 1/25/2013 at 1:09 PM, Maexx said:

I used VictorZombies method, and it works great :D

I added the check for up and down and packed it into a playerUtil, so I can refer to it from everywhere ;)

 

Thanks a lot,

Max

Expand  

What did you do do make it work up and down?

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hi! I've been running a server on Minecraft using the Prodigium Reforged pack on curse forge using the site exaroton. It was working fine until randomly encountering this error every time anyone tries to connect to the server, I've already reloaded backups and deleted json files  Here is the crash report https://mclo.gs/EwKw51q. Thanks for the help in advance
    • nevermind i figured out the issue  
    • I was trying to host a server with the 1.21.1 cobbleverse forge mod, but when I tried starting it, it kept giving me this error. Crash report here: https://pastebin.com/AsE1X5QY   Thanks
    • This mod lets you choose an element power, Earth, Wind, Fire, or Water. Also two secret element powers Light and Darkness. Each power gives good a bad things, Earth lets you dig through anything but ores and bedrock, Wind lets you jump high in the air every three seconds, Fir lets you throw fire balls and you are immune to any flame/lava but you can't go into water or else you take damage, Water you swim and break blocks under water quicker and you can get rid of water like a sponge but you take more damage when in fire/lava, Light makes you faster at day but slower at night you are able to throw light spears that do four hearts and can go through any armor, Darkness let's you be faster at night but slower at day mobs don't harm you but peaceful mobs run away from you you are able to spawn ink creatures around you that are like dogs but are stronger. another thing in the mod is that there are other dimensions that can get you ores to make better armor and weapons, each dimensions are are good for a certain element though each dimension has a boss depending on which dimension one dimension has more than one boss, each elements are required to defeat the bosses with each others help.
    • Read the posts above yours, it tells you exactly how to do it, instructions are the same if it's making a forge installation or a vanilla one, just make a new folder for the game directory.
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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