Search in sources :

Example 26 with Block

use of net.minecraft.server.v1_14_R1.Block in project Citizens2 by CitizensDev.

the class CitizensBlockBreaker method strengthMod.

private float strengthMod(IBlockData block) {
    ItemStack itemstack = getCurrentItem();
    float f = itemstack.a(block);
    if (getHandle() instanceof EntityLiving) {
        EntityLiving handle = (EntityLiving) getHandle();
        if (f > 1.0F) {
            int i = EnchantmentManager.getDigSpeedEnchantmentLevel(handle);
            if (i > 0) {
                f += i * i + 1;
            }
        }
        if (handle.hasEffect(MobEffects.FASTER_DIG)) {
            f *= (1.0F + (handle.getEffect(MobEffects.FASTER_DIG).getAmplifier() + 1) * 0.2F);
        }
        if (handle.hasEffect(MobEffects.SLOWER_DIG)) {
            float f1 = 1.0F;
            switch(handle.getEffect(MobEffects.SLOWER_DIG).getAmplifier()) {
                case 0:
                    f1 = 0.3F;
                    break;
                case 1:
                    f1 = 0.09F;
                    break;
                case 2:
                    f1 = 0.0027F;
                    break;
                case 3:
                default:
                    f1 = 8.1E-4F;
            }
            f *= f1;
        }
        if (handle.a(TagsFluid.WATER) && !EnchantmentManager.h(handle)) {
            f /= 5.0F;
        }
    }
    if (!getHandle().onGround) {
        f /= 5.0F;
    }
    return f;
}
Also used : EntityLiving(net.minecraft.server.v1_14_R1.EntityLiving) ItemStack(net.minecraft.server.v1_14_R1.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack)

Example 27 with Block

use of net.minecraft.server.v1_14_R1.Block in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method b.

protected PathType b(IBlockAccess var0, int var1, int var2, int var3) {
    BlockPosition var4 = new BlockPosition(var1, var2, var3);
    IBlockData var5 = var0.getType(var4);
    Block var6 = var5.getBlock();
    Material var7 = var5.getMaterial();
    if (var5.isAir()) {
        return PathType.OPEN;
    } else if (!var6.a(TagsBlock.TRAPDOORS) && var6 != Blocks.LILY_PAD) {
        if (var6 == Blocks.FIRE) {
            return PathType.DAMAGE_FIRE;
        } else if (var6 == Blocks.CACTUS) {
            return PathType.DAMAGE_CACTUS;
        } else if (var6 == Blocks.SWEET_BERRY_BUSH) {
            return PathType.DAMAGE_OTHER;
        } else if (var6 instanceof BlockDoor && var7 == Material.WOOD && !(Boolean) var5.get(BlockDoor.OPEN)) {
            return PathType.DOOR_WOOD_CLOSED;
        } else if (var6 instanceof BlockDoor && var7 == Material.ORE && !(Boolean) var5.get(BlockDoor.OPEN)) {
            return PathType.DOOR_IRON_CLOSED;
        } else if (var6 instanceof BlockDoor && var5.get(BlockDoor.OPEN)) {
            return PathType.DOOR_OPEN;
        } else if (var6 instanceof BlockMinecartTrackAbstract) {
            return PathType.RAIL;
        } else if (var6 instanceof BlockLeaves) {
            return PathType.LEAVES;
        } else if (!var6.a(TagsBlock.FENCES) && !var6.a(TagsBlock.WALLS) && (!(var6 instanceof BlockFenceGate) || var5.get(BlockFenceGate.OPEN))) {
            Fluid var8 = var0.getFluid(var4);
            if (var8.a(TagsFluid.WATER)) {
                return PathType.WATER;
            } else if (var8.a(TagsFluid.LAVA)) {
                return PathType.LAVA;
            } else {
                return var5.a(var0, var4, PathMode.LAND) ? PathType.OPEN : PathType.BLOCKED;
            }
        } else {
            return PathType.FENCE;
        }
    } else {
        return PathType.TRAPDOOR;
    }
}
Also used : BlockDoor(net.minecraft.server.v1_14_R1.BlockDoor) IBlockData(net.minecraft.server.v1_14_R1.IBlockData) BlockLeaves(net.minecraft.server.v1_14_R1.BlockLeaves) BlockFenceGate(net.minecraft.server.v1_14_R1.BlockFenceGate) BlockPosition(net.minecraft.server.v1_14_R1.BlockPosition) MutableBlockPosition(net.minecraft.server.v1_14_R1.BlockPosition.MutableBlockPosition) PooledBlockPosition(net.minecraft.server.v1_14_R1.BlockPosition.PooledBlockPosition) Fluid(net.minecraft.server.v1_14_R1.Fluid) TagsFluid(net.minecraft.server.v1_14_R1.TagsFluid) Block(net.minecraft.server.v1_14_R1.Block) TagsBlock(net.minecraft.server.v1_14_R1.TagsBlock) Material(net.minecraft.server.v1_14_R1.Material) BlockMinecartTrackAbstract(net.minecraft.server.v1_14_R1.BlockMinecartTrackAbstract)

