LEGOlord208 Posted July 15, 2014 Share Posted July 15, 2014 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. Quote And if I ever helped anyone with anything, let me know I am a noob in forge Link to comment Share on other sites More sharing options...
TheGreyGhost Posted July 15, 2014 Share Posted July 15, 2014 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 Quote Link to comment Share on other sites More sharing options...
delpi Posted July 15, 2014 Share Posted July 15, 2014 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. Quote Long time Bukkit & Forge Programmer Happy to try and help Link to comment Share on other sites More sharing options...
LEGOlord208 Posted July 15, 2014 Author Share Posted July 15, 2014 mouseOverObject I can't choose what players I would use it on? And these calculations, how would I do them? Quote And if I ever helped anyone with anything, let me know I am a noob in forge Link to comment Share on other sites More sharing options...
LEGOlord208 Posted July 15, 2014 Author Share Posted July 15, 2014 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...? Quote And if I ever helped anyone with anything, let me know I am a noob in forge Link to comment Share on other sites More sharing options...
LEGOlord208 Posted July 15, 2014 Author Share Posted July 15, 2014 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. Quote And if I ever helped anyone with anything, let me know I am a noob in forge Link to comment Share on other sites More sharing options...
MultiMote Posted July 15, 2014 Share Posted July 15, 2014 mouseOverObject is client-side only. You must to send packet with object coords/id. Quote Link to comment Share on other sites More sharing options...
LEGOlord208 Posted July 15, 2014 Author Share Posted July 15, 2014 mouseOverObject is client-side only. You must to send packet with object coords/id. But how would you tell mouseOverObject what player you are requesting for? Quote And if I ever helped anyone with anything, let me know I am a noob in forge Link to comment Share on other sites More sharing options...
MultiMote Posted July 15, 2014 Share Posted July 15, 2014 Player sends packet. Server gets packet sender. Quote Link to comment Share on other sites More sharing options...
LEGOlord208 Posted July 15, 2014 Author Share Posted July 15, 2014 Player sends packet. Server gets packet sender. And how do I send a packet to a server? MinecraftServer.sendPacket() or something like that? Quote And if I ever helped anyone with anything, let me know I am a noob in forge Link to comment Share on other sites More sharing options...
FLUFFY2 Posted July 15, 2014 Share Posted July 15, 2014 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. Quote Link to comment Share on other sites More sharing options...
MultiMote Posted July 15, 2014 Share Posted July 15, 2014 raytrace is clientside Quote Link to comment Share on other sites More sharing options...
LEGOlord208 Posted July 15, 2014 Author Share Posted July 15, 2014 raytrace is clientside Is it? I mean it is a Player. method... Quote And if I ever helped anyone with anything, let me know I am a noob in forge Link to comment Share on other sites More sharing options...
LEGOlord208 Posted July 15, 2014 Author Share Posted July 15, 2014 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 I think I will try it out Quote And if I ever helped anyone with anything, let me know I am a noob in forge Link to comment Share on other sites More sharing options...
MultiMote Posted July 15, 2014 Share Posted July 15, 2014 http://up42.ru/u/p/_________________2014-07-15_20_43_09.png[/img] u CAN'T use this at server Quote Link to comment Share on other sites More sharing options...
LEGOlord208 Posted July 15, 2014 Author Share Posted July 15, 2014 http://up42.ru/u/p/_________________2014-07-15_20_43_09.png[/img] Oh Quote And if I ever helped anyone with anything, let me know I am a noob in forge Link to comment Share on other sites More sharing options...
LEGOlord208 Posted July 15, 2014 Author Share Posted July 15, 2014 Guys, how did you get "Forge Modder" text by the way? Quote And if I ever helped anyone with anything, let me know I am a noob in forge Link to comment Share on other sites More sharing options...
MultiMote Posted July 15, 2014 Share Posted July 15, 2014 this way Quote Link to comment Share on other sites More sharing options...
FLUFFY2 Posted July 15, 2014 Share Posted July 15, 2014 raytrace is clientside Sure it is, but whats the problem with that? He can always send a packet when he looking at the right block. Quote Link to comment Share on other sites More sharing options...
LEGOlord208 Posted July 15, 2014 Author Share Posted July 15, 2014 this way Thanks so very much! Quote And if I ever helped anyone with anything, let me know I am a noob in forge Link to comment Share on other sites More sharing options...
LEGOlord208 Posted July 15, 2014 Author Share Posted July 15, 2014 raytrace is clientside Sure it is, but whats the problem with that? He can always send a packet when he looking at the right block. And how do I send a packet? Quote And if I ever helped anyone with anything, let me know I am a noob in forge Link to comment Share on other sites More sharing options...
MultiMote Posted July 15, 2014 Share Posted July 15, 2014 Sure it is, but whats the problem with that? He can always send a packet when he looking at the right block. But why he can't use ready-to-use objectMouseOver without problems with partialTicks? Quote Link to comment Share on other sites More sharing options...
FLUFFY2 Posted July 15, 2014 Share Posted July 15, 2014 http://www.minecraftforge.net/forum/index.php/topic,20135.msg101552.html#msg101552 Quote Link to comment Share on other sites More sharing options...
FLUFFY2 Posted July 15, 2014 Share Posted July 15, 2014 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 Quote Link to comment Share on other sites More sharing options...
LEGOlord208 Posted July 15, 2014 Author Share Posted July 15, 2014 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 Quote And if I ever helped anyone with anything, let me know I am a noob in forge Link to comment Share on other sites More sharing options...
Recommended Posts
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.