This commit is contained in:
libraryaddict 2015-10-17 00:08:30 +13:00
parent f71cb80bd0
commit 14a524cf54
5 changed files with 49 additions and 11 deletions

View File

@ -158,11 +158,13 @@ public class UtilParticle
{
this.particleName = particleName;
_friendlyData = false;
this.particle = particle;
}
ParticleType(EnumParticle particle, String particleName, String friendlyName, Material material, byte data)
{
this.particleName = particleName;
this.particle = particle;
_friendlyData = true;
_friendlyName = friendlyName;
_material = material;

View File

@ -1,14 +1,19 @@
package mineplex.core.disguise.disguises;
import mineplex.core.common.*;
import mineplex.core.common.util.UtilPlayer;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
import net.minecraft.server.v1_8_R3.IntHashMap;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
import net.minecraft.server.v1_8_R3.WorldServer;
public abstract class DisguiseBase
{
@ -53,6 +58,24 @@ public abstract class DisguiseBase
return new PacketPlayOutEntityMetadata(Entity.getId(), DataWatcher, true);
}
public void resendMetadata()
{
if (Entity == null || !Entity.getBukkitEntity().isValid() || !(Entity.world instanceof WorldServer))
return;
IntHashMap<EntityTrackerEntry> tracker = ((WorldServer) Entity.world).tracker.trackedEntities;
if (tracker.get(Entity.getId()) == null)
return;
Packet packet = GetMetaDataPacket();
for (EntityPlayer player : tracker.get(Entity.getId()).trackedPlayers)
{
UtilPlayer.sendPacket(player.getBukkitEntity(), packet);
}
}
public void setSoundDisguise(DisguiseBase soundDisguise)
{
_soundDisguise = soundDisguise;

View File

@ -184,6 +184,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
Entity silverfish = _creatureModule.SpawnEntity(location, EntityType.SILVERFISH);
UtilEnt.Vegetate(silverfish, true);
UtilEnt.silence(pet, true);
((LivingEntity) silverfish).addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0));
pet.setPassenger(silverfish);
}

View File

@ -13,6 +13,8 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTextTop;
import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseWither;
import mineplex.core.gadget.gadgets.MorphWither;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
@ -394,10 +396,13 @@ public class NewsManager extends MiniPlugin
//Fix Entity Names
for (Creature pet : Manager.getPetManager().getPets())
{
if (pet instanceof Wither)
{
pet.setCustomName(text);
}
DisguiseBase disguise = Manager.GetDisguise().getDisguise(pet);
if (disguise instanceof DisguiseWither)
{
((DisguiseWither) disguise).setName(text);
disguise.resendMetadata();
}
}
for (Mount mount : Manager.GetMount().getMounts())

View File

@ -13,6 +13,9 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTextTop;
import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseLiving;
import mineplex.core.disguise.disguises.DisguiseWither;
import mineplex.core.gadget.gadgets.MorphWither;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
@ -86,13 +89,17 @@ public class GameManager implements Listener
UtilTextTop.displayProgress(text, health, UtilServer.getPlayers());
for (Creature pet : Manager.getCosmeticManager().getPetManager().getPets())
{
if (pet instanceof Wither)
{
pet.setCustomName(text);
pet.setHealth(Math.max(0.1, 300 * health));
}
}
{
DisguiseBase disguise = Manager.GetDisguise().getDisguise(pet);
if (disguise instanceof DisguiseWither)
{
((DisguiseWither) disguise).setName(text);
((DisguiseLiving) disguise).setHealth((float) Math.max(0.1,
300 * health));
disguise.resendMetadata();
}
}
//Name Dragons Appropriately
for (Mount mount : Manager.getCosmeticManager().getMountManager().getMounts())