Search in sources :

Example 1 with ChunkCache

use of net.minecraft.server.v1_15_R1.ChunkCache in project Citizens2 by CitizensDev.

the class PlayerNavigation method supera.

public PathEntity supera(BlockPosition paramBlockPosition) {
    if (!b()) {
        return null;
    }
    if ((this.c != null) && (!this.c.b()) && (paramBlockPosition.equals(this.r))) {
        return this.c;
    }
    this.r = paramBlockPosition;
    float f1 = h();
    BlockPosition localBlockPosition = new BlockPosition(this.a);
    int i1 = (int) (f1 + 8.0F);
    ChunkCache localChunkCache = new ChunkCache(this.b, localBlockPosition.a(-i1, -i1, -i1), localBlockPosition.a(i1, i1, i1), 0);
    PathEntity localPathEntity = this.s.a(localChunkCache, this.a, this.r, f1);
    return localPathEntity;
}
Also used : ChunkCache(net.minecraft.server.v1_10_R1.ChunkCache) BlockPosition(net.minecraft.server.v1_10_R1.BlockPosition) PathEntity(net.minecraft.server.v1_10_R1.PathEntity) PathPoint(net.minecraft.server.v1_10_R1.PathPoint)

Example 2 with ChunkCache

use of net.minecraft.server.v1_15_R1.ChunkCache in project Citizens2 by CitizensDev.

the class PlayerNavigation method b2.

private PathEntity b2(BlockPosition paramBlockPosition) {
    if (!b()) {
        return null;
    }
    if ((this.c != null) && (!this.c.b()) && (paramBlockPosition.equals(this.q))) {
        return this.c;
    }
    this.q = paramBlockPosition;
    float f1 = i();
    this.b.methodProfiler.a("pathfind");
    BlockPosition localBlockPosition = new BlockPosition(this.a);
    int i1 = (int) (f1 + 8.0F);
    ChunkCache localChunkCache = new ChunkCache(this.b, localBlockPosition.a(-i1, -i1, -i1), localBlockPosition.a(i1, i1, i1), 0);
    PathEntity localPathEntity = this.r.a(localChunkCache, this.a, this.q, f1);
    this.b.methodProfiler.b();
    return localPathEntity;
}
Also used : ChunkCache(net.minecraft.server.v1_12_R1.ChunkCache) BlockPosition(net.minecraft.server.v1_12_R1.BlockPosition) PathEntity(net.minecraft.server.v1_12_R1.PathEntity) PathPoint(net.minecraft.server.v1_12_R1.PathPoint)

Example 3 with ChunkCache

use of net.minecraft.server.v1_15_R1.ChunkCache in project Citizens2 by CitizensDev.

the class PlayerNavigation method a.

@Override
protected PathEntity a(Set<BlockPosition> var0, int var1, boolean var2, int var3) {
    if (var0.isEmpty())
        return null;
    if (this.a.locY() < 0.0D)
        return null;
    if (!a())
        return null;
    if (this.c != null && !this.c.c() && var0.contains(this.p))
        return this.c;
    this.b.getMethodProfiler().enter("pathfind");
    float var4 = (float) this.a.b(GenericAttributes.FOLLOW_RANGE);
    BlockPosition var5 = var2 ? this.a.getChunkCoordinates().up() : this.a.getChunkCoordinates();
    int var6 = (int) (var4 + var1);
    ChunkCache var7 = new ChunkCache(this.b, var5.b(-var6, -var6, -var6), var5.b(var6, var6, var6));
    PathEntity var8 = this.s.a(var7, this.a, var0, var4, var3, this.r);
    this.b.getMethodProfiler().exit();
    if (var8 != null && var8.m() != null) {
        this.p = var8.m();
        this.q = var3;
        e();
    }
    return var8;
}
Also used : ChunkCache(net.minecraft.server.v1_16_R3.ChunkCache) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) BaseBlockPosition(net.minecraft.server.v1_16_R3.BaseBlockPosition) PathEntity(net.minecraft.server.v1_16_R3.PathEntity) PathPoint(net.minecraft.server.v1_16_R3.PathPoint)

Example 4 with ChunkCache

use of net.minecraft.server.v1_15_R1.ChunkCache in project Citizens2 by CitizensDev.

the class PlayerPathfinder method a.

