Have Extent.createEntity() take a Vector rather than a Location.

Dieser Commit ist enthalten in:
sk89q 2014-07-10 02:58:04 -07:00
Ursprung e5959383c5
Commit bd0e20e8a7
9 geänderte Dateien mit 21 neuen und 21 gelöschten Zeilen

Datei anzeigen

@ -233,7 +233,7 @@ public class BukkitWorld extends LocalWorld {
@Nullable @Nullable
@Override @Override
public com.sk89q.worldedit.entity.Entity createEntity(com.sk89q.worldedit.util.Location location, BaseEntity entity) { public com.sk89q.worldedit.entity.Entity createEntity(Vector position, BaseEntity entity) {
throw new UnsupportedOperationException("Not implemented yet"); throw new UnsupportedOperationException("Not implemented yet");
} }

Datei anzeigen

@ -33,7 +33,6 @@ import com.sk89q.worldedit.blocks.LazyBlock;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.TreeGenerator.TreeType; import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import com.sk89q.worldedit.world.AbstractWorld; import com.sk89q.worldedit.world.AbstractWorld;
import com.sk89q.worldedit.world.registry.LegacyWorldData; import com.sk89q.worldedit.world.registry.LegacyWorldData;
@ -510,7 +509,7 @@ public class ForgeWorld extends AbstractWorld {
@Nullable @Nullable
@Override @Override
public Entity createEntity(Location location, BaseEntity entity) { public Entity createEntity(Vector position, BaseEntity entity) {
World world = getWorld(); World world = getWorld();
net.minecraft.entity.Entity createdEntity = EntityList.createEntityByName(entity.getTypeId(), world); net.minecraft.entity.Entity createdEntity = EntityList.createEntityByName(entity.getTypeId(), world);
if (createdEntity != null) { if (createdEntity != null) {

Datei anzeigen

@ -589,8 +589,8 @@ public class EditSession implements Extent {
@Override @Override
@Nullable @Nullable
public Entity createEntity(com.sk89q.worldedit.util.Location location, BaseEntity entity) { public Entity createEntity(Vector position, BaseEntity entity) {
return world.createEntity(location, entity); return world.createEntity(position, entity);
} }
/** /**

Datei anzeigen

@ -26,10 +26,8 @@ import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.function.operation.OperationQueue; import com.sk89q.worldedit.function.operation.OperationQueue;
import com.sk89q.worldedit.util.Location;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
@ -77,8 +75,8 @@ public abstract class AbstractDelegateExtent implements Extent {
@Override @Override
@Nullable @Nullable
public Entity createEntity(Location location, BaseEntity entity) { public Entity createEntity(Vector position, BaseEntity entity) {
return extent.createEntity(location, entity); return extent.createEntity(position, entity);
} }
@Override @Override

Datei anzeigen

@ -22,7 +22,6 @@ package com.sk89q.worldedit.extent;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.util.Location;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
@ -70,10 +69,10 @@ public interface Extent extends InputExtent, OutputExtent {
/** /**
* Create an entity at the given location. * Create an entity at the given location.
* *
* @param position the position
* @param entity the entity * @param entity the entity
* @param location the location
* @return a reference to the created entity, or null if the entity could not be created * @return a reference to the created entity, or null if the entity could not be created
*/ */
@Nullable Entity createEntity(Location location, BaseEntity entity); @Nullable Entity createEntity(Vector position, BaseEntity entity);
} }

Datei anzeigen

@ -25,7 +25,6 @@ import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.util.Location;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Collections; import java.util.Collections;
@ -56,7 +55,7 @@ public class NullExtent implements Extent {
@Nullable @Nullable
@Override @Override
public Entity createEntity(Location location, BaseEntity entity) { public Entity createEntity(Vector position, BaseEntity entity) {
return null; return null;
} }

Datei anzeigen

@ -99,8 +99,8 @@ public class BlockArrayClipboard implements Clipboard {
@Nullable @Nullable
@Override @Override
public Entity createEntity(Location location, BaseEntity entity) { public Entity createEntity(Vector position, BaseEntity entity) {
ClipboardEntity ret = new ClipboardEntity(location, entity); ClipboardEntity ret = new ClipboardEntity(new Location(this, position), entity);
entities.add(ret); entities.add(ret);
return ret; return ret;
} }

Datei anzeigen

@ -330,8 +330,8 @@ public class LocalWorldAdapter extends LocalWorld {
@Override @Override
@Nullable @Nullable
public Entity createEntity(com.sk89q.worldedit.util.Location location, BaseEntity entity) { public Entity createEntity(Vector position, BaseEntity entity) {
return world.createEntity(location, entity); return world.createEntity(position, entity);
} }
@Override @Override

Datei anzeigen

@ -19,14 +19,19 @@
package com.sk89q.worldedit.world; package com.sk89q.worldedit.world;
import com.sk89q.worldedit.*; import com.sk89q.worldedit.BiomeType;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.EntityType;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.Vector2D;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.TreeGenerator.TreeType; import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import com.sk89q.worldedit.world.registry.LegacyWorldData; import com.sk89q.worldedit.world.registry.LegacyWorldData;
import com.sk89q.worldedit.world.registry.WorldData; import com.sk89q.worldedit.world.registry.WorldData;
@ -116,7 +121,7 @@ public class NullWorld extends AbstractWorld {
@Nullable @Nullable
@Override @Override
public Entity createEntity(Location location, BaseEntity entity) { public Entity createEntity(Vector position, BaseEntity entity) {
return null; return null;
} }
} }