I hope someone can help me. I am stuck with this problem for days. I want to find the coordinates of a block that the player looks at, or that the mouse is over. And also I would like to generate many copies of the same block, because everyone of those should be in a position in a way that all the blocks would plot the Sinus function.
Therefore now my biggest problem is how to get the coordinates of a block and change them? I want to do something like y-coordinate=Sin(x-coordinate)
Thank you in advance
Please If anyone can help.. I would really appreaciate it.
I used the following code to make the "mop" move in a "y=20x +c" motion. Here is attached the code I wrote, Is there something wrong with it? How can I now set the new x and y coordinates of the "mop" ?
No, it will work only client side (it will crash server side)
You have to obtain the player and the world from command sender (after that execute the code linked above):
if (!(sender instanceof EntityPlayer)){
return; //block the command execution because not executed by a player (for example command blocks or console)
}
EntityPlayer player = (EntityPlayer) sender;
World world = sender.getEntityWorld();
Oh I understand now. Sorry I didn't notice your previous comment, that's why i was still confused.. So I should create a new instance of mop. I will write some code and i will post it as soon as I can
Hello everybody,
I hope someone can help me. I am stuck with this problem for days. I want to find the coordinates of a block that the player looks at, or that the mouse is over. And also I would like to generate many copies of the same block, because everyone of those should be in a position in a way that all the blocks would plot the Sinus function.
Therefore now my biggest problem is how to get the coordinates of a block and change them? I want to do something like y-coordinate=Sin(x-coordinate)
Thank you in advance
Please If anyone can help.. I would really appreaciate it.
If you want this for client-side (but I don't think) you can use Minecraft.objectMouseOver like this: https://bitbucket.org/ProfMobius/waila/src/72aa774fa0acacf4b4328559c9b5a1b5d25e958c/src/main/java/mcp/mobius/waila/overlay/RayTracing.java?fileviewer=file-view-default#RayTracing.java-48,44
If you want to do this server-side you can use this:
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2132650-solved-1-7-2-forge-block-player-is-looking-at?comment=4
BUT remember to replace the first line (because it changed in 1.7.10) to this:
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2132650-solved-1-7-2-forge-block-player-is-looking-at?comment=22
remember to check if they are not null in both sides
sorry for my bad english I'm Italian
I used the following code to make the "mop" move in a "y=20x +c" motion. Here is attached the code I wrote, Is there something wrong with it? How can I now set the new x and y coordinates of the "mop" ?
Thank you so much for your answer by the way.
Is this for a server?
No, it will work only client side (it will crash server side)
You have to obtain the player and the world from command sender (after that execute the code linked above):
sorry for my bad english I'm Italian
You cannot change BlockPos of MovingObjectPosition, it is immutable.
You need to create a new instance of MovingObjectPosition.
Or just do whatever you need to do at those coordinates.
You mean like this, right?
Is this enough to set the object's coordinates to the new ones, or should I use a function to set them?
I am not sure if it is for a server, but nomally I should make it for both client and server? I am new to Forge, so I am a bit lost..
As i said, this is not setting anything. You are fetching the values, they are not going to change this way.
Whether you work for server or client depends on the result you expect.
If it is visual, client is required.
If you want to change the game world (like blocks or player), server is required.
Oh I understand now. Sorry I didn't notice your previous comment, that's why i was still confused.. So I should create a new instance of mop. I will write some code and i will post it as soon as I can