mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 22:31:52 +00:00
begin removing Location
This commit is contained in:
+1
-1
@@ -118,7 +118,7 @@ public class FabricChunkGeneratorWrapper extends ChunkGenerator implements Gener
|
||||
TerraStructure located = pack.getRegistry(TerraStructure.class).get(pack.getLocatable().get(name));
|
||||
if(located != null) {
|
||||
CompletableFuture<BlockPos> result = new CompletableFuture<>();
|
||||
AsyncStructureFinder finder = new AsyncStructureFinder(terraWorld.getBiomeProvider(), located, FabricAdapter.adapt(center).toLocation((World) world), 0, 500, location -> {
|
||||
AsyncStructureFinder finder = new AsyncStructureFinder(terraWorld.getBiomeProvider(), located, FabricAdapter.adapt(center), terraWorld.getWorld(), 0, 500, location -> {
|
||||
result.complete(FabricAdapter.adapt(location));
|
||||
}, TerraFabricPlugin.getInstance());
|
||||
finder.run(); // Do this synchronously.
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.dfsek.terra.api.entity.EntityType;
|
||||
import com.dfsek.terra.api.entity.Player;
|
||||
import com.dfsek.terra.api.handle.WorldHandle;
|
||||
import com.dfsek.terra.api.util.generic.pair.Pair;
|
||||
import com.dfsek.terra.api.vector.Location;
|
||||
import com.dfsek.terra.api.vector.Vector3;
|
||||
import com.dfsek.terra.fabric.block.FabricBlockData;
|
||||
import com.dfsek.terra.fabric.util.FabricAdapter;
|
||||
import com.dfsek.terra.fabric.util.WorldEditUtil;
|
||||
@@ -39,7 +39,7 @@ public class FabricWorldHandle implements WorldHandle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<Location, Location> getSelectedLocation(Player player) {
|
||||
public Pair<Vector3, Vector3> getSelectedLocation(Player player) {
|
||||
try {
|
||||
Class.forName("com.sk89q.worldedit.WorldEdit");
|
||||
} catch(ClassNotFoundException e) {
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@ import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.entity.Entity;
|
||||
import com.dfsek.terra.api.entity.EntityType;
|
||||
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;
|
||||
import com.dfsek.terra.api.world.generator.ChunkGenerator;
|
||||
@@ -64,7 +65,7 @@ public abstract class ChunkRegionMixin {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public Entity terraWorld$spawnEntity(Location location, EntityType entityType) {
|
||||
public Entity terraWorld$spawnEntity(Vector3 location, EntityType entityType) {
|
||||
net.minecraft.entity.Entity entity = ((net.minecraft.entity.EntityType<?>) entityType).create(((ChunkRegion) (Object) this).toServerWorld());
|
||||
entity.setPos(location.getX(), location.getY(), location.getZ());
|
||||
((ChunkRegion) (Object) this).spawnEntity(entity);
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@ import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.entity.Entity;
|
||||
import com.dfsek.terra.api.entity.EntityType;
|
||||
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;
|
||||
import com.dfsek.terra.api.world.generator.ChunkGenerator;
|
||||
@@ -53,7 +54,7 @@ public abstract class ServerWorldMixin {
|
||||
((ServerWorld) (Object) this).setBlockState(pos, ((FabricBlockData) data).getHandle(), physics ? 3 : 1042);
|
||||
}
|
||||
|
||||
public Entity terra$spawnEntity(Location location, EntityType entityType) {
|
||||
public Entity terra$spawnEntity(Vector3 location, EntityType entityType) {
|
||||
net.minecraft.entity.Entity entity = ((net.minecraft.entity.EntityType<?>) entityType).create(((ServerWorld) (Object) this));
|
||||
entity.setPos(location.getX(), location.getY(), location.getZ());
|
||||
((ServerWorld) (Object) this).spawnEntity(entity);
|
||||
|
||||
@@ -3,7 +3,9 @@ package com.dfsek.terra.fabric.util;
|
||||
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;
|
||||
import com.dfsek.terra.vector.LocationImpl;
|
||||
import com.dfsek.terra.vector.Vector3Impl;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
@@ -12,7 +14,7 @@ import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public final class WorldEditUtil {
|
||||
public static Pair<Location, Location> getSelection(Player player) {
|
||||
public static Pair<Vector3, Vector3> getSelection(Player player) {
|
||||
WorldEdit worldEdit = WorldEdit.getInstance();
|
||||
try {
|
||||
Region selection = worldEdit.getSessionManager()
|
||||
@@ -20,8 +22,8 @@ public final class WorldEditUtil {
|
||||
.getSelection(com.sk89q.worldedit.fabric.FabricAdapter.adapt((World) player.world()));
|
||||
BlockVector3 min = selection.getMinimumPoint();
|
||||
BlockVector3 max = selection.getMaximumPoint();
|
||||
LocationImpl l1 = new LocationImpl(player.world(), min.getBlockX(), min.getBlockY(), min.getBlockZ());
|
||||
LocationImpl l2 = new LocationImpl(player.world(), max.getBlockX(), max.getBlockY(), max.getBlockZ());
|
||||
Vector3 l1 = new Vector3Impl(min.getBlockX(), min.getBlockY(), min.getBlockZ());
|
||||
Vector3 l2 = new Vector3Impl(max.getBlockX(), max.getBlockY(), max.getBlockZ());
|
||||
return Pair.of(l1, l2);
|
||||
} catch(IncompleteRegionException e) {
|
||||
throw new IllegalStateException("No selection has been made", e);
|
||||
|
||||
Reference in New Issue
Block a user