mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-10 04:38:35 +00:00
Merge pull request #518 from aurorasmiles/fixEntities
start reimplementing entities
This commit is contained in:
@ -78,12 +78,12 @@ public class MutableEntityChange implements Change {
|
||||
return;
|
||||
}
|
||||
List<DoubleTag> pos = (List<DoubleTag>) posTag.getValue();
|
||||
int x = MathMan.roundInt(pos.get(0).getValue());
|
||||
int y = MathMan.roundInt(pos.get(1).getValue());
|
||||
int z = MathMan.roundInt(pos.get(2).getValue());
|
||||
double x = pos.get(0).getValue();
|
||||
double y = pos.get(1).getValue();
|
||||
double z = pos.get(2).getValue();
|
||||
Extent extent = context.getExtent();
|
||||
Location location = new Location(extent, x, y, z, 0, 0);
|
||||
String id = tag.getString("id");
|
||||
String id = tag.getString("Id");
|
||||
EntityType type = EntityTypes.parse(id);
|
||||
BaseEntity entity = new BaseEntity(type, tag);
|
||||
context.getExtent().createEntity(location, entity);
|
||||
|
@ -43,6 +43,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
@ -437,6 +438,11 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
|
||||
public List<? extends Entity> getEntities() {
|
||||
return new ArrayList<>(entities);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities(Region region) {
|
||||
return new ArrayList<>(entities.stream().filter(e -> region.contains(e.getLocation().toBlockPoint())).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeEntity(Entity entity) {
|
||||
|
@ -27,6 +27,7 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class MemoryOptimizedClipboard extends LinearClipboard {
|
||||
@ -292,11 +293,15 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
|
||||
return new ArrayList<>(entities);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities(Region region) {
|
||||
return new ArrayList<>(entities.stream().filter(e -> region.contains(e.getLocation().toBlockPoint())).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeEntity(Entity entity) {
|
||||
if (entity instanceof ClipboardEntity) {
|
||||
this.entities.remove(entity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user