begin removing Location

This commit is contained in:
dfsek
2021-06-25 13:27:56 -07:00
parent 4306b179bb
commit 56029851f0
31 changed files with 77 additions and 73 deletions

View File

@@ -5,6 +5,7 @@ import com.dfsek.terra.api.entity.EntityType;
import com.dfsek.terra.api.entity.Player;
import com.dfsek.terra.api.util.generic.pair.Pair;
import com.dfsek.terra.api.vector.Location;
import com.dfsek.terra.api.vector.Vector3;
/**
* Interface to be implemented for world manipulation.
@@ -20,7 +21,7 @@ public interface WorldHandle {
* @param player Player to get locations for
* @return Pair of locations.
*/
default Pair<Location, Location> getSelectedLocation(Player player) {
default Pair<Vector3, Vector3> getSelectedLocation(Player player) {
throw new UnsupportedOperationException("Cannot get selection on this platform.");
}
}

View File

@@ -2,7 +2,6 @@ package com.dfsek.terra.api.structure;
import com.dfsek.terra.api.structure.buffer.Buffer;
import com.dfsek.terra.api.structure.rotation.Rotation;
import com.dfsek.terra.api.vector.Location;
import com.dfsek.terra.api.vector.Vector3;
import com.dfsek.terra.api.world.Chunk;
import com.dfsek.terra.api.world.World;
@@ -14,17 +13,18 @@ public interface Structure {
* Paste the structure at a location
*
* @param location Location to paste structure
* @param world
* @param rotation Rotation of structure
* @return Whether generation was successful
*/
@SuppressWarnings("try")
boolean generate(Location location, Random random, Rotation rotation);
boolean generate(Vector3 location, World world, Random random, Rotation rotation);
@SuppressWarnings("try")
boolean generate(Location location, Chunk chunk, Random random, Rotation rotation);
boolean generate(Vector3 location, World world, Chunk chunk, Random random, Rotation rotation);
@SuppressWarnings("try")
boolean test(Location location, Random random, Rotation rotation);
boolean test(Vector3 location, World world, Random random, Rotation rotation);
@SuppressWarnings("try")
boolean generate(Buffer buffer, World world, Random random, Rotation rotation, int recursions);

View File

@@ -163,5 +163,5 @@ public interface Vector3 extends Cloneable {
Vector3 subtract(Vector3 end);
public Vector3 clone();
Vector3 clone();
}

View File

@@ -1,7 +1,6 @@
package com.dfsek.terra.api.world;
import com.dfsek.terra.api.util.Range;
import com.dfsek.terra.api.vector.Location;
import com.dfsek.terra.api.vector.Vector3;
import java.util.List;
@@ -9,5 +8,5 @@ import java.util.List;
public interface Flora {
List<Vector3> getValidSpawnsAt(Chunk chunk, int x, int z, Range check);
boolean plant(Location l);
boolean plant(Vector3 l, World world);
}

View File

@@ -20,7 +20,7 @@ public interface World extends Handle {
Chunk getChunkAt(int x, int z);
default Chunk getChunkAt(Location location) {
default Chunk getChunkAt(Vector3 location) {
return getChunkAt(location.getBlockX() >> 4, location.getBlockZ() >> 4);
}
@@ -50,7 +50,7 @@ public interface World extends Handle {
return getBlockState(position.getBlockX(), position.getBlockY(), position.getBlockZ());
}
Entity spawnEntity(Location location, EntityType entityType);
Entity spawnEntity(Vector3 location, EntityType entityType);
int getMinHeight();

View File

@@ -16,10 +16,6 @@ public interface BiomeProvider {
return getBiome(vector3.getBlockX(), vector3.getBlockZ());
}
default TerraBiome getBiome(Location location) {
return getBiome(location.getBlockX(), location.getBlockZ());
}
interface BiomeProviderBuilder {
BiomeProvider build(long seed);
}