public PathEntity a(ChunkCache var0, EntityHumanNPC var1, Set<BlockPosition> var2, float var3, int var4, float var5) {
    this.a.a();
    this.e.a(var0, var1);
    PathPoint var6 = this.e.b();
    Map<PathDestination, BlockPosition> var7 = var2.stream().collect(Collectors.toMap((var0x) -> {
        return this.e.a((double) var0x.getX(), (double) var0x.getY(), (double) var0x.getZ());
    }, Function.identity()));
    PathEntity var8 = this.a(var6, var7, var3, var4, var5);
    this.e.a();
    return var8;
}
Also used : Pathfinder(net.minecraft.server.v1_15_R1.Pathfinder) EntityHumanNPC(net.citizensnpcs.nms.v1_15_R1.entity.EntityHumanNPC) Iterator(java.util.Iterator) PathEntity(net.minecraft.server.v1_15_R1.PathEntity) Set(java.util.Set) Setting(net.citizensnpcs.Settings.Setting) ChunkCache(net.minecraft.server.v1_15_R1.ChunkCache) Function(java.util.function.Function) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) Path(net.minecraft.server.v1_15_R1.Path) List(java.util.List) Stream(java.util.stream.Stream) Lists(com.google.common.collect.Lists) EntityInsentient(net.minecraft.server.v1_15_R1.EntityInsentient) PathDestination(net.minecraft.server.v1_15_R1.PathDestination) Map(java.util.Map) Optional(java.util.Optional) BlockPosition(net.minecraft.server.v1_15_R1.BlockPosition) Comparator(java.util.Comparator) PathPoint(net.minecraft.server.v1_15_R1.PathPoint) PathPoint(net.minecraft.server.v1_15_R1.PathPoint) BlockPosition(net.minecraft.server.v1_15_R1.BlockPosition) PathEntity(net.minecraft.server.v1_15_R1.PathEntity) PathDestination(net.minecraft.server.v1_15_R1.PathDestination)

Example 5 with ChunkCache

use of net.minecraft.server.v1_15_R1.ChunkCache in project Citizens2 by CitizensDev.

the class PlayerPathfinder method a.

@Override
public PathEntity a(ChunkCache var0, EntityInsentient var1, Set<BlockPosition> var2, float var3, int var4, float var5) {
    this.a.a();
    this.e.a(var0, var1);
    PathPoint var6 = this.e.b();
    Map<PathDestination, BlockPosition> var7 = var2.stream().collect(Collectors.toMap((var0x) -> {
        return this.e.a((double) var0x.getX(), (double) var0x.getY(), (double) var0x.getZ());
    }, Function.identity()));
    PathEntity var8 = this.a(var6, var7, var3, var4, var5);
    this.e.a();
    return var8;
}
Also used : Pathfinder(net.minecraft.server.v1_15_R1.Pathfinder) EntityHumanNPC(net.citizensnpcs.nms.v1_15_R1.entity.EntityHumanNPC) Iterator(java.util.Iterator) PathEntity(net.minecraft.server.v1_15_R1.PathEntity) Set(java.util.Set) Setting(net.citizensnpcs.Settings.Setting) ChunkCache(net.minecraft.server.v1_15_R1.ChunkCache) Function(java.util.function.Function) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) Path(net.minecraft.server.v1_15_R1.Path) List(java.util.List) Stream(java.util.stream.Stream) Lists(com.google.common.collect.Lists) EntityInsentient(net.minecraft.server.v1_15_R1.EntityInsentient) PathDestination(net.minecraft.server.v1_15_R1.PathDestination) Map(java.util.Map) Optional(java.util.Optional) BlockPosition(net.minecraft.server.v1_15_R1.BlockPosition) Comparator(java.util.Comparator) PathPoint(net.minecraft.server.v1_15_R1.PathPoint) PathPoint(net.minecraft.server.v1_15_R1.PathPoint) BlockPosition(net.minecraft.server.v1_15_R1.BlockPosition) PathEntity(net.minecraft.server.v1_15_R1.PathEntity) PathDestination(net.minecraft.server.v1_15_R1.PathDestination)

Aggregations

Lists (com.google.common.collect.Lists)4 Sets (com.google.common.collect.Sets)4 Comparator (java.util.Comparator)4 List (java.util.List)4 Map (java.util.Map)4 Optional (java.util.Optional)4 Set (java.util.Set)4 Function (java.util.function.Function)4 Collectors (java.util.stream.Collectors)4 Stream (java.util.stream.Stream)4 Setting (net.citizensnpcs.Settings.Setting)4 BlockPosition (net.minecraft.server.v1_16_R3.BlockPosition)3 ChunkCache (net.minecraft.server.v1_16_R3.ChunkCache)3 PathEntity (net.minecraft.server.v1_16_R3.PathEntity)3 PathPoint (net.minecraft.server.v1_16_R3.PathPoint)3 ImmutableSet (com.google.common.collect.ImmutableSet)2 Iterator (java.util.Iterator)2 EntityHumanNPC (net.citizensnpcs.nms.v1_15_R1.entity.EntityHumanNPC)2 EntityHumanNPC (net.citizensnpcs.nms.v1_16_R3.entity.EntityHumanNPC)2 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)2