Search in sources :

Example 6 with CraftWorld

use of org.bukkit.craftbukkit.v1_8_R3.CraftWorld in project Denizen-For-Bukkit by DenizenScript.

the class FishingHelper_v1_11_R1 method getResult.

@Override
public org.bukkit.inventory.ItemStack getResult(FishHook fishHook, CatchType catchType) {
    ItemStack result = null;
    EntityFishingHook nmsHook = ((CraftFish) fishHook).getHandle();
    if (catchType == CatchType.DEFAULT) {
        float f = ((CraftWorld) fishHook.getWorld()).getHandle().random.nextFloat();
        int i = EnchantmentManager.g(nmsHook.owner);
        int j = EnchantmentManager.a(Enchantments.LURE, nmsHook.owner);
        float f1 = 0.1F - (float) i * 0.025F - (float) j * 0.01F;
        float f2 = 0.05F + (float) i * 0.01F - (float) j * 0.01F;
        f1 = MathHelper.a(f1, 0.0F, 1.0F);
        f2 = MathHelper.a(f2, 0.0F, 1.0F);
        if (f < f1) {
            result = catchRandomJunk(nmsHook);
        } else {
            f -= f1;
            if (f < f2) {
                result = catchRandomTreasure(nmsHook);
            } else {
                result = catchRandomFish(nmsHook);
            }
        }
    } else if (catchType == CatchType.JUNK) {
        result = catchRandomJunk(nmsHook);
    } else if (catchType == CatchType.TREASURE) {
        result = catchRandomTreasure(nmsHook);
    } else if (catchType == CatchType.FISH) {
        result = catchRandomFish(nmsHook);
    }
    if (result != null) {
        return CraftItemStack.asBukkitCopy(result);
    } else {
        return null;
    }
}
Also used : CraftFish(org.bukkit.craftbukkit.v1_11_R1.entity.CraftFish) CraftItemStack(org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack) CraftWorld(org.bukkit.craftbukkit.v1_11_R1.CraftWorld)

Example 7 with CraftWorld

use of org.bukkit.craftbukkit.v1_8_R3.CraftWorld in project Denizen-For-Bukkit by DenizenScript.

the class CustomEntityHelper_v1_9_R2 method spawnItemProjectile.

@Override
public ItemProjectile spawnItemProjectile(Location location, ItemStack itemStack) {
    CraftWorld world = (CraftWorld) location.getWorld();
    EntityItemProjectile_v1_9_R2 entity = new EntityItemProjectile_v1_9_R2(world, location, itemStack);
    return entity.getBukkitEntity();
}
Also used : EntityItemProjectile_v1_9_R2(net.aufdemrand.denizen.nms.impl.entities.EntityItemProjectile_v1_9_R2) CraftWorld(org.bukkit.craftbukkit.v1_9_R2.CraftWorld)

Example 8 with CraftWorld

use of org.bukkit.craftbukkit.v1_8_R3.CraftWorld in project Denizen-For-Bukkit by DenizenScript.

the class CustomEntityHelper_v1_9_R2 method spawnFakeArrow.

@Override
public FakeArrow spawnFakeArrow(Location location) {
    CraftWorld world = (CraftWorld) location.getWorld();
    EntityFakeArrow_v1_9_R2 arrow = new EntityFakeArrow_v1_9_R2(world, location);
    return arrow.getBukkitEntity();
}
Also used : EntityFakeArrow_v1_9_R2(net.aufdemrand.denizen.nms.impl.entities.EntityFakeArrow_v1_9_R2) CraftWorld(org.bukkit.craftbukkit.v1_9_R2.CraftWorld)

Example 9 with CraftWorld

use of org.bukkit.craftbukkit.v1_8_R3.CraftWorld in project Denizen-For-Bukkit by DenizenScript.

the class EntityHelper_v1_9_R2 method forceInteraction.

/*
        General Entity Methods
     */
@Override
public void forceInteraction(Player player, Location location) {
    CraftPlayer craftPlayer = (CraftPlayer) player;
    BlockPosition pos = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
    Block.getById(location.getBlock().getType().getId()).interact(((CraftWorld) location.getWorld()).getHandle(), pos, ((CraftWorld) location.getWorld()).getHandle().getType(pos), craftPlayer != null ? craftPlayer.getHandle() : null, EnumHand.MAIN_HAND, null, EnumDirection.NORTH, 0f, 0f, 0f);
}
Also used : CraftPlayer(org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer) CraftWorld(org.bukkit.craftbukkit.v1_9_R2.CraftWorld)

