Fixed Leash issue.

Added invis for utilent.ghost
This commit is contained in:
Jonathan Williams 2013-12-21 02:44:12 -05:00
parent 50c2b10b50
commit 70c14268e1
13 changed files with 41 additions and 34 deletions

Binary file not shown.

View File

@ -47,15 +47,17 @@ public class UtilEnt
return _nameMap; return _nameMap;
} }
public static void ghost(Entity entity, boolean ghost) public static void ghost(Entity entity, boolean ghost, boolean invisible)
{ {
if (entity instanceof LivingEntity) if (entity instanceof LivingEntity)
{ {
((CraftLivingEntity)entity).getHandle().ghost = ghost; ((CraftLivingEntity)entity).getHandle().ghost = ghost;
} }
((CraftEntity)entity).getHandle().Invisible = invisible;
} }
public static void Leash(Entity leashed, Entity holder, boolean pull, boolean breakable) public static void Leash(LivingEntity leashed, Entity holder, boolean pull, boolean breakable)
{ {
if (((CraftEntity)leashed).getHandle() instanceof EntityInsentient) if (((CraftEntity)leashed).getHandle() instanceof EntityInsentient)
{ {
@ -64,6 +66,8 @@ public class UtilEnt
creature.PullWhileLeashed = pull; creature.PullWhileLeashed = pull;
creature.BreakLeash = breakable; creature.BreakLeash = breakable;
} }
leashed.setLeashHolder(holder);
} }
public static void Vegetate(Entity entity) public static void Vegetate(Entity entity)

View File

@ -148,6 +148,8 @@ public abstract class Entity {
public EnumEntitySize at; public EnumEntitySize at;
public boolean valid; // CraftBukkit public boolean valid; // CraftBukkit
public boolean Invisible;
public Entity(World world) { public Entity(World world) {
this.id = entityCount++; this.id = entityCount++;
this.l = 1.0D; this.l = 1.0D;
@ -1558,6 +1560,10 @@ public abstract class Entity {
} }
public void setInvisible(boolean flag) { public void setInvisible(boolean flag) {
if (Invisible && !flag)
return;
this.a(5, flag); this.a(5, flag);
} }

View File

@ -21,6 +21,7 @@ import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
import org.bukkit.entity.Chicken; import org.bukkit.entity.Chicken;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock; import org.bukkit.entity.FallingBlock;
@ -52,7 +53,7 @@ public class Sleigh
CentralEntity = loc.getWorld().spawn(loc, Chicken.class); CentralEntity = loc.getWorld().spawn(loc, Chicken.class);
UtilEnt.Vegetate(CentralEntity); UtilEnt.Vegetate(CentralEntity);
UtilEnt.ghost(CentralEntity, true); UtilEnt.ghost(CentralEntity, true, true);
//Presents //Presents
PresentSlots = new ArrayList<SleighPart>(); PresentSlots = new ArrayList<SleighPart>();
@ -141,6 +142,11 @@ public class Sleigh
for (SleighHorse horse : SleighHorses) for (SleighHorse horse : SleighHorses)
UtilEnt.Leash(horse.Ent, santa.GetTop(), false, false); UtilEnt.Leash(horse.Ent, santa.GetTop(), false, false);
for (SleighPart part : SleighEnts)
{
((CraftEntity)part.Ent).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 32));
}
} }
public Location GetLocation() public Location GetLocation()

View File

@ -19,7 +19,7 @@ public class SleighHorse
Ent = loc.getWorld().spawn(loc.add(x, 0, z), Horse.class); Ent = loc.getWorld().spawn(loc.add(x, 0, z), Horse.class);
UtilEnt.Vegetate(Ent); UtilEnt.Vegetate(Ent);
UtilEnt.ghost(Ent, true); UtilEnt.ghost(Ent, true, false);
Ent.setStyle(Style.WHITE_DOTS); Ent.setStyle(Style.WHITE_DOTS);
Ent.setColor(Color.CHESTNUT); Ent.setColor(Color.CHESTNUT);

View File

