Fix fireball, giant, ghast and items

This commit is contained in:
Andrew 2013-05-30 08:46:51 +12:00
parent 1a3ab9379a
commit 3c51dae83b
4 changed files with 16 additions and 15 deletions

View File

@ -67,8 +67,6 @@ public class Disguise {
} else if (getType().isMob()) {
// entity = ((MobDisguise) this).getEntityLiving(((CraftEntity) e).getHandle().world, e.getLocation(),
// e.getEntityId());
double d1 = 3.9D;
Vector vec = e.getVelocity();
double d2 = vec.getX();
@ -100,11 +98,11 @@ public class Disguise {
} else if (disguiseType == DisguiseType.SPLASH_POTION)
name = "Potion";
else if (disguiseType == DisguiseType.GIANT)
name = "Giant Zombie";
name = "GiantZombie";
else if (disguiseType == DisguiseType.DROPPED_ITEM)
name = "Item";
else if (disguiseType == DisguiseType.FIREBALL)
name = "Large Fireball";
name = "LargeFireball";
try {
Class entityClass = Class.forName("net.minecraft.server.v1_5_R3.Entity" + name);
Field field = EntityTypes.class.getDeclaredField("e");
@ -124,6 +122,8 @@ public class Disguise {
byte yawValue = (byte) (int) (entity.yaw * 256.0F / 360.0F);
if (getType() == DisguiseType.ENDER_DRAGON)
yawValue -= 128;
else if (getType() == DisguiseType.GHAST)
yawValue += 64;
mods.write(8, yawValue);
mods.write(9, (byte) (int) (entity.pitch * 256.0F / 360.0F));
mods.write(10, (byte) (int) (((EntityLiving) entity).aA * 256.0F / 360.0F));
@ -132,7 +132,6 @@ public class Disguise {
} else if (getType().isMisc()) {
// getEntity(((CraftEntity) e).getHandle().world, e.getLocation(), e.getEntityId());
int id = getType().getEntityId();
int data = 0;
if (((MiscDisguise) this).getId() >= 0)
@ -176,9 +175,6 @@ public class Disguise {
} else if (getType().isPlayer()) {
// EntityPlayer entityPlayer = (EntityPlayer) getEntity(((CraftEntity) e).getHandle().world, e.getLocation(),
// e.getEntityId());
// entityPlayer.name = ((PlayerDisguise) this).getName();
spawnPacket = manager.createPacket(Packets.Server.NAMED_ENTITY_SPAWN);
StructureModifier<Object> mods = spawnPacket.getModifier();
mods.write(0, e.getEntityId());

View File

@ -3,10 +3,13 @@ package me.libraryaddict.disguise.DisguiseTypes;
import java.util.HashMap;
import java.util.Set;
import org.bukkit.craftbukkit.v1_5_R3.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack;
public enum WatcherValues {
ARROW(16, (byte) 0), BAT(16, (byte) 0), BLAZE(16, (byte) 0), BOAT(19, 40, 17, 10, 18, 0), CAVE_SPIDER(), CHICKEN(12, 0), COW(
12, 0), CREEPER(16, (byte) 0, 17, (byte) 0), DROPPED_ITEM(), EGG(), ENDER_CRYSTAL(), ENDER_DRAGON(16, 300), ENDER_PEARL(), ENDER_SIGNAL(), ENDERMAN(
16, (byte) 0, 17, (byte) 1, 18, (byte) 0), EXPERIENCE_ORB(), FALLING_BLOCK(), FIREBALL(), FIREWORKS(), FISHING_HOOK(), GHAST(
12, 0), CREEPER(16, (byte) 0, 17, (byte) 0), DROPPED_ITEM(10, CraftItemStack.asNMSCopy(new ItemStack(1))), EGG(), ENDER_CRYSTAL(), ENDER_DRAGON(
16, 300), ENDER_PEARL(), ENDER_SIGNAL(), ENDERMAN(16, (byte) 0, 17, (byte) 1, 18, (byte) 0), EXPERIENCE_ORB(), FALLING_BLOCK(), FIREBALL(), FIREWORKS(), FISHING_HOOK(), GHAST(
16, (byte) 0), GIANT(), IRON_GOLEM(), ITEM_FRAME(2, 5, 3, (byte) 0), MAGMA_CUBE(16, (byte) 0, 18, (byte) 0), MINECART_CHEST(
16, (byte) 0, 17, 0, 18, 1, 19, 0, 20, 0, 21, 6, 22, (byte) 0), MINECART_FURNACE(16, (byte) 0, 17, 0, 18, 1, 19, 0,
20, 0, 21, 6, 22, (byte) 0), MINECART_HOPPER(16, (byte) 0, 17, 0, 18, 1, 19, 0, 20, 0, 21, 6, 22, (byte) 0), MINECART_MOB_SPAWNER(

View File

@ -5,9 +5,9 @@ import org.bukkit.inventory.ItemStack;
import me.libraryaddict.disguise.DisguiseTypes.FlagWatcher;
public class ItemWatcher extends FlagWatcher {
public class DroppedItemWatcher extends FlagWatcher {
public ItemWatcher(int entityId) {
public DroppedItemWatcher(int entityId) {
super(entityId);
setValue(10, CraftItemStack.asNMSCopy(new ItemStack(1)));
}

View File

@ -89,12 +89,14 @@ public class LibsDisguises extends JavaPlugin {
if (disguise.getType() == DisguiseType.ENDER_DRAGON) {
byte value = (Byte) mods.read(4);
mods.write(4, (byte) (value - 128));
} else if (disguise.getType().isMisc()) {
} else if (disguise.getType().isMisc() || disguise.getType() == DisguiseType.GHAST) {
byte value = (Byte) mods.read(4);
if (disguise.getType() != DisguiseType.PAINTING)
mods.write(4, (byte) (value + 64));
mods.write(4, (byte) (value + 128));
else if (disguise.getType().isMisc())
mods.write(4, (byte) -(value + 128));
else
mods.write(4, (byte) -(value += 128));
mods.write(4, (byte) (value - 64));
}
}
}