Search in sources :

Example 21 with World

use of net.minecraft.server.v1_9_R2.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 22 with World

use of net.minecraft.server.v1_9_R2.World 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_R2.World w = ((CraftWorld) b.getWorld()).getHandle();
    net.minecraft.server.v1_9_R2.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_R2.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_R2.IBlockData) BlockPosition(net.minecraft.server.v1_9_R2.BlockPosition) CraftWorld(org.bukkit.craftbukkit.v1_9_R2.CraftWorld)

Aggregations

CraftPlayer (org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer)7 Player (org.bukkit.entity.Player)5 PacketPlayOutTitle (net.minecraft.server.v1_9_R2.PacketPlayOutTitle)4 CraftWorld (org.bukkit.craftbukkit.v1_9_R2.CraftWorld)4 UUID (java.util.UUID)3 BlockPosition (net.minecraft.server.v1_9_R2.BlockPosition)3 HashSet (java.util.HashSet)2 Set (java.util.Set)2 CompoundTag_v1_9_R2 (net.aufdemrand.denizen.nms.impl.jnbt.CompoundTag_v1_9_R2)2 World (net.minecraft.server.v1_7_R4.World)2 net.minecraft.server.v1_9_R2 (net.minecraft.server.v1_9_R2)2 IBlockData (net.minecraft.server.v1_9_R2.IBlockData)2 CraftEntity (org.bukkit.craftbukkit.v1_9_R2.entity.CraftEntity)2 GameProfile (com.mojang.authlib.GameProfile)1 Property (com.mojang.authlib.properties.Property)1 BigInteger (java.math.BigInteger)1 MessageDigest (java.security.MessageDigest)1 CraftFakePlayer_v1_9_R2 (net.aufdemrand.denizen.nms.impl.entities.CraftFakePlayer_v1_9_R2)1 EntityFakePlayer_v1_9_R2 (net.aufdemrand.denizen.nms.impl.entities.EntityFakePlayer_v1_9_R2)1 PlayerProfile (net.aufdemrand.denizen.nms.util.PlayerProfile)1