@ -4,6 +4,8 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import net.minecraft.server.v1_6_R3.MobEffect;
import net.minecraft.server.v1_6_R3.MobEffectList;
import net.minecraft.server.v1_6_R3.Packet40EntityMetadata; import net.minecraft.server.v1_6_R3.Packet40EntityMetadata;
import org.bukkit.Color; import org.bukkit.Color;
@ -11,6 +13,7 @@ import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftFallingSand; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftFallingSand;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
import org.bukkit.entity.Chicken; import org.bukkit.entity.Chicken;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -35,7 +38,7 @@ public class SleighPart
Ent.setBaby(); Ent.setBaby();
Ent.setAgeLock(true); Ent.setAgeLock(true);
UtilEnt.Vegetate(Ent); UtilEnt.Vegetate(Ent);
UtilEnt.ghost(Ent, true); UtilEnt.ghost(Ent, true, true);
//Height //Height
Chicken top = Ent; Chicken top = Ent;
@ -45,18 +48,12 @@ public class SleighPart
newTop.setBaby(); newTop.setBaby();
newTop.setAgeLock(true); newTop.setAgeLock(true);
UtilEnt.Vegetate(newTop); UtilEnt.Vegetate(newTop);
UtilEnt.ghost(newTop, true); UtilEnt.ghost(newTop, true, true);
top.setPassenger(newTop); top.setPassenger(newTop);
top = newTop; top = newTop;
} }
//Invis
((CraftEntity)Ent).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 32));
for (Player player : UtilServer.getPlayers())
((CraftPlayer)player).getHandle().playerConnection.sendPacket(new Packet40EntityMetadata(Ent.getEntityId(), ((CraftEntity)Ent).getHandle().getDataWatcher(), true));
//Block //Block
if (id != 0) if (id != 0)
{ {
@ -105,7 +102,7 @@ public class SleighPart
Skeleton skel = Ent.getWorld().spawn(Ent.getLocation().add(0, 1, 0), Skeleton.class); Skeleton skel = Ent.getWorld().spawn(Ent.getLocation().add(0, 1, 0), Skeleton.class);
UtilEnt.Vegetate(skel); UtilEnt.Vegetate(skel);
UtilEnt.ghost(skel, true); UtilEnt.ghost(skel, true, false);
ItemStack head = new ItemStack(Material.LEATHER_HELMET); ItemStack head = new ItemStack(Material.LEATHER_HELMET);
LeatherArmorMeta meta = (LeatherArmorMeta)head.getItemMeta(); LeatherArmorMeta meta = (LeatherArmorMeta)head.getItemMeta();

View File

@ -117,7 +117,7 @@ public class BossSnowmanPattern
Location loc = _spawnA.get(i); Location loc = _spawnA.get(i);
Snowman ent = loc.getWorld().spawn(loc, Snowman.class); Snowman ent = loc.getWorld().spawn(loc, Snowman.class);
UtilEnt.Vegetate(ent); UtilEnt.Vegetate(ent);
UtilEnt.ghost(ent, true); UtilEnt.ghost(ent, true, false);
_ents.add(new BossSnowman(ent, loc, _aDir)); _ents.add(new BossSnowman(ent, loc, _aDir));
} }
@ -130,7 +130,7 @@ public class BossSnowmanPattern
Location loc = _spawnB.get(i); Location loc = _spawnB.get(i);
Snowman ent = loc.getWorld().spawn(loc, Snowman.class); Snowman ent = loc.getWorld().spawn(loc, Snowman.class);
UtilEnt.Vegetate(ent); UtilEnt.Vegetate(ent);
UtilEnt.ghost(ent, true); UtilEnt.ghost(ent, true, false);
_ents.add(new BossSnowman(ent, loc, _bDir)); _ents.add(new BossSnowman(ent, loc, _bDir));
} }

View File

@ -31,7 +31,7 @@ public class CaveGiant
_ent = loc.getWorld().spawn(loc, Giant.class); _ent = loc.getWorld().spawn(loc, Giant.class);
Host.Host.CreatureAllowOverride = false; Host.Host.CreatureAllowOverride = false;
UtilEnt.Vegetate(_ent); UtilEnt.Vegetate(_ent);
UtilEnt.ghost(_ent, true); UtilEnt.ghost(_ent, true, false);
_tpLoc = _ent.getLocation(); _tpLoc = _ent.getLocation();

View File

@ -45,7 +45,7 @@ public class PumpkinKing
_ent = loc.getWorld().spawn(loc, Skeleton.class); _ent = loc.getWorld().spawn(loc, Skeleton.class);
Host.Host.CreatureAllowOverride = false; Host.Host.CreatureAllowOverride = false;
UtilEnt.Vegetate(_ent); UtilEnt.Vegetate(_ent);
UtilEnt.ghost(_ent, true); UtilEnt.ghost(_ent, true, false);
_ent.setSkeletonType(SkeletonType.WITHER); _ent.setSkeletonType(SkeletonType.WITHER);
_ent.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); _ent.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN));

View File

@ -97,7 +97,7 @@ public class SnowmanWaveA
Snowman ent = loc.getWorld().spawn(loc, Snowman.class); Snowman ent = loc.getWorld().spawn(loc, Snowman.class);
Host.CreatureAllowOverride = false; Host.CreatureAllowOverride = false;
UtilEnt.Vegetate(ent); UtilEnt.Vegetate(ent);
UtilEnt.ghost(ent, true); UtilEnt.ghost(ent, true, false);
_ents.add(ent); _ents.add(ent);
} }
} }

View File

@ -94,7 +94,7 @@ public class SnowmanWaveB
Snowman ent = loc.getWorld().spawn(loc, Snowman.class); Snowman ent = loc.getWorld().spawn(loc, Snowman.class);
Host.CreatureAllowOverride = false; Host.CreatureAllowOverride = false;
UtilEnt.Vegetate(ent); UtilEnt.Vegetate(ent);
UtilEnt.ghost(ent, true); UtilEnt.ghost(ent, true, false);
_ents.add(ent); _ents.add(ent);
} }
} }

View File

@ -78,19 +78,13 @@ public class Part1 extends Part
@EventHandler @EventHandler
public void Update(UpdateEvent event) public void Update(UpdateEvent event)
{ {
if (event.getType() == UpdateType.FAST) if (event.getType() != UpdateType.FAST)
return;
UpdatePresents(); UpdatePresents();
if (event.getType() == UpdateType.FAST)
UpdateIgnite(); UpdateIgnite();
if (event.getType() == UpdateType.FAST)
UpdateExplode(); UpdateExplode();
if (event.getType() == UpdateType.FAST)
UpdateClear(); UpdateClear();
if (event.getType() == UpdateType.FAST)
UpdateSkeleton(); UpdateSkeleton();
} }

View File

@ -126,7 +126,7 @@ public abstract class Kit implements Listener
} }
UtilEnt.Vegetate(entity); UtilEnt.Vegetate(entity);
UtilEnt.ghost(entity, true); UtilEnt.ghost(entity, true, false);
SpawnCustom(entity); SpawnCustom(entity);