Minecraft: How do I place a block (function)?

an
- in Mods
5

I want to write a mod planting a field. (And without the client changing his line of sight).

I have already figured out how to mine a field. But how do you plant it? I can't get the block placed. (With packets because I want to use it on servers.)

Minecraft.getMinecraft (). ThePlayer.sendQueue.addToSendQueue (new C08PacketPlayerBlockPlacement (target_pos, EnumFacing.UP.getIndex (), mc.thePlayer.getHeldItem (), facingX, facingY, facingZ));

Is this the right package for this? Did I use everything correctly?

What do I have to use with facingX, facingY and facingZ? Where do I get it from?

And do I need anything else?

Es

Facing x y z are the blocks you are looking at, you can find this data at f3 looking at xx yx zx or something like that

Vi

The facing command with the X, Y and Z behind it represents the coordinates in which direction you are looking, the

X coordinate increases when you walk east,

the Z coordinate increases when you run south and

Y stands for height.

As far as mod programming is concerned, I have no idea.

There's a key combination under F3 with which you can copy to the clipboard, in which direction you are looking, with the respective coordinates. Hmm

an

No.

target_pos (= the BlockPos where I want to place the block) already indicates that.

an

What "Facing Command"? These are the parameters. Bruh.

It also indicates where my pointer is on the block. Only I have no idea how to calculate that.

Vi

Yes you are right. It is not a command, but a parameter. I got it mixed up.

The one with the coordinates should only be an example, even if it wasn't related to looking at the moment.

Sorry, I can't tell you how to calculate that.