Search in sources :

Example 1 with Shulker

use of org.bukkit.entity.Shulker in project HoloItemsAPI by StrangeOne101.

the class AbilityUtils method removeGhostBlock.

public static void removeGhostBlock(Block block) {
    if (GHOSTS.containsKey(block)) {
        Shulker shulker = GHOSTS.get(block);
        shulker.remove();
        GHOSTS.remove(block);
    }
}
Also used : Shulker(org.bukkit.entity.Shulker)

Example 2 with Shulker

use of org.bukkit.entity.Shulker in project SimplePets by brainsynder-Dev.

the class SpawnUtil method spawn.

public IEntityPet spawn(Location l, IPet pet, String className) {
    try {
        World mcWorld = ((CraftWorld) l.getWorld()).getHandle();
        EntityTypes<?> types = EntityUtils.getType((className.equals("EntityControllerPet")) ? EntityWrapper.ZOMBIE : pet.getEntityType());
        EntityPet customEntity = (EntityPet) petMap.get(className).getDeclaredConstructor(EntityTypes.class, World.class, IPet.class).newInstance(types, mcWorld, pet);
        customEntity.setInvisible(false);
        customEntity.setLocation(l.getX(), l.getY(), l.getZ(), l.getYaw(), l.getPitch());
        mcWorld.addEntity(customEntity, CreatureSpawnEvent.SpawnReason.CUSTOM);
        if (customEntity instanceof IEntityControllerPet) {
            if (pet.getPetType() instanceof ArmorStandDefault) {
                ArmorStand stand = EntityArmorStandPet.spawn(l, ((EntityControllerPet) customEntity));
                stand.setGravity(false);
                stand.setArms(true);
                stand.setCollidable(false);
                stand.setLeftLegPose(new EulerAngle(0.0D, 0.0D, 0.0D));
                stand.setRightLegPose(new EulerAngle(0.0D, 0.0D, 0.0D));
                stand.setLeftArmPose(new EulerAngle(0.0D, 0.0D, 0.0D));
                stand.setRightArmPose(new EulerAngle(0.0D, 0.0D, 0.0D));
                ((IEntityControllerPet) customEntity).setDisplayEntity(stand);
            } else if (pet.getPetType() instanceof ShulkerDefault) {
                ArmorStand stand = EntityGhostStandPet.spawn(l, pet);
                stand.setGravity(false);
                stand.setCollidable(false);
                stand.setSmall(true);
                Shulker shulker = EntityShulkerPet.spawn(l, (EntityControllerPet) customEntity);
                shulker.setAI(false);
                shulker.setCollidable(false);
                ((CraftEntity) stand).getHandle().passengers.add(0, ((CraftEntity) shulker).getHandle());
                ((IEntityControllerPet) customEntity).setDisplayEntity(stand);
            }
        }
        return customEntity;
    } catch (Exception e) {
        e.printStackTrace();
        throw new SimplePetsException("Could not summon the " + pet.getPetType().getConfigName() + " Pet", e);
    }
}
Also used : ShulkerDefault(simplepets.brainsynder.pet.types.ShulkerDefault) CraftEntity(org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity) CraftWorld(org.bukkit.craftbukkit.v1_13_R2.CraftWorld) World(net.minecraft.server.v1_13_R2.World) Shulker(org.bukkit.entity.Shulker) SimplePetsException(simplepets.brainsynder.errors.SimplePetsException) IEntityControllerPet(simplepets.brainsynder.api.entity.IEntityControllerPet) IEntityPet(simplepets.brainsynder.api.entity.IEntityPet) EntityControllerPet(simplepets.brainsynder.nms.v1_13_R2.entities.list.EntityControllerPet) IEntityControllerPet(simplepets.brainsynder.api.entity.IEntityControllerPet) ArmorStand(org.bukkit.entity.ArmorStand) ArmorStandDefault(simplepets.brainsynder.pet.types.ArmorStandDefault) SimplePetsException(simplepets.brainsynder.errors.SimplePetsException) EulerAngle(org.bukkit.util.EulerAngle) CraftWorld(org.bukkit.craftbukkit.v1_13_R2.CraftWorld)

Example 3 with Shulker

use of org.bukkit.entity.Shulker in project SimplePets by brainsynder-Dev.

the class SpawnUtil method spawn.

