Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (โ‹ฎ) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

NoClipMonster

Members
  • Joined

  • Last visited

  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. NoClipMonster changed their profile photo
  5. 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.
  6. OK, due to my lack of experience, I didn't find any information that could even push me in the right direction.
  7. 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.
  8. 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.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions โ†’ Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.