[Bleeding] Added EntityType to replace CreatureType.

This commit is contained in:
Celtic Minstrel 2012-02-06 00:19:23 -05:00 committed by EvilSeph
parent 7792156fb2
commit af51313ffb
49 changed files with 280 additions and 86 deletions

View File

@ -3,7 +3,7 @@ package net.minecraft.server;
// CraftBukkit start
import org.bukkit.Location;
import org.bukkit.entity.Animals;
import org.bukkit.entity.CreatureType;
import org.bukkit.entity.EntityType;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.event.player.PlayerEggThrowEvent;
// CraftBukkit end
@ -36,7 +36,7 @@ public class EntityEgg extends EntityProjectile {
numHatching = 0;
}
CreatureType hatchingType = CreatureType.CHICKEN;
EntityType hatchingType = EntityType.CHICKEN;
if (this.shooter instanceof EntityPlayer) {
org.bukkit.entity.Player player = (this.shooter == null) ? null : (org.bukkit.entity.Player) this.shooter.getBukkitEntity();
@ -46,7 +46,7 @@ public class EntityEgg extends EntityProjectile {
hatching = event.isHatching();
numHatching = event.getNumHatches();
hatchingType = event.getHatchType();
hatchingType = event.getHatchingType();
}
if (hatching) {

View File

@ -331,7 +331,12 @@ public class CraftWorld implements World {
return (Arrow) arrow.getBukkitEntity();
}
@Deprecated
public LivingEntity spawnCreature(Location loc, CreatureType creatureType) {
return spawnCreature(loc, creatureType.toEntityType());
}
public LivingEntity spawnCreature(Location loc, EntityType creatureType) {
Entity result = spawn(loc, creatureType.getEntityClass());
if (result == null) {

View File

@ -1,10 +1,12 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.server.TileEntityMobSpawner;
import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.entity.CreatureType;
import org.bukkit.entity.EntityType;
public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpawner {
private final CraftWorld world;
@ -17,25 +19,48 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
spawner = (TileEntityMobSpawner) world.getTileEntityAt(getX(), getY(), getZ());
}
@Deprecated
public CreatureType getCreatureType() {
return CreatureType.fromName(spawner.mobName);
}
public EntityType getSpawnedType() {
return EntityType.fromName(spawner.mobName);
}
@Deprecated
public void setCreatureType(CreatureType creatureType) {
spawner.mobName = creatureType.getName();
}
public void setSpawnedType(EntityType creatureType) {
if (!creatureType.isAlive() || !creatureType.isSpawnable()) {
throw new IllegalArgumentException("Can't spawn non-living entities from mob spawners!");
}
spawner.mobName = creatureType.getName();
}
public String getCreatureTypeId() {
return spawner.mobName;
}
public void setCreatureTypeId(String creatureType) {
@Deprecated
public void setCreatureTypeId(String creatureName) {
setCreatureTypeByName(creatureName);
}
public String getCreatureTypeName() {
return spawner.mobName;
}
public void setCreatureTypeByName(String creatureType) {
// Verify input
CreatureType type = CreatureType.fromName(creatureType);
EntityType type = EntityType.fromName(creatureType);
if (type == null) {
return;
}
spawner.mobName = type.getName();
setSpawnedType(type);
}
public int getDelay() {

View File

@ -4,6 +4,7 @@ import net.minecraft.server.EntityArrow;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
public class CraftArrow extends AbstractProjectile implements Arrow {
@ -35,4 +36,8 @@ public class CraftArrow extends AbstractProjectile implements Arrow {
public String toString() {
return "CraftArrow";
}
public EntityType getType() {
return EntityType.ARROW;
}
}

View File

@ -4,6 +4,7 @@ import net.minecraft.server.EntityBlaze;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Blaze;
import org.bukkit.entity.EntityType;
public class CraftBlaze extends CraftMonster implements Blaze {
public CraftBlaze(CraftServer server, EntityBlaze entity) {
@ -19,4 +20,8 @@ public class CraftBlaze extends CraftMonster implements Blaze {
public String toString() {
return "CraftBlaze";
}
public EntityType getType() {
return EntityType.BLAZE;
}
}

View File

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityBoat;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Boat;
import org.bukkit.entity.EntityType;
public class CraftBoat extends CraftVehicle implements Boat {
@ -55,4 +56,8 @@ public class CraftBoat extends CraftVehicle implements Boat {
public String toString() {
return "CraftBoat";
}
public EntityType getType() {
return EntityType.BOAT;
}
}

View File

@ -1,8 +1,10 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityCaveSpider;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.CaveSpider;
import org.bukkit.entity.EntityType;
public class CraftCaveSpider extends CraftSpider implements CaveSpider {
public CraftCaveSpider(CraftServer server, EntityCaveSpider entity) {
@ -18,4 +20,8 @@ public class CraftCaveSpider extends CraftSpider implements CaveSpider {
public String toString() {
return "CraftCaveSpider";
}
public EntityType getType() {
return EntityType.CAVE_SPIDER;
}
}

View File

@ -1,8 +1,10 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityChicken;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.EntityType;
public class CraftChicken extends CraftAnimals implements Chicken {
@ -19,4 +21,8 @@ public class CraftChicken extends CraftAnimals implements Chicken {
public String toString() {
return "CraftChicken";
}
public EntityType getType() {
return EntityType.CHICKEN;
}
}

View File

@ -4,6 +4,7 @@ import net.minecraft.server.EntityComplexPart;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.ComplexEntityPart;
import org.bukkit.entity.ComplexLivingEntity;
import org.bukkit.entity.EntityType;
public class CraftComplexPart extends CraftEntity implements ComplexEntityPart {
public CraftComplexPart(CraftServer server, EntityComplexPart entity) {
@ -23,4 +24,8 @@ public class CraftComplexPart extends CraftEntity implements ComplexEntityPart {
public String toString() {
return "CraftComplexPart";
}
public EntityType getType() {
return EntityType.COMPLEX_PART;
}
}

View File

@ -1,8 +1,10 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityCow;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Cow;
import org.bukkit.entity.EntityType;
public class CraftCow extends CraftAnimals implements Cow {
@ -19,4 +21,8 @@ public class CraftCow extends CraftAnimals implements Cow {
public String toString() {
return "CraftCow";
}
public EntityType getType() {
return EntityType.COW;
}
}

View File

@ -4,6 +4,7 @@ import net.minecraft.server.EntityCreeper;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.EntityType;
import org.bukkit.event.entity.CreeperPowerEvent;
public class CraftCreeper extends CraftMonster implements Creeper {
@ -17,7 +18,6 @@ public class CraftCreeper extends CraftMonster implements Creeper {
}
public void setPowered(boolean powered) {
// CraftBukkit start
CraftServer server = this.server;
org.bukkit.entity.Entity entity = this.getHandle().getBukkitEntity();
@ -36,9 +36,6 @@ public class CraftCreeper extends CraftMonster implements Creeper {
getHandle().setPowered(false);
}
}
// CraftBukkit end
}
@Override
@ -50,4 +47,8 @@ public class CraftCreeper extends CraftMonster implements Creeper {
public String toString() {
return "CraftCreeper";
}
public EntityType getType() {
return EntityType.CREEPER;
}
}

View File

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityEgg;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Egg;
import org.bukkit.entity.EntityType;
public class CraftEgg extends CraftProjectile implements Egg {
public CraftEgg(CraftServer server, EntityEgg entity) {
@ -18,4 +19,8 @@ public class CraftEgg extends CraftProjectile implements Egg {
public String toString() {
return "CraftEgg";
}
public EntityType getType() {
return EntityType.EGG;
}
}

View File

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityEnderCrystal;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EnderCrystal;
import org.bukkit.entity.EntityType;
public class CraftEnderCrystal extends CraftEntity implements EnderCrystal {
public CraftEnderCrystal(CraftServer server, EntityEnderCrystal entity) {
@ -18,4 +19,8 @@ public class CraftEnderCrystal extends CraftEntity implements EnderCrystal {
public String toString() {
return "CraftEnderCrystal";
}
public EntityType getType() {
return EntityType.ENDER_CRYSTAL;
}
}

View File

@ -2,12 +2,16 @@ package org.bukkit.craftbukkit.entity;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder;
import java.util.Set;
import net.minecraft.server.EntityComplexPart;
import net.minecraft.server.EntityEnderDragon;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.ComplexEntityPart;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.EntityType;
public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderDragon {
public CraftEnderDragon(CraftServer server, EntityEnderDragon entity) {
@ -33,4 +37,8 @@ public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderD
public String toString() {
return "CraftEnderDragon";
}
public EntityType getType() {
return EntityType.ENDER_DRAGON;
}
}

View File

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityEnderPearl;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EnderPearl;
import org.bukkit.entity.EntityType;
public class CraftEnderPearl extends CraftProjectile implements EnderPearl {
public CraftEnderPearl(CraftServer server, EntityEnderPearl entity) {
@ -18,4 +19,8 @@ public class CraftEnderPearl extends CraftProjectile implements EnderPearl {
public String toString() {
return "CraftEnderPearl";
}
public EntityType getType() {
return EntityType.ENDER_PEARL;
}
}

View File

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityEnderSignal;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EnderSignal;
import org.bukkit.entity.EntityType;
public class CraftEnderSignal extends CraftEntity implements EnderSignal {
public CraftEnderSignal(CraftServer server, EntityEnderSignal entity) {
@ -18,4 +19,8 @@ public class CraftEnderSignal extends CraftEntity implements EnderSignal {
public String toString() {
return "CraftEnderSignal";
}
public EntityType getType() {
return EntityType.ENDER_SIGNAL;
}
}

View File

@ -5,6 +5,7 @@ import net.minecraft.server.EntityEnderman;
import org.bukkit.Material;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.EntityType;
import org.bukkit.material.MaterialData;
public class CraftEnderman extends CraftMonster implements Enderman {
@ -30,4 +31,8 @@ public class CraftEnderman extends CraftMonster implements Enderman {
public String toString() {
return "CraftEnderman";
}
public EntityType getType() {
return EntityType.ENDERMAN;
}
}

View File

@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityExperienceOrb;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.ExperienceOrb;
public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb {
@ -26,4 +27,8 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb {
public String toString() {
return "CraftExperienceOrb";
}
public EntityType getType() {
return EntityType.EXPERIENCE_ORB;
}
}

View File

@ -4,6 +4,7 @@ import net.minecraft.server.EntityFallingBlock;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.FallingSand;
public class CraftFallingSand extends CraftEntity implements FallingSand {
@ -21,4 +22,8 @@ public class CraftFallingSand extends CraftEntity implements FallingSand {
public String toString() {
return "CraftFallingSand";
}
public EntityType getType() {
return EntityType.FALLING_BLOCK;
}
}

View File

@ -4,6 +4,7 @@ import net.minecraft.server.EntityFireball;
import net.minecraft.server.EntityLiving;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.LivingEntity;
import org.bukkit.util.Vector;
@ -60,4 +61,8 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
public String toString() {
return "CraftFireball";
}
public EntityType getType() {
return EntityType.FIREBALL;
}
}

View File

@ -4,6 +4,7 @@ import net.minecraft.server.EntityFishingHook;
import net.minecraft.server.EntityHuman;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Fish;
import org.bukkit.entity.LivingEntity;
@ -35,4 +36,8 @@ public class CraftFish extends AbstractProjectile implements Fish {
public String toString() {
return "CraftFish";
}
public EntityType getType() {
return EntityType.FISHING_HOOK;
}
}

View File

@ -1,7 +1,9 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityGhast;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Ghast;
public class CraftGhast extends CraftFlying implements Ghast {
@ -19,4 +21,8 @@ public class CraftGhast extends CraftFlying implements Ghast {
public String toString() {
return "CraftGhast";
}
public EntityType getType() {
return EntityType.GHAST;
}
}

View File

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityGiantZombie;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Giant;
public class CraftGiant extends CraftMonster implements Giant {
@ -20,4 +21,8 @@ public class CraftGiant extends CraftMonster implements Giant {
public String toString() {
return "CraftGiant";
}
public EntityType getType() {
return EntityType.GIANT;
}
}

View File

@ -1,6 +1,8 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityItem;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Item;
import org.bukkit.inventory.ItemStack;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
@ -39,4 +41,8 @@ public class CraftItem extends CraftEntity implements Item {
public String toString() {
return "CraftItem";
}
public EntityType getType() {
return EntityType.DROPPED_ITEM;
}
}

View File

@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityWeatherLighting;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LightningStrike;
public class CraftLightningStrike extends CraftEntity implements LightningStrike {
@ -20,6 +21,10 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike
@Override
public String toString() {
return "CraftLightningStrik";
return "CraftLightningStrike";
}
public EntityType getType() {
return EntityType.LIGHTNING;
}
}

View File

@ -21,6 +21,7 @@ import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Egg;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -275,4 +276,8 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
}
return effects;
}
public EntityType getType() {
return EntityType.UNKNOWN;
}
}

View File

@ -1,7 +1,9 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityMagmaCube;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.MagmaCube;
public class CraftMagmaCube extends CraftSlime implements MagmaCube {
@ -18,4 +20,8 @@ public class CraftMagmaCube extends CraftSlime implements MagmaCube {
public String toString() {
return "CraftMagmaCube";
}
public EntityType getType() {
return EntityType.MAGMA_CUBE;
}
}

View File

@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityMinecart;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Minecart;
import org.bukkit.util.Vector;
@ -81,4 +82,8 @@ public class CraftMinecart extends CraftVehicle implements Minecart {
public String toString() {
return "CraftMinecart";
}
public EntityType getType() {
return EntityType.MINECART;
}
}

View File

@ -1,7 +1,9 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityMushroomCow;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.MushroomCow;
public class CraftMushroomCow extends CraftCow implements MushroomCow {
@ -18,4 +20,8 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow {
public String toString() {
return "CraftMushroomCow";
}
public EntityType getType() {
return EntityType.MUSHROOM_COW;
}
}

View File

@ -10,6 +10,7 @@ import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.CraftArt;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Painting;
public class CraftPainting extends CraftEntity implements Painting {
@ -122,4 +123,8 @@ public class CraftPainting extends CraftEntity implements Painting {
public String toString() {
return "CraftPainting{art=" + getArt() + "}";
}
public EntityType getType() {
return EntityType.PAINTING;
}
}

View File

@ -1,7 +1,9 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityPig;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Pig;
public class CraftPig extends CraftAnimals implements Pig {
@ -25,4 +27,8 @@ public class CraftPig extends CraftAnimals implements Pig {
public String toString() {
return "CraftPig";
}
public EntityType getType() {
return EntityType.PIG;
}
}

View File

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityPigZombie;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.PigZombie;
public class CraftPigZombie extends CraftZombie implements PigZombie {
@ -36,4 +37,8 @@ public class CraftPigZombie extends CraftZombie implements PigZombie {
public String toString() {
return "CraftPigZombie";
}
public EntityType getType() {
return EntityType.PIG_ZOMBIE;
}
}

View File

@ -24,6 +24,7 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.map.CraftMapView;
import org.bukkit.craftbukkit.map.RenderData;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerGameModeChangeEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
@ -718,4 +719,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
getHandle().netServerHandler.sendPacket(packet);
}
}
public EntityType getType() {
return EntityType.PLAYER;
}
}

View File

@ -4,6 +4,7 @@ import net.minecraft.server.EntitySheep;
import org.bukkit.DyeColor;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Sheep;
public class CraftSheep extends CraftAnimals implements Sheep {
@ -37,4 +38,7 @@ public class CraftSheep extends CraftAnimals implements Sheep {
return "CraftSheep";
}
public EntityType getType() {
return EntityType.SHEEP;
}
}

View File

@ -1,7 +1,9 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntitySilverfish;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Silverfish;
public class CraftSilverfish extends CraftMonster implements Silverfish {
@ -18,4 +20,8 @@ public class CraftSilverfish extends CraftMonster implements Silverfish {
public String toString() {
return "CraftSilverfish";
}
public EntityType getType() {
return EntityType.SILVERFISH;
}
}

View File

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntitySkeleton;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Skeleton;
public class CraftSkeleton extends CraftMonster implements Skeleton {
@ -20,4 +21,8 @@ public class CraftSkeleton extends CraftMonster implements Skeleton {
public String toString() {
return "CraftSkeleton";
}
public EntityType getType() {
return EntityType.SKELETON;
}
}

View File

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntitySlime;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Slime;
public class CraftSlime extends CraftLivingEntity implements Slime {
@ -28,4 +29,8 @@ public class CraftSlime extends CraftLivingEntity implements Slime {
public String toString() {
return "CraftSlime";
}
public EntityType getType() {
return EntityType.SLIME;
}
}

View File

@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntitySmallFireball;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.SmallFireball;
public class CraftSmallFireball extends CraftFireball implements SmallFireball {
@ -18,4 +19,8 @@ public class CraftSmallFireball extends CraftFireball implements SmallFireball {
public String toString() {
return "CraftSmallFireball";
}
public EntityType getType() {
return EntityType.SMALL_FIREBALL;
}
}

View File

@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntitySnowball;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Snowball;
public class CraftSnowball extends CraftProjectile implements Snowball {
@ -18,4 +19,8 @@ public class CraftSnowball extends CraftProjectile implements Snowball {
public String toString() {
return "CraftSnowball";
}
public EntityType getType() {
return EntityType.SNOWBALL;
}
}

View File

@ -1,7 +1,9 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntitySnowman;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Snowman;
public class CraftSnowman extends CraftCreature implements Snowman {
@ -18,4 +20,8 @@ public class CraftSnowman extends CraftCreature implements Snowman {
public String toString() {
return "CraftSnowman";
}
public EntityType getType() {
return EntityType.SNOWMAN;
}
}

View File

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntitySpider;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Spider;
public class CraftSpider extends CraftMonster implements Spider {
@ -20,4 +21,8 @@ public class CraftSpider extends CraftMonster implements Spider {
public String toString() {
return "CraftSpider";
}
public EntityType getType() {
return EntityType.SPIDER;
}
}

View File

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntitySquid;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Squid;
public class CraftSquid extends CraftWaterMob implements Squid {
@ -20,4 +21,8 @@ public class CraftSquid extends CraftWaterMob implements Squid {
public String toString() {
return "CraftSquid";
}
public EntityType getType() {
return EntityType.SQUID;
}
}

View File

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityTNTPrimed;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.TNTPrimed;
public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
@ -45,4 +46,8 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
return "CraftTNTPrimed";
}
public EntityType getType() {
return EntityType.PRIMED_TNT;
}
}

View File

@ -5,6 +5,7 @@ import java.util.Collection;
import net.minecraft.server.EntityPotion;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionEffectType;
@ -34,4 +35,8 @@ public class CraftThrownPotion extends CraftProjectile implements ThrownPotion {
public String toString() {
return "CraftThrownPotion";
}
public EntityType getType() {
return EntityType.SPLASH_POTION;
}
}

View File

@ -1,7 +1,9 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityVillager;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Villager;
public class CraftVillager extends CraftCreature implements Villager {
@ -18,4 +20,8 @@ public class CraftVillager extends CraftCreature implements Villager {
public String toString() {
return "CraftVillager";
}
public EntityType getType() {
return EntityType.VILLAGER;
}
}

View File

@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityWeather;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Weather;
public class CraftWeather extends CraftEntity implements Weather {
@ -18,4 +19,8 @@ public class CraftWeather extends CraftEntity implements Weather {
public String toString() {
return "CraftWeather";
}
public EntityType getType() {
return EntityType.WEATHER;
}
}

View File

@ -1,11 +1,13 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityWolf;
import net.minecraft.server.PathEntity;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
import net.minecraft.server.PathEntity;
public class CraftWolf extends CraftAnimals implements Wolf {
private AnimalTamer owner;
@ -112,4 +114,8 @@ public class CraftWolf extends CraftAnimals implements Wolf {
public String toString() {
return "CraftWolf{anger=" + isAngry() + ",owner=" + getOwner() + ",tame=" + isTamed() + ",sitting=" + isSitting() + "}";
}
public EntityType getType() {
return EntityType.WOLF;
}
}

View File

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityZombie;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Zombie;
public class CraftZombie extends CraftMonster implements Zombie {
@ -20,4 +21,8 @@ public class CraftZombie extends CraftMonster implements Zombie {
public String toString() {
return "CraftZombie";
}
public EntityType getType() {
return EntityType.ZOMBIE;
}
}

View File

@ -8,36 +8,13 @@ import net.minecraft.server.ChunkCoordinates;
import net.minecraft.server.DamageSource;
import net.minecraft.server.Entity;
import net.minecraft.server.EntityArrow;
import net.minecraft.server.EntityBlaze;
import net.minecraft.server.EntityCaveSpider;
import net.minecraft.server.EntityChicken;
import net.minecraft.server.EntityComplexPart;
import net.minecraft.server.EntityCow;
import net.minecraft.server.EntityCreeper;
import net.minecraft.server.EntityEnderCrystal;
import net.minecraft.server.EntityEnderDragon;
import net.minecraft.server.EntityEnderman;
import net.minecraft.server.EntityGhast;
import net.minecraft.server.EntityGiantZombie;
import net.minecraft.server.EntityHuman;
import net.minecraft.server.EntityItem;
import net.minecraft.server.EntityMagmaCube;
import net.minecraft.server.EntityLiving;
import net.minecraft.server.EntityMushroomCow;
import net.minecraft.server.EntityPig;
import net.minecraft.server.EntityPigZombie;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.EntityPotion;
import net.minecraft.server.EntitySheep;
import net.minecraft.server.EntitySilverfish;
import net.minecraft.server.EntitySkeleton;
import net.minecraft.server.EntitySlime;
import net.minecraft.server.EntitySnowman;
import net.minecraft.server.EntitySpider;
import net.minecraft.server.EntitySquid;
import net.minecraft.server.EntityVillager;
import net.minecraft.server.EntityWolf;
import net.minecraft.server.EntityZombie;
import net.minecraft.server.Item;
import net.minecraft.server.ItemStack;
import net.minecraft.server.World;
@ -58,7 +35,6 @@ import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.CreatureType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
@ -232,57 +208,10 @@ public class CraftEventFactory {
* CreatureSpawnEvent
*/
public static CreatureSpawnEvent callCreatureSpawnEvent(EntityLiving entityliving, SpawnReason spawnReason) {
org.bukkit.entity.Entity entity = entityliving.getBukkitEntity();
LivingEntity entity = (LivingEntity) entityliving.getBukkitEntity();
CraftServer craftServer = (CraftServer) entity.getServer();
CreatureType type = null;
if (entityliving instanceof EntityChicken) {
type = CreatureType.CHICKEN;
} else if (entityliving instanceof EntityCow) {
if (entityliving instanceof EntityMushroomCow) type = CreatureType.MUSHROOM_COW;
else type = CreatureType.COW;
} else if (entityliving instanceof EntityCreeper) {
type = CreatureType.CREEPER;
} else if (entityliving instanceof EntityGhast) {
type = CreatureType.GHAST;
} else if (entityliving instanceof EntityGiantZombie) {
type = CreatureType.GIANT;
} else if (entityliving instanceof EntityWolf) {
type = CreatureType.WOLF;
} else if (entityliving instanceof EntityPig) {
type = CreatureType.PIG;
} else if (entityliving instanceof EntityPigZombie) {
type = CreatureType.PIG_ZOMBIE;
} else if (entityliving instanceof EntitySheep) {
type = CreatureType.SHEEP;
} else if (entityliving instanceof EntitySkeleton) {
type = CreatureType.SKELETON;
} else if (entityliving instanceof EntitySlime) {
if (entityliving instanceof EntityMagmaCube) type = CreatureType.MAGMA_CUBE;
else type = CreatureType.SLIME;
} else if (entityliving instanceof EntitySpider) {
if (entityliving instanceof EntityCaveSpider) type = CreatureType.CAVE_SPIDER;
else type = CreatureType.SPIDER;
} else if (entityliving instanceof EntitySquid) {
type = CreatureType.SQUID;
} else if (entityliving instanceof EntityZombie) {
type = CreatureType.ZOMBIE;
} else if (entityliving instanceof EntityEnderman) {
type = CreatureType.ENDERMAN;
} else if (entityliving instanceof EntitySnowman) {
type = CreatureType.SNOWMAN;
} else if (entityliving instanceof EntityEnderDragon) {
type = CreatureType.ENDER_DRAGON;
} else if (entityliving instanceof EntityVillager) {
type = CreatureType.VILLAGER;
} else if (entityliving instanceof EntityBlaze) {
type = CreatureType.BLAZE;
} else if (entityliving instanceof EntitySilverfish) {
type = CreatureType.SILVERFISH;
}
CreatureSpawnEvent event = new CreatureSpawnEvent(entity, type, entity.getLocation(), spawnReason);
CreatureSpawnEvent event = new CreatureSpawnEvent(entity, spawnReason);
craftServer.getPluginManager().callEvent(event);
return event;
}