Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.server.v1_12_R1;
- import javax.annotation.Nullable;
- public class PathfinderGoalPanic extends PathfinderGoal
- {
- protected final EntityCreature a;
- protected double b;
- protected double c;
- protected double d;
- protected double e;
- public PathfinderGoalPanic(EntityCreature entitycreature, double d0) {
- a = entitycreature;
- b = d0;
- a(1);
- }
- public boolean a() {
- if ((a.getLastDamager() == null) && (!a.isBurning())) {
- return false;
- }
- if (a.isBurning()) {
- BlockPosition blockposition = a(a.world, a, 5, 4);
- if (blockposition != null) {
- c = blockposition.getX();
- d = blockposition.getY();
- e = blockposition.getZ();
- return true;
- }
- }
- return f();
- }
- protected boolean f()
- {
- Vec3D vec3d = RandomPositionGenerator.a(a, 5, 4);
- if (vec3d == null) {
- return false;
- }
- c = x;
- d = y;
- e = z;
- return true;
- }
- public void c()
- {
- a.getNavigation().a(c, d, e, b);
- }
- public boolean b()
- {
- if (a.ticksLived - a.hurtTimestamp > 100) {
- a.b(null);
- return false;
- }
- return !a.getNavigation().o();
- }
- @Nullable
- private BlockPosition a(World world, Entity entity, int i, int j) {
- BlockPosition blockposition = new BlockPosition(entity);
- int k = blockposition.getX();
- int l = blockposition.getY();
- int i1 = blockposition.getZ();
- float f = i * i * j * 2;
- BlockPosition blockposition1 = null;
- BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
- for (int j1 = k - i; j1 <= k + i; j1++) {
- for (int k1 = l - j; k1 <= l + j; k1++) {
- for (int l1 = i1 - i; l1 <= i1 + i; l1++) {
- blockposition_mutableblockposition.c(j1, k1, l1);
- IBlockData iblockdata = world.getType(blockposition_mutableblockposition);
- if (iblockdata.getMaterial() == Material.WATER) {
- float f1 = (j1 - k) * (j1 - k) + (k1 - l) * (k1 - l) + (l1 - i1) * (l1 - i1);
- if (f1 < f) {
- f = f1;
- blockposition1 = new BlockPosition(blockposition_mutableblockposition);
- }
- }
- }
- }
- }
- return blockposition1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment