Posted April 2, 20214 yr I created my own goal, similar to the eat gras goal of the sheep. But my entity is a bit larger, so I used the entity.getLookVec(); to get the direction it is looking and multiplied by half of the width. But the entity always only picked one block, so I tracked everything and it seem that the look random goal only changes the looking of the Entity client side, but not server side. Am I right or am I doing something wrong. And is there a way to get it serverside? I tried the entity.getLookController(), but this also didn't work. Anyone an Idea?
April 2, 20214 yr Author I am not sure, but the entity model changed direction of look but the look vector didnt change... die he could only eat at one pos
April 2, 20214 yr Author public boolean shouldExecute() { if (eatTimer == 0 && entity.getIdleTime() > 100) { BlockPos pos = this.entity.getPosition(); float width = this.entity.getWidth()/2; Vec3d look = this.entity.getLookVec(); look = look.add(0, -look.y, 0); look = look.scale(width); pos = pos.add(round(look.x), 0, round(look.z)); if (entity.world instanceof ServerWorld) { ServerWorld world = (ServerWorld) entity.world; for (int i = -1; i <= 1; i++) { if (blocks.contains(world.getBlockState(pos.add(0, i, 0)).getBlock())) { eatPos = pos.add(0, i, 0); eatWorld = world; entityPos = entity.getPosition(); eatTimer = entityEatTime; entity.setIdleTime(0); return true; } } } } return false; } This is the should executemethode of the goal. The look-vector always stays the same, so the entity couldn't find the block to eat.
April 2, 20214 yr Author Maybe it was the hat and not the body or look vector from the LookRandomGoal. Now I used: Vec3d look =Vec3d.fromPitchYaw((float) Math.PI/2, this.entity.getRotationYawHead()); and it worked. Thanks for help
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.