mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 14:21:08 +00:00
Location is gone.
This commit is contained in:
@@ -25,7 +25,6 @@ import com.dfsek.terra.bukkit.world.block.BukkitBlockTypeAndItem;
|
||||
import com.dfsek.terra.bukkit.world.block.data.BukkitBlockData;
|
||||
import com.dfsek.terra.bukkit.world.inventory.BukkitItemStack;
|
||||
import com.dfsek.terra.bukkit.world.inventory.meta.BukkitEnchantment;
|
||||
import com.dfsek.terra.vector.LocationImpl;
|
||||
import com.dfsek.terra.vector.Vector3Impl;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@@ -338,12 +337,8 @@ public final class BukkitAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
public static Location adapt(com.dfsek.terra.api.vector.Location location) {
|
||||
return new Location(((BukkitWorld) location.getWorld()).getHandle(), location.getX(), location.getY(), location.getZ());
|
||||
}
|
||||
|
||||
public static LocationImpl adapt(Location location) {
|
||||
return new LocationImpl(adapt(location.getWorld()), location.getX(), location.getY(), location.getZ());
|
||||
public static Vector3 adapt(Location location) {
|
||||
return new Vector3Impl(location.getX(), location.getY(), location.getZ());
|
||||
}
|
||||
|
||||
public static Vector adapt(Vector3 vector3) {
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.dfsek.terra.api.handle.WorldHandle;
|
||||
import com.dfsek.terra.api.lang.Language;
|
||||
import com.dfsek.terra.api.profiler.Profiler;
|
||||
import com.dfsek.terra.api.registry.CheckedRegistry;
|
||||
import com.dfsek.terra.api.registry.LockedRegistry;
|
||||
import com.dfsek.terra.api.registry.Registry;
|
||||
import com.dfsek.terra.api.util.logging.DebugLogger;
|
||||
import com.dfsek.terra.api.util.logging.JavaLogger;
|
||||
import com.dfsek.terra.api.world.TerraWorld;
|
||||
@@ -26,6 +26,8 @@ import com.dfsek.terra.config.lang.LanguageImpl;
|
||||
import com.dfsek.terra.platform.RawBiome;
|
||||
import com.dfsek.terra.platform.RawWorldHandle;
|
||||
import com.dfsek.terra.profiler.ProfilerImpl;
|
||||
import com.dfsek.terra.registry.CheckedRegistryImpl;
|
||||
import com.dfsek.terra.registry.LockedRegistryImpl;
|
||||
import com.dfsek.terra.registry.master.AddonRegistry;
|
||||
import com.dfsek.terra.registry.master.ConfigRegistry;
|
||||
import com.dfsek.terra.world.TerraWorldImpl;
|
||||
@@ -38,7 +40,7 @@ public class StandalonePlugin implements TerraPlugin {
|
||||
private final ConfigRegistry registry = new ConfigRegistry();
|
||||
private final AddonRegistry addonRegistry = new AddonRegistry(this);
|
||||
|
||||
private final LockedRegistry<TerraAddon> addonLockedRegistry = new LockedRegistry<>(addonRegistry);
|
||||
private final Registry<TerraAddon> addonLockedRegistry = new LockedRegistryImpl<>(addonRegistry);
|
||||
|
||||
private final PluginConfig config = new PluginConfigImpl();
|
||||
private final RawWorldHandle worldHandle = new RawWorldHandle();
|
||||
@@ -82,11 +84,11 @@ public class StandalonePlugin implements TerraPlugin {
|
||||
|
||||
@Override
|
||||
public CheckedRegistry<ConfigPack> getConfigRegistry() {
|
||||
return new CheckedRegistry<>(registry);
|
||||
return new CheckedRegistryImpl<>(registry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LockedRegistry<TerraAddon> getAddons() {
|
||||
public Registry<TerraAddon> getAddons() {
|
||||
return addonLockedRegistry;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
package com.dfsek.terra.platform;
|
||||
|
||||
import com.dfsek.terra.api.block.Block;
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.BlockFace;
|
||||
import com.dfsek.terra.api.block.BlockType;
|
||||
import com.dfsek.terra.api.block.state.BlockState;
|
||||
import com.dfsek.terra.api.vector.Vector3;
|
||||
import com.dfsek.terra.vector.LocationImpl;
|
||||
import net.jafama.FastMath;
|
||||
|
||||
public class DirectBlock implements Block {
|
||||
private final DirectWorld world;
|
||||
private final Vector3 pos;
|
||||
|
||||
public DirectBlock(DirectWorld world, Vector3 pos) {
|
||||
this.world = world;
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockData(BlockData data, boolean physics) {
|
||||
synchronized(world) {
|
||||
world.compute(FastMath.floorDiv(pos.getBlockX(), 16), FastMath.floorDiv(pos.getBlockZ(), 16)).setBlockStateAt(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ(), ((Data) data).getHandle(), false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockData getBlockData() {
|
||||
return new Data(world.getData(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getState() {
|
||||
return new DirectBlockState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getRelative(BlockFace face) {
|
||||
return world.getBlockAt(pos.getBlockX() + face.getModX(), pos.getBlockY() + face.getModY(), pos.getBlockZ() + face.getModZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getRelative(BlockFace face, int len) {
|
||||
return world.getBlockAt(pos.getBlockX() + face.getModX() * len, pos.getBlockY() + face.getModY() * len, pos.getBlockZ() + face.getModZ() * len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return getBlockData().getAsString().equals("minecraft:air");
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocationImpl getLocation() {
|
||||
return pos.toLocation(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockType getType() {
|
||||
return new Data(world.getData(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getX() {
|
||||
return pos.getBlockX();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZ() {
|
||||
return pos.getBlockY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getY() {
|
||||
return pos.getBlockY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPassable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getHandle() {
|
||||
return world;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.dfsek.terra.platform;
|
||||
|
||||
import com.dfsek.terra.api.block.Block;
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.state.BlockState;
|
||||
import com.dfsek.terra.api.vector.Vector3;
|
||||
|
||||
public class DirectBlockState implements BlockState {
|
||||
@Override
|
||||
public Block getBlock() {
|
||||
public Vector3 getPosition() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.dfsek.terra.platform;
|
||||
|
||||
import com.dfsek.terra.api.block.Block;
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.world.World;
|
||||
import com.dfsek.terra.api.world.generator.ChunkData;
|
||||
import com.dfsek.terra.vector.Vector3Impl;
|
||||
import net.querz.mca.Chunk;
|
||||
import net.querz.nbt.tag.CompoundTag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -44,6 +42,11 @@ public class DirectChunkData implements ChunkData, com.dfsek.terra.api.world.Chu
|
||||
return new Data(tag.getString("Name"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, BlockData data, boolean physics) {
|
||||
setBlock(x, y, z, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getX() {
|
||||
return x;
|
||||
@@ -59,8 +62,4 @@ public class DirectChunkData implements ChunkData, com.dfsek.terra.api.world.Chu
|
||||
return world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock(int x, int y, int z) {
|
||||
return new DirectBlock(world, new Vector3Impl(x + (this.x << 4), y, z + (this.z << 4)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.dfsek.terra.platform;
|
||||
|
||||
import com.dfsek.terra.DirectUtils;
|
||||
import com.dfsek.terra.api.block.Block;
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.block.state.BlockState;
|
||||
import com.dfsek.terra.api.entity.Entity;
|
||||
import com.dfsek.terra.api.entity.EntityType;
|
||||
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;
|
||||
import com.dfsek.terra.vector.LocationImpl;
|
||||
import com.dfsek.terra.vector.Vector3Impl;
|
||||
import net.jafama.FastMath;
|
||||
import net.querz.mca.MCAFile;
|
||||
import net.querz.mca.MCAUtil;
|
||||
@@ -57,12 +57,22 @@ public class DirectWorld implements World {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlockAt(int x, int y, int z) {
|
||||
return new DirectBlock(this, new Vector3Impl(x, y, z));
|
||||
public BlockData getBlockData(int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity spawnEntity(LocationImpl location, EntityType entityType) {
|
||||
public void setBlockData(int x, int y, int z, BlockData data, boolean physics) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlockState(int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity spawnEntity(Vector3 location, EntityType entityType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.dfsek.terra.region;
|
||||
|
||||
public class RegionWriter {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user