use of net.minecraft.server.v1_16_R3.Block in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method getPathTypeBase.
public PathType getPathTypeBase(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) {
BlockPosition localBlockPosition = new BlockPosition(paramInt1, paramInt2, paramInt3);
IBlockData localIBlockData = paramIBlockAccess.getType(localBlockPosition);
Block localBlock1 = localIBlockData.getBlock();
Material localMaterial = localIBlockData.getMaterial();
PathType localPathType1 = PathType.BLOCKED;
if ((localBlock1 == Blocks.TRAPDOOR) || (localBlock1 == Blocks.IRON_TRAPDOOR) || (localBlock1 == Blocks.WATERLILY)) {
return PathType.TRAPDOOR;
}
if (localBlock1 == Blocks.FIRE) {
return PathType.DAMAGE_FIRE;
}
if (localBlock1 == Blocks.CACTUS) {
return PathType.DAMAGE_CACTUS;
}
if (((localBlock1 instanceof BlockDoor)) && (localMaterial == Material.WOOD) && (!localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
return PathType.DOOR_WOOD_CLOSED;
}
if (((localBlock1 instanceof BlockDoor)) && (localMaterial == Material.ORE) && (!localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
return PathType.DOOR_IRON_CLOSED;
}
if (((localBlock1 instanceof BlockDoor)) && (localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
return PathType.DOOR_OPEN;
}
if ((localBlock1 instanceof BlockMinecartTrackAbstract)) {
return PathType.RAIL;
}
if (((localBlock1 instanceof BlockFence)) || ((localBlock1 instanceof BlockCobbleWall)) || (((localBlock1 instanceof BlockFenceGate)) && (!localIBlockData.get(BlockFenceGate.OPEN).booleanValue()))) {
return PathType.FENCE;
}
if (localMaterial == Material.AIR) {
localPathType1 = PathType.OPEN;
} else {
if (localMaterial == Material.WATER) {
return PathType.WATER;
}
if (localMaterial == Material.LAVA) {
return PathType.LAVA;
}
}
if ((localBlock1.b(paramIBlockAccess, localBlockPosition)) && (localPathType1 == PathType.BLOCKED)) {
localPathType1 = PathType.OPEN;
}
return localPathType1;
}
use of net.minecraft.server.v1_16_R3.Block in project Citizens2 by CitizensDev.
the class PlayerNavigation method d.
@Override
protected void d() {
super.d();
PathPoint localPathPoint;
for (int i = 0; i < this.c.d(); i++) {
localPathPoint = this.c.a(i);
Object localObject = i + 1 < this.c.d() ? this.c.a(i + 1) : null;
IBlockData localIBlockData = this.b.getType(new BlockPosition(localPathPoint.a, localPathPoint.b, localPathPoint.c));
Block localBlock = localIBlockData.getBlock();
if (localBlock == Blocks.cauldron) {
this.c.a(i, localPathPoint.a(localPathPoint.a, localPathPoint.b + 1, localPathPoint.c));
if ((localObject != null) && (localPathPoint.b >= ((PathPoint) localObject).b)) {
this.c.a(i + 1, ((PathPoint) localObject).a(((PathPoint) localObject).a, localPathPoint.b + 1, ((PathPoint) localObject).c));
}
}
}
if (this.f2) {
if (this.b.h(new BlockPosition(MathHelper.floor(this.a.locX), (int) (this.a.getBoundingBox().b + 0.5D), MathHelper.floor(this.a.locZ)))) {
return;
}
for (i = 0; i < this.c.d(); i++) {
localPathPoint = this.c.a(i);
if (this.b.h(new BlockPosition(localPathPoint.a, localPathPoint.b, localPathPoint.c))) {
this.c.b(i - 1);
return;
}
}
}
}
use of net.minecraft.server.v1_16_R3.Block in project Citizens2 by CitizensDev.
the class PlayerNavigation method b.
private boolean b(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
for (BlockPosition localBlockPosition : BlockPosition.a(new BlockPosition(paramInt1, paramInt2, paramInt3), new BlockPosition(paramInt1 + paramInt4 - 1, paramInt2 + paramInt5 - 1, paramInt3 + paramInt6 - 1))) {
double d1 = localBlockPosition.getX() + 0.5D - paramVec3D.x;
double d2 = localBlockPosition.getZ() + 0.5D - paramVec3D.z;
if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
Block localBlock = this.b.getType(localBlockPosition).getBlock();
if (!localBlock.b(this.b, localBlockPosition)) {
return false;
}
}
}
return true;
}
use of net.minecraft.server.v1_16_R3.Block in project Citizens2 by CitizensDev.
the class FallingBlockController method createEntity.
@Override
protected Entity createEntity(Location at, NPC npc) {
WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
Block id = Blocks.STONE;
int data = npc.data().get(NPC.ITEM_DATA_METADATA, npc.data().get("falling-block-data", 0));
if (npc.data().has("falling-block-id") || npc.data().has(NPC.ITEM_ID_METADATA)) {
id = CraftMagicNumbers.getBlock(Material.getMaterial(npc.data().<String>get(NPC.ITEM_ID_METADATA, npc.data().<String>get("falling-block-id"))));
}
final EntityFallingBlockNPC handle = new EntityFallingBlockNPC(ws, npc, at.getX(), at.getY(), at.getZ(), id.fromLegacyData(data));
return handle.getBukkitEntity();
}
use of net.minecraft.server.v1_16_R3.Block in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
public PathType a(IBlockAccess var1, int var2, int var3, int var4, PathType var5) {
if (var5 == PathType.WALKABLE) {
BlockPosition.PooledBlockPosition var6 = BlockPosition.PooledBlockPosition.r();
Throwable var7 = null;
try {
for (int var8 = -1; var8 <= 1; ++var8) {
for (int var9 = -1; var9 <= 1; ++var9) {
if (var8 != 0 || var9 != 0) {
BlockPosition blockPos;
try {
blockPos = var6.c(var8 + var2, var3, var9 + var4);
} catch (NoSuchMethodError ex) {
try {
blockPos = (BlockPosition.PooledBlockPosition) BLOCK_POSITION_B_C.invoke(var6, var8 + var2, var3, var9 + var4);
} catch (Throwable ex2) {
ex2.printStackTrace();
return PathType.BLOCKED;
}
}
Block var10 = var1.getType(blockPos).getBlock();
if (var10 == Blocks.CACTUS) {
var5 = PathType.DANGER_CACTUS;
} else if (var10 == Blocks.FIRE) {
var5 = PathType.DANGER_FIRE;
}
}
}
}
} catch (Throwable var18) {
var7 = var18;
throw var18;
} finally {
if (var6 != null) {
if (var7 != null) {
try {
var6.close();
} catch (Throwable var17) {
var7.addSuppressed(var17);
}
} else {
var6.close();
}
}
}
}
return var5;
}
Aggregations