Refactored disguises to use EntityType

This commit is contained in:
CoderTim 2014-05-27 17:49:45 -04:00
parent 49de140f41
commit 091166f090
25 changed files with 101 additions and 161 deletions

View File

@ -1,10 +1,12 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public abstract class DisguiseAgeable extends DisguiseCreature
{
public DisguiseAgeable(org.bukkit.entity.Entity entity)
public DisguiseAgeable(EntityType disguiseType, org.bukkit.entity.Entity entity)
{
super(entity);
super(disguiseType, entity);
DataWatcher.a(12, new Integer(0));
}

View File

@ -1,9 +1,11 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public abstract class DisguiseAnimal extends DisguiseAgeable
{
public DisguiseAnimal(org.bukkit.entity.Entity entity)
public DisguiseAnimal(EntityType disguiseType, org.bukkit.entity.Entity entity)
{
super(entity);
super(disguiseType, entity);
}
}

View File

@ -1,10 +1,12 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public class DisguiseBat extends DisguiseAnimal
{
public DisguiseBat(org.bukkit.entity.Entity entity)
{
super(entity);
super(EntityType.BAT, entity);
DataWatcher.a(16, new Byte((byte)0));
}
@ -23,12 +25,6 @@ public class DisguiseBat extends DisguiseAnimal
DataWatcher.watch(16, Byte.valueOf((byte)(i & 0xFFFFFFFE)));
}
@Override
protected int GetEntityTypeId()
{
return 65;
}
public String getHurtSound()
{
return "mob.bat.hurt";

View File

@ -1,19 +1,15 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public class DisguiseBlaze extends DisguiseMonster
{
public DisguiseBlaze(org.bukkit.entity.Entity entity)
{
super(entity);
super(EntityType.BLAZE, entity);
DataWatcher.a(16, new Byte((byte)0));
}
@Override
protected int GetEntityTypeId()
{
return 61;
}
public boolean bT()
{

View File

@ -1,10 +1,12 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public class DisguiseCat extends DisguiseTameableAnimal
{
public DisguiseCat(org.bukkit.entity.Entity entity)
{
super(entity);
super(EntityType.OCELOT, entity);
DataWatcher.a(18, Byte.valueOf((byte)0));
}
@ -19,12 +21,6 @@ public class DisguiseCat extends DisguiseTameableAnimal
DataWatcher.watch(18, Byte.valueOf((byte)i));
}
@Override
protected int GetEntityTypeId()
{
return 98;
}
protected String getHurtSound()
{
return "mob.cat.hitt";

View File

@ -1,16 +1,12 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public class DisguiseChicken extends DisguiseAnimal
{
public DisguiseChicken(org.bukkit.entity.Entity entity)
{
super(entity);
}
@Override
protected int GetEntityTypeId()
{
return 93;
super(EntityType.CHICKEN, entity);
}
public String getHurtSound()

View File

@ -1,16 +1,12 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public class DisguiseCow extends DisguiseAnimal
{
public DisguiseCow(org.bukkit.entity.Entity entity)
{
super(entity);
}
@Override
protected int GetEntityTypeId()
{
return 92;
super(EntityType.COW, entity);
}
public String getHurtSound()

View File

@ -4,21 +4,30 @@ import net.minecraft.server.v1_7_R3.EnumEntitySize;
import net.minecraft.server.v1_7_R3.MathHelper;
import net.minecraft.server.v1_7_R3.Packet;
import net.minecraft.server.v1_7_R3.PacketPlayOutSpawnEntityLiving;
import org.bukkit.entity.*;
public abstract class DisguiseCreature extends DisguiseInsentient
{
public DisguiseCreature(org.bukkit.entity.Entity entity)
private final EntityType _disguiseType;
public DisguiseCreature(EntityType disguiseType, org.bukkit.entity.Entity entity)
{
super(entity);
_disguiseType = disguiseType;
}
protected abstract int GetEntityTypeId();
public EntityType getDisguiseType()
{
return _disguiseType;
}
@SuppressWarnings("deprecation")
public Packet GetSpawnPacket()
{
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
packet.a = Entity.getId();
packet.b = (byte) GetEntityTypeId();
packet.b = (byte) getDisguiseType().getTypeId();
packet.c = (int)EnumEntitySize.SIZE_2.a(Entity.locX);
packet.d = (int)MathHelper.floor(Entity.locY * 32.0D);
packet.e = (int)EnumEntitySize.SIZE_2.a(Entity.locZ);

View File

@ -1,20 +1,16 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public class DisguiseCreeper extends DisguiseMonster
{
public DisguiseCreeper(org.bukkit.entity.Entity entity)
{
super(entity);
super(EntityType.CREEPER, entity);
DataWatcher.a(16, Byte.valueOf((byte)-1));
DataWatcher.a(17, Byte.valueOf((byte)0));
}
@Override
protected int GetEntityTypeId()
{
return 50;
}
public boolean IsPowered()
{

View File

@ -5,12 +5,13 @@ import java.util.Arrays;
import net.minecraft.server.v1_7_R3.MobEffect;
import net.minecraft.server.v1_7_R3.MobEffectList;
import net.minecraft.server.v1_7_R3.PotionBrewer;
import org.bukkit.entity.*;
public class DisguiseEnderman extends DisguiseMonster
{
public DisguiseEnderman(org.bukkit.entity.Entity entity)
{
super(entity);
super(EntityType.ENDERMAN, entity);
DataWatcher.a(16, new Byte((byte)0));
DataWatcher.a(17, new Byte((byte)0));
@ -51,12 +52,6 @@ public class DisguiseEnderman extends DisguiseMonster
DataWatcher.watch(18, Byte.valueOf((byte)(flag ? 1 : 0)));
}
@Override
protected int GetEntityTypeId()
{
return 58;
}
protected String getHurtSound()
{
return "mob.endermen.hit";

View File

@ -1,9 +1,11 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public abstract class DisguiseGolem extends DisguiseCreature
{
public DisguiseGolem(org.bukkit.entity.Entity entity)
public DisguiseGolem(EntityType disguiseType, org.bukkit.entity.Entity entity)
{
super(entity);
super(disguiseType, entity);
}
}

View File

@ -1,12 +1,12 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.Horse;
import org.bukkit.entity.*;
public class DisguiseHorse extends DisguiseAnimal
{
public DisguiseHorse(org.bukkit.entity.Entity entity)
{
super(entity);
super(EntityType.HORSE, entity);
DataWatcher.a(16, Integer.valueOf(0));
DataWatcher.a(19, Byte.valueOf((byte) 0));
@ -15,12 +15,6 @@ public class DisguiseHorse extends DisguiseAnimal
DataWatcher.a(22, Integer.valueOf(0));
}
@Override
protected int GetEntityTypeId()
{
return 100;
}
public void setType(Horse.Variant horseType)
{
DataWatcher.watch(19, Byte.valueOf((byte) horseType.ordinal()));

View File

@ -1,19 +1,15 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public class DisguiseIronGolem extends DisguiseGolem
{
public DisguiseIronGolem(org.bukkit.entity.Entity entity)
{
super(entity);
super(EntityType.IRON_GOLEM, entity);
DataWatcher.a(16, Byte.valueOf((byte)0));
}
@Override
protected int GetEntityTypeId()
{
return 99;
}
public boolean bW()
{

View File

@ -1,9 +1,11 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public abstract class DisguiseMonster extends DisguiseCreature
{
public DisguiseMonster(org.bukkit.entity.Entity entity)
public DisguiseMonster(EntityType disguiseType, org.bukkit.entity.Entity entity)
{
super(entity);
super(disguiseType, entity);
}
}

View File

@ -1,16 +1,12 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public class DisguisePig extends DisguiseAnimal
{
public DisguisePig(org.bukkit.entity.Entity entity)
{
super(entity);
}
@Override
protected int GetEntityTypeId()
{
return 90;
super(EntityType.PIG, entity);
}
public String getHurtSound()

View File

@ -1,16 +1,12 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public class DisguisePigZombie extends DisguiseZombie
{
public DisguisePigZombie(org.bukkit.entity.Entity entity)
{
super(entity);
}
@Override
public int GetEntityTypeId()
{
return 57;
super(EntityType.PIG_ZOMBIE, entity);
}
protected String getHurtSound()

View File

@ -1,21 +1,16 @@
package mineplex.core.disguise.disguises;
import org.bukkit.DyeColor;
import org.bukkit.entity.*;
public class DisguiseSheep extends DisguiseAnimal
{
public DisguiseSheep(org.bukkit.entity.Entity entity)
{
super(entity);
super(EntityType.SHEEP, entity);
DataWatcher.a(16, new Byte((byte)0));
}
@Override
protected int GetEntityTypeId()
{
return 91;
}
public boolean isSheared()
{

View File

@ -1,21 +1,16 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
import org.bukkit.entity.Skeleton.SkeletonType;
public class DisguiseSkeleton extends DisguiseMonster
{
public DisguiseSkeleton(org.bukkit.entity.Entity entity)
{
super(entity);
super(EntityType.SKELETON, entity);
DataWatcher.a(13, Byte.valueOf((byte)0));
}
@Override
protected int GetEntityTypeId()
{
return 51;
}
public void SetSkeletonType(SkeletonType skeletonType)
{

View File

@ -1,15 +1,11 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public class DisguiseSnowman extends DisguiseGolem
{
public DisguiseSnowman(org.bukkit.entity.Entity entity)
{
super(entity);
}
@Override
protected int GetEntityTypeId()
{
return 97;
super(EntityType.SNOWMAN, entity);
}
}

View File

@ -1,15 +1,17 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public class DisguiseSpider extends DisguiseMonster
{
public DisguiseSpider(org.bukkit.entity.Entity entity)
{
super(entity);
DataWatcher.a(16, new Byte((byte)0));
super(EntityType.SPIDER, entity);
DataWatcher.a(16, new Byte((byte) 0));
}
public boolean bT()
public boolean bT()
{
return (DataWatcher.getByte(16) & 0x01) != 0;
}
@ -17,23 +19,17 @@ public class DisguiseSpider extends DisguiseMonster
public void a(boolean flag)
{
byte b0 = DataWatcher.getByte(16);
if (flag)
b0 = (byte)(b0 | 0x1);
if(flag)
b0 = (byte) (b0 | 0x1);
else
b0 = (byte)(b0 & 0xFFFFFFFE);
b0 = (byte) (b0 & 0xFFFFFFFE);
DataWatcher.watch(16, Byte.valueOf(b0));
}
@Override
protected int GetEntityTypeId()
protected String getHurtSound()
{
return 52;
return "mob.spider.say";
}
protected String getHurtSound()
{
return "mob.spider.say";
}
}

View File

@ -1,10 +1,12 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public class DisguiseSquid extends DisguiseMonster
{
public DisguiseSquid(org.bukkit.entity.Entity entity)
{
super(entity);
super(EntityType.SQUID, entity);
DataWatcher.a(16, new Byte((byte)0));
}
@ -26,12 +28,6 @@ public class DisguiseSquid extends DisguiseMonster
DataWatcher.watch(16, Byte.valueOf(b0));
}
@Override
protected int GetEntityTypeId()
{
return 94;
}
protected String getHurtSound()
{
return "damage.hit";

View File

@ -1,10 +1,12 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public abstract class DisguiseTameableAnimal extends DisguiseAnimal
{
public DisguiseTameableAnimal(org.bukkit.entity.Entity entity)
public DisguiseTameableAnimal(EntityType disguiseType, org.bukkit.entity.Entity entity)
{
super(entity);
super(disguiseType, entity);
DataWatcher.a(16, Byte.valueOf((byte)0));
DataWatcher.a(17, "");

View File

@ -1,19 +1,15 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public class DisguiseWitch extends DisguiseMonster
{
public DisguiseWitch(org.bukkit.entity.Entity entity)
{
super(entity);
super(EntityType.WITCH, entity);
DataWatcher.a(21, Byte.valueOf((byte)0));
}
@Override
protected int GetEntityTypeId()
{
return 66;
}
public String getHurtSound()
{

View File

@ -1,12 +1,13 @@
package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_7_R3.BlockCloth;
import org.bukkit.entity.*;
public class DisguiseWolf extends DisguiseTameableAnimal
{
public DisguiseWolf(org.bukkit.entity.Entity entity)
{
super(entity);
super(EntityType.WOLF, entity);
DataWatcher.a(18, new Float(20F));
DataWatcher.a(19, new Byte((byte)0));
@ -51,12 +52,6 @@ public class DisguiseWolf extends DisguiseTameableAnimal
return DataWatcher.getByte(19) == 1;
}
@Override
protected int GetEntityTypeId()
{
return 95;
}
protected String getHurtSound()
{
return "mob.wolf.hurt";

View File

@ -1,23 +1,22 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.Entity;
import org.bukkit.entity.*;
public class DisguiseZombie extends DisguiseMonster
{
public DisguiseZombie(Entity entity)
{
super(entity);
this(EntityType.ZOMBIE, entity);
}
public DisguiseZombie(EntityType disguiseType, Entity entity)
{
super(disguiseType, entity);
DataWatcher.a(12, Byte.valueOf((byte)0));
DataWatcher.a(13, Byte.valueOf((byte)0));
DataWatcher.a(14, Byte.valueOf((byte)0));
}
@Override
protected int GetEntityTypeId()
{
return 54;
}
public boolean IsBaby()
{