public IEntityPet spawn(Location l, IPet pet, String className) {
    try {
        World mcWorld = ((CraftWorld) l.getWorld()).getHandle();
        EntityPet customEntity = (EntityPet) petMap.get(className).getDeclaredConstructor(World.class, IPet.class).newInstance(mcWorld, pet);
        customEntity.setInvisible(false);
        customEntity.setLocation(l.getX(), l.getY(), l.getZ(), l.getYaw(), l.getPitch());
        mcWorld.addEntity(customEntity, CreatureSpawnEvent.SpawnReason.CUSTOM);
        if (customEntity instanceof IEntityControllerPet) {
            if (pet.getPetType() instanceof ArmorStandDefault) {
                ArmorStand stand = EntityArmorStandPet.spawn(l, ((EntityControllerPet) customEntity));
                stand.setGravity(false);
                stand.setArms(true);
                stand.setCollidable(false);
                stand.setLeftLegPose(new EulerAngle(0.0D, 0.0D, 0.0D));
                stand.setRightLegPose(new EulerAngle(0.0D, 0.0D, 0.0D));
                stand.setLeftArmPose(new EulerAngle(0.0D, 0.0D, 0.0D));
                stand.setRightArmPose(new EulerAngle(0.0D, 0.0D, 0.0D));
                ((IEntityControllerPet) customEntity).setDisplayEntity(stand);
            } else if (pet.getPetType() instanceof ShulkerDefault) {
                ArmorStand stand = EntityGhostStandPet.spawn(l, pet);
                stand.setGravity(false);
                stand.setCollidable(false);
                stand.setSmall(true);
                Shulker shulker = EntityShulkerPet.spawn(l, (EntityControllerPet) customEntity);
                shulker.setAI(false);
                shulker.setCollidable(false);
                ((CraftEntity) stand).getHandle().passengers.add(0, ((CraftEntity) shulker).getHandle());
                ((IEntityControllerPet) customEntity).setDisplayEntity(stand);
            }
        }
        return customEntity;
    } catch (Exception e) {
        e.printStackTrace();
        throw new SimplePetsException("Could not summon the " + pet.getPetType().getConfigName() + " Pet", e);
    }
}
Also used : ShulkerDefault(simplepets.brainsynder.pet.types.ShulkerDefault) CraftEntity(org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity) World(net.minecraft.server.v1_12_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_12_R1.CraftWorld) Shulker(org.bukkit.entity.Shulker) SimplePetsException(simplepets.brainsynder.errors.SimplePetsException) IEntityControllerPet(simplepets.brainsynder.api.entity.IEntityControllerPet) IEntityPet(simplepets.brainsynder.api.entity.IEntityPet) IEntityControllerPet(simplepets.brainsynder.api.entity.IEntityControllerPet) EntityControllerPet(simplepets.brainsynder.nms.v1_12_R1.entities.list.EntityControllerPet) ArmorStand(org.bukkit.entity.ArmorStand) ArmorStandDefault(simplepets.brainsynder.pet.types.ArmorStandDefault) SimplePetsException(simplepets.brainsynder.errors.SimplePetsException) EulerAngle(org.bukkit.util.EulerAngle) CraftWorld(org.bukkit.craftbukkit.v1_12_R1.CraftWorld)

Example 4 with Shulker

use of org.bukkit.entity.Shulker in project MagicPlugin by elBukkit.

the class EntityShulkerData method cycle.

@Override
public boolean cycle(Entity entity) {
    if (!canCycle(entity)) {
        return false;
    }
    Shulker shulker = (Shulker) entity;
    DyeColor dyeColor = shulker.getColor();
    DyeColor[] dyeColorValues = DyeColor.values();
    dyeColor = dyeColorValues[(dyeColor.ordinal() + 1) % dyeColorValues.length];
    shulker.setColor(dyeColor);
    return true;
}
Also used : Shulker(org.bukkit.entity.Shulker) DyeColor(org.bukkit.DyeColor)

Example 5 with Shulker

use of org.bukkit.entity.Shulker in project HoloItemsAPI by StrangeOne101.

the class AbilityUtils method createGhostBlock.

public static void createGhostBlock(Block block, ChatColor color) {
    Shulker shulker = block.getWorld().spawn(block.getLocation(), Shulker.class);
    shulker.setAI(false);
    shulker.setInvisible(true);
    shulker.setCollidable(false);
    shulker.setGlowing(true);
    shulker.setGravity(false);
    shulker.setSilent(true);
    shulker.getPersistentDataContainer().set(GHOST_KEY, PersistentDataType.BYTE, (byte) 1);
    if (color.isColor() && color != ChatColor.WHITE) {
        if (!TEAMS.containsKey(color)) {
            Team newTeam = GHOST_SCOREBOARD.registerNewTeam("ghost_" + color.toString().toLowerCase());
            newTeam.setColor(color);
            TEAMS.put(color, newTeam);
        }
        Team team = TEAMS.get(color);
        team.addEntry(shulker.getUniqueId().toString());
    }
    GHOSTS.put(block, shulker);
}
Also used : Team(org.bukkit.scoreboard.Team) Shulker(org.bukkit.entity.Shulker)

Aggregations

Shulker (org.bukkit.entity.Shulker)9 ArmorStand (org.bukkit.entity.ArmorStand)6 EulerAngle (org.bukkit.util.EulerAngle)6 IEntityControllerPet (simplepets.brainsynder.api.entity.IEntityControllerPet)6 IEntityPet (simplepets.brainsynder.api.entity.IEntityPet)6 SimplePetsException (simplepets.brainsynder.errors.SimplePetsException)6 ArmorStandDefault (simplepets.brainsynder.pet.types.ArmorStandDefault)6 ShulkerDefault (simplepets.brainsynder.pet.types.ShulkerDefault)6 World (net.minecraft.server.v1_11_R1.World)1 World (net.minecraft.server.v1_12_R1.World)1 World (net.minecraft.server.v1_13_R1.World)1 World (net.minecraft.server.v1_13_R2.World)1 World (net.minecraft.server.v1_14_R1.World)1 World (net.minecraft.server.v1_15_R1.World)1 DyeColor (org.bukkit.DyeColor)1 CraftWorld (org.bukkit.craftbukkit.v1_11_R1.CraftWorld)1 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)1 CraftEntity (org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity)1 CraftWorld (org.bukkit.craftbukkit.v1_13_R1.CraftWorld)1 CraftEntity (org.bukkit.craftbukkit.v1_13_R1.entity.CraftEntity)1