Example 28 with Block

use of net.minecraft.server.v1_14_R1.Block in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method a.

@Override
public PathType a(IBlockAccess var0, int var1, int var2, int var3) {
    PathType var4 = this.b(var0, var1, var2, var3);
    if (var4 == PathType.OPEN && var2 >= 1) {
        Block var5 = var0.getType(new BlockPosition(var1, var2 - 1, var3)).getBlock();
        PathType var6 = this.b(var0, var1, var2 - 1, var3);
        var4 = var6 != PathType.WALKABLE && var6 != PathType.OPEN && var6 != PathType.WATER && var6 != PathType.LAVA ? PathType.WALKABLE : PathType.OPEN;
        if (var6 == PathType.DAMAGE_FIRE || var5 == Blocks.MAGMA_BLOCK || var5 == Blocks.CAMPFIRE) {
            var4 = PathType.DAMAGE_FIRE;
        }
        if (var6 == PathType.DAMAGE_CACTUS) {
            var4 = PathType.DAMAGE_CACTUS;
        }
        if (var6 == PathType.DAMAGE_OTHER) {
            var4 = PathType.DAMAGE_OTHER;
        }
    }
    var4 = this.a(var0, var1, var2, var3, var4);
    return var4;
}
Also used : PathType(net.minecraft.server.v1_14_R1.PathType) BlockPosition(net.minecraft.server.v1_14_R1.BlockPosition) MutableBlockPosition(net.minecraft.server.v1_14_R1.BlockPosition.MutableBlockPosition) PooledBlockPosition(net.minecraft.server.v1_14_R1.BlockPosition.PooledBlockPosition) Block(net.minecraft.server.v1_14_R1.Block) TagsBlock(net.minecraft.server.v1_14_R1.TagsBlock)

Example 29 with Block

use of net.minecraft.server.v1_14_R1.Block in project Citizens2 by CitizensDev.

the class PlayerNavigation method t.

private int t() {
    if (this.a.isInWater() && this.r()) {
        int var0 = MathHelper.floor(this.a.getBoundingBox().minY);
        Block var1 = this.b.getType(new BlockPosition(this.a.locX, var0, this.a.locZ)).getBlock();
        int var2 = 0;
        do {
            if (var1 != Blocks.WATER) {
                return var0;
            }
            ++var0;
            var1 = this.b.getType(new BlockPosition(this.a.locX, var0, this.a.locZ)).getBlock();
            ++var2;
        } while (var2 <= 16);
        return MathHelper.floor(this.a.getBoundingBox().minY);
    } else {
        return MathHelper.floor(this.a.getBoundingBox().minY + 0.5D);
    }
}
Also used : BlockPosition(net.minecraft.server.v1_14_R1.BlockPosition) Block(net.minecraft.server.v1_14_R1.Block) PathPoint(net.minecraft.server.v1_14_R1.PathPoint)

Example 30 with Block

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));
    // TODO: how to incorporate this - probably delete?
    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.getBlockData());
    return handle.getBukkitEntity();
}
Also used : EntityFallingBlock(net.minecraft.server.v1_14_R1.EntityFallingBlock) CraftFallingBlock(org.bukkit.craftbukkit.v1_14_R1.entity.CraftFallingBlock) Block(net.minecraft.server.v1_14_R1.Block) FallingBlock(org.bukkit.entity.FallingBlock) WorldServer(net.minecraft.server.v1_14_R1.WorldServer) CraftWorld(org.bukkit.craftbukkit.v1_14_R1.CraftWorld)

Aggregations

ArrayList (java.util.ArrayList)12 Block (net.minecraft.server.v1_12_R1.Block)12 IBlockData (net.minecraft.server.v1_14_R1.IBlockData)9 ByteString (com.google.protobuf.ByteString)8 HashMap (java.util.HashMap)8 Block (net.minecraft.server.v1_10_R1.Block)8 Block (net.minecraft.server.v1_11_R1.Block)8 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)8 Block (net.minecraft.server.v1_8_R3.Block)8 FallingBlock (org.bukkit.entity.FallingBlock)8 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)7 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)7 AnnotateImageResponse (com.google.cloud.vision.v1.AnnotateImageResponse)6 Block (com.google.cloud.vision.v1.Block)6 Feature (com.google.cloud.vision.v1.Feature)6 ImageAnnotatorClient (com.google.cloud.vision.v1.ImageAnnotatorClient)6 Page (com.google.cloud.vision.v1.Page)6 Paragraph (com.google.cloud.vision.v1.Paragraph)6 Symbol (com.google.cloud.vision.v1.Symbol)6 Word (com.google.cloud.vision.v1.Word)6