use of net.minecraft.server.v1_14_R1.Block in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
@Override
public PathType a(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) {
PathType localPathType1 = b(paramIBlockAccess, paramInt1, paramInt2, paramInt3);
if ((localPathType1 == PathType.OPEN) && (paramInt2 >= 1)) {
Block localObject = paramIBlockAccess.getType(new BlockPosition(paramInt1, paramInt2 - 1, paramInt3)).getBlock();
PathType localPathType2 = b(paramIBlockAccess, paramInt1, paramInt2 - 1, paramInt3);
localPathType1 = (localPathType2 == PathType.WALKABLE) || (localPathType2 == PathType.OPEN) || (localPathType2 == PathType.WATER) || (localPathType2 == PathType.LAVA) ? PathType.OPEN : PathType.WALKABLE;
if ((localPathType2 == PathType.DAMAGE_FIRE) || (localObject == Blocks.df)) {
localPathType1 = PathType.DAMAGE_FIRE;
}
if (localPathType2 == PathType.DAMAGE_CACTUS) {
localPathType1 = PathType.DAMAGE_CACTUS;
}
}
Object localObject = BlockPosition.PooledBlockPosition.s();
if (localPathType1 == PathType.WALKABLE) {
for (int i = -1; i <= 1; i++) {
for (int k = -1; k <= 1; k++) {
if ((i != 0) || (k != 0)) {
Block localBlock = paramIBlockAccess.getType(((BlockPosition.PooledBlockPosition) localObject).f(i + paramInt1, paramInt2, k + paramInt3)).getBlock();
if (localBlock == Blocks.CACTUS) {
localPathType1 = PathType.DANGER_CACTUS;
} else if (localBlock == Blocks.FIRE) {
localPathType1 = PathType.DANGER_FIRE;
}
}
}
}
}
((BlockPosition.PooledBlockPosition) localObject).t();
return localPathType1;
}
use of net.minecraft.server.v1_14_R1.Block in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method b.
private PathType b(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) {
BlockPosition localBlockPosition = new BlockPosition(paramInt1, paramInt2, paramInt3);
IBlockData localIBlockData = paramIBlockAccess.getType(localBlockPosition);
Block localBlock = localIBlockData.getBlock();
Material localMaterial = localIBlockData.getMaterial();
if (localMaterial == Material.AIR) {
return PathType.OPEN;
}
if ((localBlock == Blocks.TRAPDOOR) || (localBlock == Blocks.IRON_TRAPDOOR) || (localBlock == Blocks.WATERLILY)) {
return PathType.TRAPDOOR;
}
if (localBlock == Blocks.FIRE) {
return PathType.DAMAGE_FIRE;
}
if (localBlock == Blocks.CACTUS) {
return PathType.DAMAGE_CACTUS;
}
if (((localBlock instanceof BlockDoor)) && (localMaterial == Material.WOOD) && (!localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
return PathType.DOOR_WOOD_CLOSED;
}
if (((localBlock instanceof BlockDoor)) && (localMaterial == Material.ORE) && (!localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
return PathType.DOOR_IRON_CLOSED;
}
if (((localBlock instanceof BlockDoor)) && (localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
return PathType.DOOR_OPEN;
}
if ((localBlock instanceof BlockMinecartTrackAbstract)) {
return PathType.RAIL;
}
if (((localBlock instanceof BlockFence)) || ((localBlock instanceof BlockCobbleWall)) || (((localBlock instanceof BlockFenceGate)) && (!localIBlockData.get(BlockFenceGate.OPEN).booleanValue()))) {
return PathType.FENCE;
}
if (localMaterial == Material.WATER) {
return PathType.WATER;
}
if (localMaterial == Material.LAVA) {
return PathType.LAVA;
}
if (localBlock.b(paramIBlockAccess, localBlockPosition)) {
return PathType.OPEN;
}
return PathType.BLOCKED;
}
use of net.minecraft.server.v1_14_R1.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_14_R1.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_14_R1.Block in project Citizens2 by CitizensDev.
the class PlayerNavigation method a.
private boolean a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
int i = paramInt1 - paramInt4 / 2;
int j = paramInt3 - paramInt6 / 2;
if (!b(i, paramInt2, j, paramInt4, paramInt5, paramInt6, paramVec3D, paramDouble1, paramDouble2)) {
return false;
}
for (int k = i; k < i + paramInt4; k++) {
for (int m = j; m < j + paramInt6; m++) {
double d1 = k + 0.5D - paramVec3D.a;
double d2 = m + 0.5D - paramVec3D.c;
if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
Block localBlock = this.c.getType(new BlockPosition(k, paramInt2 - 1, m)).getBlock();
Material localMaterial = localBlock.getMaterial();
if (localMaterial == Material.AIR) {
return false;
}
if ((localMaterial == Material.WATER) && (!this.b.V())) {
return false;
}
if (localMaterial == Material.LAVA) {
return false;
}
}
}
}
return true;
}
Aggregations