Fixed some types of entities
This commit is contained in:
parent
5198d64ab8
commit
c685486086
|
@ -1,9 +1,19 @@
|
||||||
package mineplex.core.gadget.gadgets.balloons;
|
package mineplex.core.gadget.gadgets.balloons;
|
||||||
|
|
||||||
import org.bukkit.entity.Ageable;
|
import org.bukkit.entity.Ageable;
|
||||||
|
import org.bukkit.entity.Bat;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Zombie;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.creature.Creature;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseArmorStand;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseWither;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
import mineplex.core.gadget.types.BalloonGadget;
|
import mineplex.core.gadget.types.BalloonGadget;
|
||||||
|
|
||||||
|
@ -24,10 +34,56 @@ public class BalloonItem extends BalloonGadget
|
||||||
@Override
|
@Override
|
||||||
public Entity spawnEntity(Player player)
|
public Entity spawnEntity(Player player)
|
||||||
{
|
{
|
||||||
|
if (_balloonType.equals(BalloonType.BABY_WIDDER))
|
||||||
|
{
|
||||||
|
Creature creatureModule = Manager.getPetManager().getCreatureModule();
|
||||||
|
creatureModule.SetForce(true);
|
||||||
|
Entity silverfish = player.getWorld().spawnEntity(player.getLocation(), _balloonType.getEntityType());
|
||||||
|
UtilEnt.silence(silverfish, true);
|
||||||
|
|
||||||
|
DisguiseWither witherDisguise = new DisguiseWither(silverfish);
|
||||||
|
|
||||||
|
witherDisguise.setInvulTime(530);
|
||||||
|
|
||||||
|
org.bukkit.entity.Creature silver = (org.bukkit.entity.Creature) creatureModule.SpawnEntity(player.getLocation(), EntityType.SILVERFISH);
|
||||||
|
UtilEnt.Vegetate(silver, true);
|
||||||
|
UtilEnt.silence(silver, true);
|
||||||
|
silver.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0));
|
||||||
|
silverfish.setPassenger(silver);
|
||||||
|
|
||||||
|
Manager.getDisguiseManager().disguise(witherDisguise);
|
||||||
|
|
||||||
|
creatureModule.SetForce(false);
|
||||||
|
|
||||||
|
return silver;
|
||||||
|
}
|
||||||
|
else if (_balloonType.getEntityType().equals(EntityType.ARMOR_STAND))
|
||||||
|
{
|
||||||
|
Entity bat = player.getWorld().spawn(player.getLocation(), Bat.class);
|
||||||
|
((LivingEntity) bat).addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false));
|
||||||
|
UtilEnt.silence(bat, true);
|
||||||
|
|
||||||
|
DisguiseArmorStand disguiseArmorStand = new DisguiseArmorStand(bat);
|
||||||
|
disguiseArmorStand.setHelmet(_balloonType.getDisplayItem());
|
||||||
|
disguiseArmorStand.setInvisible(true);
|
||||||
|
if (_balloonType.isBaby()) disguiseArmorStand.setSmall();
|
||||||
|
disguiseArmorStand.setGravityEffected();
|
||||||
|
|
||||||
|
Manager.getDisguiseManager().disguise(disguiseArmorStand);
|
||||||
|
|
||||||
|
return bat;
|
||||||
|
}
|
||||||
|
else if (_balloonType.equals(BalloonType.BABY_ZOMBIE))
|
||||||
|
{
|
||||||
|
Zombie zombie = player.getWorld().spawn(player.getLocation(), Zombie.class);
|
||||||
|
zombie.setBaby(true);
|
||||||
|
return zombie;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Entity entity = player.getWorld().spawnEntity(player.getLocation(), _balloonType.getEntityType());
|
Entity entity = player.getWorld().spawnEntity(player.getLocation(), _balloonType.getEntityType());
|
||||||
if (_balloonType.isBaby() && entity instanceof Ageable)
|
if (_balloonType.isBaby() && entity instanceof Ageable)
|
||||||
((Ageable) entity).setBaby();
|
((Ageable) entity).setBaby();
|
||||||
//((LivingEntity) entity).setLeashHolder(player);
|
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -624,4 +624,9 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||||
return _activePetOwners.values();
|
return _activePetOwners.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public mineplex.core.creature.Creature getCreatureModule()
|
||||||
|
{
|
||||||
|
return _creatureModule;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue