ElTotisPro50 Posted January 22, 2022 Share Posted January 22, 2022 i tried something with axisAlignedBB but is not working BlockPos playerPos = player.getPosition(); BlockPos pos1 = playerPos.add(new Vector3i(player.getPosX() + 10,player.getPosY() + 10,player.getPosZ() + 10)); BlockPos pos2 = playerPos.add(new Vector3i(player.getPosX() + 10,player.getPosY() + 10,player.getPosZ() + 10)); List<CowEntity> targets = world.getEntitiesWithinAABB(CowEntity.class,new AxisAlignedBB(pos1,pos2)); if(!targets.isEmpty()) { player.sendStatusMessage(new StringTextComponent("there is a cow around you")) } AND (for example there are 3 cows in the range) if(!targets.isEmpty()) { player.sendStatusMessage(new StringTextComponent(targets)) } Quote Link to comment Share on other sites More sharing options...
ElTotisPro50 Posted January 22, 2022 Author Share Posted January 22, 2022 (edited) 7 hours ago, diesieben07 said: pos1 and pos2 are the same position. As such your AABB is completely empty. then, i have to subtract the 10 in pos1 or pos2? (i want to make the area a cube of 10x10 and the center of the area has to be the player) BlockPos pos1 = playerPos.add(new Vector3i(player.getPosX() + 10,player.getPosY() + 10,player.getPosZ() + 10)); BlockPos pos2 = playerPos.add(new Vector3i(player.getPosX() - 10,player.getPosY() - 10,player.getPosZ() - 10)); Edited January 22, 2022 by ElTotisPro50 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.