Jump to content

Recommended Posts

Posted

You don't necessarily need to do it yourself though. It depends on the context.

 

onItemRichgtclick

Creator of Extra Shoes

 

Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then

Posted

I got some code nearly working, but it does strangely only work in x and y positive direction, and also upwards sight, I cant figure outr why, but I think its a problem with the world.getBlockState

 

if((player.rayTrace(200, 1.0F) != null)){
		int blockHitX = (int) player.rayTrace(200, 1.0F).hitVec.xCoord;
		int blockHitY = (int) player.rayTrace(200, 1.0F).hitVec.yCoord;
		int blockHitZ = (int) player.rayTrace(200, 1.0F).hitVec.zCoord;
		System.out.println(blockHitX + "	" + blockHitY + "\t"+ blockHitZ);
		BlockPos pos = new BlockPos(player.rayTrace(10, 1).hitVec);

		System.out.println(world.getBlockState(new BlockPos(player.posX, player.posY, player.posZ)));
		System.out.println(world.getBlockState(pos));

	}

Creator of Extra Shoes

 

Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then

Posted

dont know about that error, but why are u taytracing three times O.o thats waste of processing time. raytrace once, save the result, read x/y/z from it

Three times? He's doing it five times! @OP, as Failender said, raytrace once, save the result, then do stuff with that result instead of raytracin 5 times...

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

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



×
×
  • Create New...

Important Information

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