Search in sources :

Example 6 with org.bukkit.craftbukkit.v1_18_R1.block

use of org.bukkit.craftbukkit.v1_18_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();
}
Also used : EntityFallingBlock(net.minecraft.server.v1_10_R1.EntityFallingBlock) Block(net.minecraft.server.v1_10_R1.Block) FallingBlock(org.bukkit.entity.FallingBlock) WorldServer(net.minecraft.server.v1_10_R1.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_10_R1.CraftWorld)

Example 7 with org.bukkit.craftbukkit.v1_18_R1.block

use of org.bukkit.craftbukkit.v1_18_R1.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.a;
        double d2 = localBlockPosition.getZ() + 0.5D - paramVec3D.c;
        if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
            Block localBlock = this.c.getType(localBlockPosition).getBlock();
            if (!localBlock.b(this.c, localBlockPosition)) {
                return false;
            }
        }
    }
    return true;
}
Also used : BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) Block(net.minecraft.server.v1_8_R3.Block)

Example 8 with org.bukkit.craftbukkit.v1_18_R1.block

use of org.bukkit.craftbukkit.v1_18_R1.block in project Citizens2 by CitizensDev.

the class PlayerNavigation method p.

private int p() {
    if ((!this.b.V()) || (!h())) {
        return (int) (this.b.getBoundingBox().b + 0.5D);
    }
    int i = (int) this.b.getBoundingBox().b;
    Block localBlock = this.c.getType(new BlockPosition(MathHelper.floor(this.b.locX), i, MathHelper.floor(this.b.locZ))).getBlock();
    int j = 0;
    while ((localBlock == Blocks.FLOWING_WATER) || (localBlock == Blocks.WATER)) {
        i++;
        localBlock = this.c.getType(new BlockPosition(MathHelper.floor(this.b.locX), i, MathHelper.floor(this.b.locZ))).getBlock();
        j++;
        if (j > 16) {
            return (int) this.b.getBoundingBox().b;
        }
    }
    return i;
}
Also used : BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) Block(net.minecraft.server.v1_8_R3.Block) PathPoint(net.minecraft.server.v1_8_R3.PathPoint)

Example 9 with org.bukkit.craftbukkit.v1_18_R1.block

use of org.bukkit.craftbukkit.v1_18_R1.block in project Citizens2 by CitizensDev.

the class PlayerNavigation method s.

private int s() {
    if ((!this.a.isInWater()) || (!h())) {
        return (int) (this.a.getBoundingBox().b + 0.5D);
    }
    int j = (int) this.a.getBoundingBox().b;
    Block localBlock = this.b.getType(new BlockPosition(MathHelper.floor(this.a.locX), j, MathHelper.floor(this.a.locZ))).getBlock();
    int k = 0;
    while ((localBlock == Blocks.FLOWING_WATER) || (localBlock == Blocks.WATER)) {
        j++;
        localBlock = this.b.getType(new BlockPosition(MathHelper.floor(this.a.locX), j, MathHelper.floor(this.a.locZ))).getBlock();
        k++;
        if (k > 16) {
            return (int) this.a.getBoundingBox().b;
        }
    }
    return j;
}
Also used : BlockPosition(net.minecraft.server.v1_12_R1.BlockPosition) Block(net.minecraft.server.v1_12_R1.Block) PathPoint(net.minecraft.server.v1_12_R1.PathPoint)

Example 10 with org.bukkit.craftbukkit.v1_18_R1.block

use of org.bukkit.craftbukkit.v1_18_R1.block in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method b.

protected 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;
}
Also used : BlockDoor(net.minecraft.server.v1_12_R1.BlockDoor) IBlockData(net.minecraft.server.v1_12_R1.IBlockData) BlockFenceGate(net.minecraft.server.v1_12_R1.BlockFenceGate) BlockCobbleWall(net.minecraft.server.v1_12_R1.BlockCobbleWall) MutableBlockPosition(net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_12_R1.BlockPosition) Block(net.minecraft.server.v1_12_R1.Block) Material(net.minecraft.server.v1_12_R1.Material) BlockMinecartTrackAbstract(net.minecraft.server.v1_12_R1.BlockMinecartTrackAbstract) BlockFence(net.minecraft.server.v1_12_R1.BlockFence)

Aggregations

Block (net.minecraft.server.v1_10_R1.Block)7 Block (net.minecraft.server.v1_11_R1.Block)7 Block (net.minecraft.server.v1_12_R1.Block)7 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)6 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)6 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)6 Block (net.minecraft.server.v1_8_R3.Block)6 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)4 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)4 Block (net.minecraft.world.level.block.Block)4 ArrayList (java.util.ArrayList)3 MutableBlockPosition (net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition)3 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)3 MutableBlockPosition (net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition)3 MutableBlockPosition (net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition)3 PathPoint (net.minecraft.server.v1_12_R1.PathPoint)3 PathPoint (net.minecraft.server.v1_8_R3.PathPoint)3 CraftItemStack (org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack)3 FallingBlock (org.bukkit.entity.FallingBlock)3 FakeBlock (com.denizenscript.denizen.utilities.blocks.FakeBlock)2