Search in sources :

Example 11 with IBlockData

use of net.minecraft.server.v1_11_R1.IBlockData in project Citizens2 by CitizensDev.

the class CitizensBlockBreaker method strengthMod.

private float strengthMod(IBlockData block) {
    ItemStack itemstack = getCurrentItem();
    float f = itemstack.a(block);
    if (entity instanceof EntityLiving) {
        EntityLiving handle = (EntityLiving) entity;
        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(Material.WATER)) && (!EnchantmentManager.i(handle))) {
            f /= 5.0F;
        }
    }
    if (!entity.onGround) {
        f /= 5.0F;
    }
    return f;
}
Also used : EntityLiving(net.minecraft.server.v1_11_R1.EntityLiving) CraftItemStack(org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack) ItemStack(net.minecraft.server.v1_11_R1.ItemStack)

Example 12 with IBlockData

use of net.minecraft.server.v1_11_R1.IBlockData in project askyblock by tastybento.

the class NMSHandler method setBlockSuperFast.

@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
    net.minecraft.server.v1_10_R1.World w = ((CraftWorld) b.getWorld()).getHandle();
    net.minecraft.server.v1_10_R1.Chunk chunk = w.getChunkAt(b.getX() >> 4, b.getZ() >> 4);
    BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
    int combined = blockId + (data << 12);
    IBlockData ibd = net.minecraft.server.v1_10_R1.Block.getByCombinedId(combined);
    if (applyPhysics) {
        w.setTypeAndData(bp, ibd, 3);
    } else {
        w.setTypeAndData(bp, ibd, 2);
    }
    chunk.a(bp, ibd);
}
Also used : IBlockData(net.minecraft.server.v1_10_R1.IBlockData) BlockPosition(net.minecraft.server.v1_10_R1.BlockPosition) CraftWorld(org.bukkit.craftbukkit.v1_10_R1.CraftWorld)

Example 13 with IBlockData

use of net.minecraft.server.v1_11_R1.IBlockData in project askyblock by tastybento.

the class NMSHandler method setBlockSuperFast.

@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
    net.minecraft.server.v1_8_R3.World w = ((CraftWorld) b.getWorld()).getHandle();
    net.minecraft.server.v1_8_R3.Chunk chunk = w.getChunkAt(b.getX() >> 4, b.getZ() >> 4);
    BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
    int combined = blockId + (data << 12);
    IBlockData ibd = net.minecraft.server.v1_8_R3.Block.getByCombinedId(combined);
    if (applyPhysics) {
        w.setTypeAndData(bp, ibd, 3);
    } else {
        w.setTypeAndData(bp, ibd, 2);
    }
    chunk.a(bp, ibd);
}
Also used : IBlockData(net.minecraft.server.v1_8_R3.IBlockData) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld)

Example 14 with IBlockData

use of net.minecraft.server.v1_11_R1.IBlockData in project askyblock by tastybento.

the class NMSHandler method setBlockSuperFast.

@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
    net.minecraft.server.v1_9_R1.World w = ((CraftWorld) b.getWorld()).getHandle();
    net.minecraft.server.v1_9_R1.Chunk chunk = w.getChunkAt(b.getX() >> 4, b.getZ() >> 4);
    BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
    int combined = blockId + (data << 12);
    IBlockData ibd = net.minecraft.server.v1_9_R1.Block.getByCombinedId(combined);
    if (applyPhysics) {
        w.setTypeAndData(bp, ibd, 3);
    } else {
        w.setTypeAndData(bp, ibd, 2);
    }
    chunk.a(bp, ibd);
}
Also used : IBlockData(net.minecraft.server.v1_9_R1.IBlockData) BlockPosition(net.minecraft.server.v1_9_R1.BlockPosition) CraftWorld(org.bukkit.craftbukkit.v1_9_R1.CraftWorld)

Example 15 with IBlockData

use of net.minecraft.server.v1_11_R1.IBlockData in project askyblock by tastybento.

the class NMSHandler method setBlockSuperFast.

@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
    net.minecraft.server.v1_11_R1.World w = ((CraftWorld) b.getWorld()).getHandle();
    net.minecraft.server.v1_11_R1.Chunk chunk = w.getChunkAt(b.getX() >> 4, b.getZ() >> 4);
    BlockPosition bp = new BlockPosition(b.getX(), b.getY(), b.getZ());
    int combined = blockId + (data << 12);
    IBlockData ibd = net.minecraft.server.v1_11_R1.Block.getByCombinedId(combined);
    if (applyPhysics) {
        w.setTypeAndData(bp, ibd, 3);
    } else {
        w.setTypeAndData(bp, ibd, 2);
    }
    chunk.a(bp, ibd);
}
Also used : IBlockData(net.minecraft.server.v1_11_R1.IBlockData) BlockPosition(net.minecraft.server.v1_11_R1.BlockPosition) CraftWorld(org.bukkit.craftbukkit.v1_11_R1.CraftWorld)

Aggregations

BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)5 IBlockData (net.minecraft.server.v1_10_R1.IBlockData)5 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)5 IBlockData (net.minecraft.server.v1_11_R1.IBlockData)5 NPC (net.citizensnpcs.api.npc.NPC)4 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)4 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)4 IBlockData (net.minecraft.server.v1_12_R1.IBlockData)4 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)3 IBlockData (net.minecraft.server.v1_8_R3.IBlockData)3 Block (net.minecraft.server.v1_10_R1.Block)2 Block (net.minecraft.server.v1_11_R1.Block)2 BlockPosition (net.minecraft.server.v1_8_R1.BlockPosition)2 IBlockData (net.minecraft.server.v1_8_R1.IBlockData)2 BlockPosition (net.minecraft.server.v1_8_R2.BlockPosition)2 IBlockData (net.minecraft.server.v1_8_R2.IBlockData)2 BlockPosition (net.minecraft.server.v1_9_R1.BlockPosition)2 IBlockData (net.minecraft.server.v1_9_R1.IBlockData)2 BlockPosition (net.minecraft.server.v1_9_R2.BlockPosition)2 CraftWorld (org.bukkit.craftbukkit.v1_10_R1.CraftWorld)2