Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

NoClipMonster

Members
  • Posts

    9
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

NoClipMonster's Achievements

Tree Puncher

Tree Puncher (2/8)

2

Reputation

  1. New version: public void LookingAt(PlayerEntity player, boolean isFluid){ ArrayList<String> list = new ArrayList<String>(); RayTraceResult block = player.pick(20.0D, 0.0F, isFluid); if(block.getType() == RayTraceResult.Type.BLOCK) { BlockPos blockpos = ((BlockRayTraceResult)block).getBlockPos(); BlockState blockstate = player.level.getBlockState(blockpos); LOGGER.info("Looking at: "+blockstate.getBlock()+"\nIs Fluid: "+isFluid+"\nPosition= "+ blockpos.getX() + ", " + blockpos.getY() + ", " + blockpos.getZ()); } }
  2. Yes, I guessed it when I went to bed ๐Ÿ˜…๐Ÿ˜… Thank you๐Ÿ™‚
  3. Found a better solution ArrayList<String> list = new ArrayList<String>(); Minecraft minecraft = Minecraft.getInstance(); ClientPlayerEntity player= minecraft.player; ClientWorld level = minecraft.level; RayTraceResult block = player.pick(20.0D, 0.0F, false); RayTraceResult fluid = player.pick(20.0D, 0.0F, true); \\BLOCK if(block.getType() == RayTraceResult.Type.BLOCK) { BlockPos blockpos = ((BlockRayTraceResult)block).getBlockPos(); BlockState blockstate = level.getBlockState(blockpos); LOGGER.info("Looking at: "+blockstate.getBlock()+"\nPosition= "+ blockpos.getX() + ", " + blockpos.getY() + ", " + blockpos.getZ()); } \\FLUID if(fluid.getType() == RayTraceResult.Type.BLOCK) { BlockPos blockpos = ((BlockRayTraceResult)fluid).getBlockPos(); BlockState blockstate = level.getBlockState(blockpos); LOGGER.info("Looking at: "+blockstate.getBlock()+"\nPosition= "+ blockpos.getX() + ", " + blockpos.getY() + ", " + blockpos.getZ()); } What do the first two variables do? player.pick(20.0D, 0.0F, false);
  4. This will be useful for me, thank you, but I managed to do it using RayTraceResult. Thank you so much for your help. I'll leave the code for people like me) public Block LookingAt(){ RayTraceResult rt = Minecraft.getInstance().hitResult; double x = (rt.getLocation().x); double y = (rt.getLocation().y); double z = (rt.getLocation().z); double xla = Minecraft.getInstance().player.getLookAngle().x; double yla = Minecraft.getInstance().player.getLookAngle().y; double zla = Minecraft.getInstance().player.getLookAngle().z; if ((x%1==0)&&(xla<0))x-=0.01; if ((y%1==0)&&(yla<0))y-=0.01; if ((z%1==0)&&(zla<0))z-=0.01; BlockPos ps = new BlockPos(x,y,z); BlockState bl = Minecraft.getInstance().level.getBlockState(ps); return bl.getBlock(); } If you have any ideas for improving the code, please write.
  5. OK, due to my lack of experience, I didn't find any information that could even push me in the right direction.
  6. I didn't find any ready-made examples for 1.16 And the examples for older versions don't work in 1.16 . Maybe I'm looking wrong, which is why I wrote here.
  7. Hello, I am a moder novice and I can't figure out how to get the name and position of the block that the player is looking at. I want to make a bot that will dig for resources itself. I tried to do this with the help of Ray Trace Result, but nothing happened, I can't find the normal documentation for 1.16.5. Please help me solve it.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.