Added incomplete entity support to all Extents.

The Bukkit implementation supports the new entity API, but it has
not yet been tested. The Forge implementation does not support the
entity API yet.

At the moment, an UnsupportedOperationException is thrown for
Entity.getState() in some implementations, but use of an exception
should probably not be allowed.

BaseEntity is now an interface. It should not be possible to create
instances of BaseEntity because it may be implementation-specific.
This commit is contained in:
sk89q
2014-04-27 23:34:39 -07:00
parent a5c3238876
commit c4c19017bb
17 changed files with 336 additions and 79 deletions

View File

@ -26,11 +26,14 @@ import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import com.sk89q.worldedit.world.mapping.NullResolver;
import com.sk89q.worldedit.world.mapping.Resolver;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.List;
/**
* A null implementation of {@link World} that drops all changes and
@ -128,4 +131,15 @@ public class NullWorld extends AbstractWorld {
public <T> T getMetaData(BaseEntity entity, Class<T> metaDataClass) {
return null;
}
@Override
public List<Entity> getEntities() {
return Collections.emptyList();
}
@Nullable
@Override
public Entity createEntity(Location location, BaseEntity entity) {
return null;
}
}