Search in sources :

Example 16 with World

use of net.minecraft.server.v1_8_R1.World in project acidisland by tastybento.

the class NMSHandler method setBlockSuperFast.

@Override
public void setBlockSuperFast(Block b, int blockId, byte data, boolean applyPhysics) {
    net.minecraft.server.v1_8_R1.World w = ((CraftWorld) b.getWorld()).getHandle();
    net.minecraft.server.v1_8_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_8_R1.Block.getByCombinedId(combined);
    chunk.a(bp, ibd);
    if (applyPhysics) {
        net.minecraft.server.v1_8_R1.Block block = chunk.getType(bp);
        w.update(bp, block);
    }
}
Also used : IBlockData(net.minecraft.server.v1_8_R1.IBlockData) BlockPosition(net.minecraft.server.v1_8_R1.BlockPosition) CraftWorld(org.bukkit.craftbukkit.v1_8_R1.CraftWorld)

Example 17 with World

use of net.minecraft.server.v1_8_R1.World in project MyPet by xXKeyleXx.

the class EntityRegistry method createMinecraftEntity.

@Override
public MyPetMinecraftEntity createMinecraftEntity(MyPet pet, org.bukkit.World bukkitWorld) {
    EntityMyPet petEntity = null;
    Class<? extends MyPetMinecraftEntity> entityClass = entityClasses.get(pet.getPetType());
    World world = ((CraftWorld) bukkitWorld).getHandle();
    try {
        Constructor<?> ctor = entityClass.getConstructor(World.class, MyPet.class);
        Object obj = ctor.newInstance(world, pet);
        if (obj instanceof EntityMyPet) {
            petEntity = (EntityMyPet) obj;
        }
    } catch (Exception e) {
        MyPetApi.getLogger().info(ChatColor.RED + Util.getClassName(entityClass) + "(" + pet.getPetType() + ") is no valid MyPet(Entity)!");
        e.printStackTrace();
    }
    return petEntity;
}
Also used : World(net.minecraft.server.v1_8_R3.World) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld)

Example 18 with World

use of net.minecraft.server.v1_8_R1.World in project MyPet by xXKeyleXx.

the class EntityRegistry method createMinecraftEntity.

@Override
public MyPetMinecraftEntity createMinecraftEntity(MyPet pet, org.bukkit.World bukkitWorld) {
    EntityMyPet petEntity = null;
    Class<? extends MyPetMinecraftEntity> entityClass = entityClasses.get(pet.getPetType());
    World world = ((CraftWorld) bukkitWorld).getHandle();
    try {
        Constructor<?> ctor = entityClass.getConstructor(World.class, MyPet.class);
        Object obj = ctor.newInstance(world, pet);
        if (obj instanceof EntityMyPet) {
            petEntity = (EntityMyPet) obj;
        }
    } catch (Exception e) {
        MyPetApi.getLogger().info(ChatColor.RED + Util.getClassName(entityClass) + "(" + pet.getPetType() + ") is no valid MyPet(Entity)!");
        e.printStackTrace();
    }
    return petEntity;
}
Also used : World(net.minecraft.server.v1_12_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_12_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_12_R1.CraftWorld)

Example 19 with World

use of net.minecraft.server.v1_8_R1.World in project NoCheatPlus by NoCheatPlus.

the class BlockCacheSpigotCB1_8_R1 method fetchBounds.

@Override
public double[] fetchBounds(final int x, final int y, final int z) {
    @SuppressWarnings("deprecation") final int id = getType(x, y, z).getId();
    final net.minecraft.server.v1_8_R1.Block block = net.minecraft.server.v1_8_R1.Block.getById(id);
    if (block == null) {
        // TODO: Convention for null bounds -> full ?
        return null;
    }
    block.updateShape(world, new BlockPosition(x, y, z));
    // minX, minY, minZ, maxX, maxY, maxZ
    return new double[] { block.z(), block.B(), block.D(), block.A(), block.C(), block.E() };
}
Also used : BlockPosition(net.minecraft.server.v1_8_R1.BlockPosition)

Aggregations

CraftPlayer (org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer)5 Player (org.bukkit.entity.Player)5 PacketPlayOutTitle (net.minecraft.server.v1_8_R1.PacketPlayOutTitle)4 BlockPosition (net.minecraft.server.v1_8_R1.BlockPosition)3 CraftWorld (org.bukkit.craftbukkit.v1_8_R1.CraftWorld)3 World (net.minecraft.server.v1_7_R4.World)2 IBlockData (net.minecraft.server.v1_8_R1.IBlockData)2 World (net.minecraft.server.v1_10_R1.World)1 World (net.minecraft.server.v1_11_R1.World)1 World (net.minecraft.server.v1_12_R1.World)1 World (net.minecraft.server.v1_16_R3.World)1 EntityArrow (net.minecraft.server.v1_7_R4.EntityArrow)1 PacketPlayOutChat (net.minecraft.server.v1_8_R1.PacketPlayOutChat)1 World (net.minecraft.server.v1_8_R1.World)1 World (net.minecraft.server.v1_8_R2.World)1 World (net.minecraft.server.v1_8_R3.World)1 World (net.minecraft.server.v1_9_R1.World)1 World (net.minecraft.server.v1_9_R2.World)1 CraftWorld (org.bukkit.craftbukkit.v1_10_R1.CraftWorld)1 CraftWorld (org.bukkit.craftbukkit.v1_11_R1.CraftWorld)1