Interfaces implementations
This commit is contained in:
@@ -4,12 +4,14 @@
|
||||
*/
|
||||
package mc.world.flat;
|
||||
|
||||
import com.flowpowered.nbt.Tag;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import mc.core.Location;
|
||||
import mc.core.world.*;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class FlatWorld implements World {
|
||||
|
||||
@@ -50,4 +52,19 @@ public class FlatWorld implements World {
|
||||
public int getSeed() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag<?> getTag(String name) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTag(Tag<?> tag) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<Tag<?>> tagStream() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package mc.world.generated_world;
|
||||
|
||||
import com.flowpowered.nbt.Tag;
|
||||
import lombok.Getter;
|
||||
import mc.core.Location;
|
||||
import mc.core.world.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class CubicWorld implements World {
|
||||
@Getter
|
||||
@@ -13,6 +17,7 @@ public class CubicWorld implements World {
|
||||
private volatile Location spawnLocation;
|
||||
private final transient Object spawnLocationLock = new Object();
|
||||
private final transient ChunkLoader chunkLoader;
|
||||
private final Map<String, Tag<?>> nbtTagMap = new HashMap<>();
|
||||
|
||||
public CubicWorld(UUID worldId, int seed) {
|
||||
this.worldId = worldId;
|
||||
@@ -86,4 +91,19 @@ public class CubicWorld implements World {
|
||||
public int getSeed() {
|
||||
return seed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tag<?> getTag(String name) {
|
||||
return nbtTagMap.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTag(Tag<?> tag) {
|
||||
nbtTagMap.put(tag.getName(), tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<Tag<?>> tagStream() {
|
||||
return nbtTagMap.values().stream();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user