Posted July 4, 20223 yr good nights in this specific moment i need to know the exact face of the block the player is looking at when right clock on the costume block its for for something im doing whit a custom block right inside this specific method // ########## ########## ########## ########## // Onright click @Override public ActionResultType use(BlockState blockstate, World warudo, BlockPos blockpos, PlayerEntity pe, Hand mano, BlockRayTraceResult blkrtraceresult) { System.out.println("the player has righ click the block"); int level = blockstate.getValue(LEVEL); int deep = blockstate.getValue(DEEP); if(!warudo.isClientSide) { if(pe.isDiscrete()) { } if(pe.isCrouching()) { } level ++; level = ( level > 15 )? 0 : level; deep --; deep = ( deep < 0 )? 15 : deep; blockstate = blockstate.setValue(LEVEL, Integer.valueOf(level)); blockstate = blockstate.setValue(DEEP, Integer.valueOf(deep)); warudo.setBlock(blockpos, blockstate, 3); //2? String mensaje = String.format( "Level = %1$s, Deep = %2$s" , level , deep ); Vector3d target = blkrtraceresult.getLocation(); //how do i now the side of the block the player has clinked float factor = ( 1.0F / 3.0F ); int hx = (int)(((target.x) %1) / factor); int hy = (int)(((target.y) %1) / factor); int hz = (int)(((target.z) %1) / factor); mensaje += " => " + hx + ", " + hy + ", " + hz; System.out.println( mensaje ); showthis(mensaje, pe); } return ActionResultType.sidedSuccess(warudo.isClientSide); } thank for your attention
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.