Jump to content

[1.7.10][Sloved] Help - How do I get a player's target block?


LEGOlord208

Recommended Posts

Hi! I am working on a mod, and I am creating something (I would like to be secret about the mod). I need to know the player's target block for this. Currently I am using

Minecraft.getMinecraft().objectMouseOver

.

Are there a way to do it so it works with mutiplayer? And what would that answer be? I have been looking around for ages after the answer to this.

 

And if I ever helped anyone with anything, let me know

I am a noob in forge

Link to comment
Share on other sites

Hi

 

There is a way, but it's secret.

 

:-)

 

Only kidding.

 

I assume that you want something to happen to the block you're looking at, without clicking on it.

objectMouseOver will work fine with multiplayer, so long as you only use it to do things on the client side.  If you want to do something with it that needs to happen on the client side (for example, make the block change or do something that other players will see), then you need to either reproduce the objectMouseOver calculations on the server, or send a packet from the client telling the server which block the player is looking at.

 

-TGG

 

 

Link to comment
Share on other sites

That would be your task to figure that out.  First person there causes the action.  All cause the action.  The one with the coolest name causes the action.  Whether you do that on client side and send packets or do it all on the server, you will still have to decide who wins.

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

Hi

 

There is a way, but it's secret.

 

:-)

 

Only kidding.

 

I assume that you want something to happen to the block you're looking at, without clicking on it.

objectMouseOver will work fine with multiplayer, so long as you only use it to do things on the client side.  If you want to do something with it that needs to happen on the client side (for example, make the block change or do something that other players will see), then you need to either reproduce the objectMouseOver calculations on the server, or send a packet from the client telling the server which block the player is looking at.

 

-TGG

 

But Minecraft.getMinecraft().mouseOverObject I cant choose the player...?

And if I ever helped anyone with anything, let me know

I am a noob in forge

Link to comment
Share on other sites

That would be your task to figure that out.  First person there causes the action.  All cause the action.  The one with the coolest name causes the action.  Whether you do that on client side and send packets or do it all on the server, you will still have to decide who wins.

 

"Who wins"?!? I don't understand anything with this post.

And if I ever helped anyone with anything, let me know

I am a noob in forge

Link to comment
Share on other sites

Guys, guys....

What about that poor rayTracing?

 

int var9 = Minecraft.getMinecraft().thePlayer.rayTrace(100.0D, 1.0F).blockX;
int var10 = Minecraft.getMinecraft().thePlayer.rayTrace(100.0D, 1.0F).blockY;
int var11 = Minecraft.getMinecraft().thePlayer.rayTrace(100.0D, 1.0F).blockZ;

if(world.getBlock(var9, var10, var11) == Your.block){}

 

And you can use PlayerTickEvent to get the player without pakets.

Link to comment
Share on other sites

Guys, guys....

What about that poor rayTracing?

 

int var9 = Minecraft.getMinecraft().thePlayer.rayTrace(100.0D, 1.0F).blockX;
int var10 = Minecraft.getMinecraft().thePlayer.rayTrace(100.0D, 1.0F).blockY;
int var11 = Minecraft.getMinecraft().thePlayer.rayTrace(100.0D, 1.0F).blockZ;

if(world.getBlock(var9, var10, var11) == Your.block){}

Looks nice :D I think I will try it out :D

And if I ever helped anyone with anything, let me know

I am a noob in forge

Link to comment
Share on other sites

But why he can't use ready-to-use objectMouseOver without problems with partialTicks?

 

I don't know. Mayebe rayTrace is easier to understand.

But it LEGOlords's choise :)

 

I think I would like to use mouseOverObject right now.

Maybe rayTrace will help me another day :D

And if I ever helped anyone with anything, let me know

I am a noob in forge

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • It all began with a chance encounter with a testimonial shared by Olivia, a fellow traveler on the winding road of cryptocurrency. Her words spoke of a miraculous recovery orchestrated by Wizard Web Recovery, a beacon of hope in the murky waters of online fraud. Intrigued by her story, I reached out to Wizard Web Recovery, hoping they could work their magic on my blocked crypto recovery. With bated breath, I shared my plight, providing evidence of my dilemma and praying for a solution. To my astonishment, a prompt response came, swift and reassuring. Wizard Web Recovery wasted no time in assessing my situation, guiding me through the process with patience and expertise. and then like a ray of sunshine breaking through the clouds, came the news I had longed for – a new private key had been generated, restoring my precious bitcoins. It was a moment of jubilation, a triumph over adversity that filled me with newfound hope. At that moment, I realized the true power of Wizard Web Recovery, not just as skilled technicians, but as guardians of trust in the digital realm. With their assistance, I reclaimed what was rightfully mine, turning despair into determination and paving the way for a brighter future. But their capabilities did not end there. Delving deeper into their expertise, I discovered that Wizard Web Recovery possessed a wealth of knowledge in reclaiming lost stolen cryptocurrency, and even exposing fraudulent investment schemes. So to all those who find themselves entangled in the web of online fraud, take heart. With the guidance of Wizard Web Recovery, there is a path to redemption.     Write Mail; ( Wizard webrecovery AT  vprogrammer. net ) 
    • It all began with a chance encounter with a testimonial shared by Olivia, a fellow traveler on the winding road of cryptocurrency. Her words spoke of a miraculous recovery orchestrated by Wizard Web Recovery, a beacon of hope in the murky waters of online fraud. Intrigued by her story, I reached out to Wizard Web Recovery, hoping they could work their magic on my blocked crypto recovery. With bated breath, I shared my plight, providing evidence of my dilemma and praying for a solution. To my astonishment, a prompt response came, swift and reassuring. Wizard Web Recovery wasted no time in assessing my situation, guiding me through the process with patience and expertise. and then like a ray of sunshine breaking through the clouds, came the news I had longed for – a new private key had been generated, restoring my precious bitcoins. It was a moment of jubilation, a triumph over adversity that filled me with newfound hope. At that moment, I realized the true power of Wizard Web Recovery, not just as skilled technicians, but as guardians of trust in the digital realm. With their assistance, I reclaimed what was rightfully mine, turning despair into determination and paving the way for a brighter future. But their capabilities did not end there. Delving deeper into their expertise, I discovered that Wizard Web Recovery possessed a wealth of knowledge in reclaiming lost stolen cryptocurrency, and even exposing fraudulent investment schemes. So to all those who find themselves entangled in the web of online fraud, take heart. With the guidance of Wizard Web Recovery, there is a path to redemption.    
    • How can I add drops when killing an entity? Now there are no drops. How can I add an @override to change the attack speed to 1.6 and show "when in main hand...attack damage,...attack speed"? also, how can I make the item enchantable? 
    • Ok. Thanks. by the way, will this crash in any circumstances? public boolean onLeftClickEntity(ItemStack stack, Player player, Entity entity) { if (entity instanceof LivingEntity){ LivingEntity victim = (LivingEntity) entity; if(!victim.isDeadOrDying() && victim.getHealth()>0){ victim.setHealth(0); return true; } } return false; }  
    • You shouldn't be extracting the mod .jar, just place it in your mods folder.
  • Topics

×
×
  • Create New...

Important Information

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