Example 10 with CraftWorld

use of org.bukkit.craftbukkit.v1_8_R3.CraftWorld in project Denizen-For-Bukkit by DenizenScript.

the class FishingHelper_v1_9_R2 method getResult.

@Override
public org.bukkit.inventory.ItemStack getResult(FishHook fishHook, CatchType catchType) {
    ItemStack result = null;
    EntityFishingHook nmsHook = ((CraftFish) fishHook).getHandle();
    if (catchType == CatchType.DEFAULT) {
        float f = ((CraftWorld) fishHook.getWorld()).getHandle().random.nextFloat();
        int i = EnchantmentManager.g(nmsHook.owner);
        int j = EnchantmentManager.h(nmsHook.owner);
        float f1 = 0.1F - (float) i * 0.025F - (float) j * 0.01F;
        float f2 = 0.05F + (float) i * 0.01F - (float) j * 0.01F;
        f1 = MathHelper.a(f1, 0.0F, 1.0F);
        f2 = MathHelper.a(f2, 0.0F, 1.0F);
        if (f < f1) {
            result = catchRandomJunk(nmsHook);
        } else {
            f -= f1;
            if (f < f2) {
                result = catchRandomTreasure(nmsHook);
            } else {
                result = catchRandomFish(nmsHook);
            }
        }
    } else if (catchType == CatchType.JUNK) {
        result = catchRandomJunk(nmsHook);
    } else if (catchType == CatchType.TREASURE) {
        result = catchRandomTreasure(nmsHook);
    } else if (catchType == CatchType.FISH) {
        result = catchRandomFish(nmsHook);
    }
    if (result != null) {
        return CraftItemStack.asBukkitCopy(result);
    } else {
        return null;
    }
}
Also used : CraftFish(org.bukkit.craftbukkit.v1_9_R2.entity.CraftFish) CraftItemStack(org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemStack) CraftWorld(org.bukkit.craftbukkit.v1_9_R2.CraftWorld)

Aggregations

CraftWorld (org.bukkit.craftbukkit.v1_8_R3.CraftWorld)6 CraftWorld (org.bukkit.craftbukkit.v1_10_R1.CraftWorld)5 CraftWorld (org.bukkit.craftbukkit.v1_11_R1.CraftWorld)5 CraftWorld (org.bukkit.craftbukkit.v1_9_R2.CraftWorld)5 GameProfile (com.mojang.authlib.GameProfile)4 Property (com.mojang.authlib.properties.Property)4 BigInteger (java.math.BigInteger)4 MessageDigest (java.security.MessageDigest)4 UUID (java.util.UUID)4 PlayerProfile (net.aufdemrand.denizen.nms.util.PlayerProfile)4 Scoreboard (org.bukkit.scoreboard.Scoreboard)4 Team (org.bukkit.scoreboard.Team)4 WorldServer (net.minecraft.server.v1_8_R3.WorldServer)2 CraftFakePlayer_v1_10_R1 (net.aufdemrand.denizen.nms.impl.entities.CraftFakePlayer_v1_10_R1)1 CraftFakePlayer_v1_11_R1 (net.aufdemrand.denizen.nms.impl.entities.CraftFakePlayer_v1_11_R1)1 CraftFakePlayer_v1_8_R3 (net.aufdemrand.denizen.nms.impl.entities.CraftFakePlayer_v1_8_R3)1 CraftFakePlayer_v1_9_R2 (net.aufdemrand.denizen.nms.impl.entities.CraftFakePlayer_v1_9_R2)1 EntityFakeArrow_v1_10_R1 (net.aufdemrand.denizen.nms.impl.entities.EntityFakeArrow_v1_10_R1)1 EntityFakeArrow_v1_11_R1 (net.aufdemrand.denizen.nms.impl.entities.EntityFakeArrow_v1_11_R1)1 EntityFakeArrow_v1_8_R3 (net.aufdemrand.denizen.nms.impl.entities.EntityFakeArrow_v1_8_R3)1