mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 02:20:57 +00:00
Implement some BlockData stuff on Fabric, make stuff less jank
This commit is contained in:
@@ -4,7 +4,7 @@ import com.dfsek.terra.api.generic.world.block.BlockData;
|
||||
import com.dfsek.terra.api.generic.world.block.MaterialData;
|
||||
|
||||
public class BukkitBlockData implements BlockData {
|
||||
private final org.bukkit.block.data.BlockData delegate;
|
||||
private org.bukkit.block.data.BlockData delegate;
|
||||
|
||||
public BukkitBlockData(org.bukkit.block.data.BlockData delegate) {
|
||||
this.delegate = delegate;
|
||||
@@ -29,7 +29,9 @@ public class BukkitBlockData implements BlockData {
|
||||
@Override
|
||||
public BukkitBlockData clone() {
|
||||
try {
|
||||
return (BukkitBlockData) super.clone();
|
||||
BukkitBlockData n = (BukkitBlockData) super.clone();
|
||||
n.delegate = delegate.clone();
|
||||
return n;
|
||||
} catch(CloneNotSupportedException e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.dfsek.terra.bukkit.world.block.data;
|
||||
|
||||
import com.dfsek.terra.api.generic.world.block.BlockFace;
|
||||
import com.dfsek.terra.api.generic.world.block.data.Bisected;
|
||||
import com.dfsek.terra.api.generic.world.block.data.Slab;
|
||||
import com.dfsek.terra.api.generic.world.block.data.Stairs;
|
||||
|
||||
/**
|
||||
@@ -82,4 +83,17 @@ public final class BukkitEnumAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
public static Slab.Type fromBukkitSlabType(org.bukkit.block.data.type.Slab.Type type) {
|
||||
switch(type) {
|
||||
case BOTTOM:
|
||||
return Slab.Type.BOTTOM;
|
||||
case TOP:
|
||||
return Slab.Type.TOP;
|
||||
case DOUBLE:
|
||||
return Slab.Type.DOUBLE;
|
||||
default:
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,30 +8,28 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class BukkitMultipleFacing extends BukkitBlockData implements MultipleFacing {
|
||||
private final org.bukkit.block.data.MultipleFacing delegate;
|
||||
|
||||
public BukkitMultipleFacing(org.bukkit.block.data.MultipleFacing delegate) {
|
||||
super(delegate);
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<BlockFace> getFaces() {
|
||||
return delegate.getFaces().stream().map(BukkitEnumAdapter::fromBukkitBlockFace).collect(Collectors.toSet());
|
||||
return ((org.bukkit.block.data.MultipleFacing) super.getHandle()).getFaces().stream().map(BukkitEnumAdapter::fromBukkitBlockFace).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFace(BlockFace face, boolean facing) {
|
||||
delegate.setFace(TerraEnumAdapter.fromTerraBlockFace(face), facing);
|
||||
((org.bukkit.block.data.MultipleFacing) super.getHandle()).setFace(TerraEnumAdapter.fromTerraBlockFace(face), facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<BlockFace> getAllowedFaces() {
|
||||
return delegate.getAllowedFaces().stream().map(BukkitEnumAdapter::fromBukkitBlockFace).collect(Collectors.toSet());
|
||||
return ((org.bukkit.block.data.MultipleFacing) super.getHandle()).getAllowedFaces().stream().map(BukkitEnumAdapter::fromBukkitBlockFace).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasFace(BlockFace f) {
|
||||
return delegate.hasFace(TerraEnumAdapter.fromTerraBlockFace(f));
|
||||
return ((org.bukkit.block.data.MultipleFacing) super.getHandle()).hasFace(TerraEnumAdapter.fromTerraBlockFace(f));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.dfsek.terra.bukkit.world.block.data;
|
||||
|
||||
import com.dfsek.terra.api.generic.world.block.data.Slab;
|
||||
import com.dfsek.terra.api.generic.world.block.data.Waterlogged;
|
||||
import com.dfsek.terra.bukkit.world.block.BukkitBlockData;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
public class BukkitSlab extends BukkitBlockData implements Slab {
|
||||
public BukkitSlab(BlockData delegate) {
|
||||
super(delegate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWaterlogged() {
|
||||
return ((Waterlogged) getHandle()).isWaterlogged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWaterlogged(boolean waterlogged) {
|
||||
((Waterlogged) getHandle()).setWaterlogged(waterlogged);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getType() {
|
||||
return BukkitEnumAdapter.fromBukkitSlabType(((org.bukkit.block.data.type.Slab) getHandle()).getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(Type type) {
|
||||
((org.bukkit.block.data.type.Slab) getHandle()).setType(TerraEnumAdapter.fromTerraSlabType(type));
|
||||
}
|
||||
}
|
||||
@@ -5,50 +5,48 @@ import com.dfsek.terra.api.generic.world.block.data.Stairs;
|
||||
import com.dfsek.terra.bukkit.world.block.BukkitBlockData;
|
||||
|
||||
public class BukkitStairs extends BukkitBlockData implements Stairs {
|
||||
private final org.bukkit.block.data.type.Stairs stairs;
|
||||
|
||||
public BukkitStairs(org.bukkit.block.data.type.Stairs delegate) {
|
||||
super(delegate);
|
||||
this.stairs = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Shape getShape() {
|
||||
return BukkitEnumAdapter.fromBukkitStair(stairs.getShape());
|
||||
return BukkitEnumAdapter.fromBukkitStair(((org.bukkit.block.data.type.Stairs) super.getHandle()).getShape());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShape(Shape shape) {
|
||||
stairs.setShape(TerraEnumAdapter.fromTerraStair(shape));
|
||||
((org.bukkit.block.data.type.Stairs) super.getHandle()).setShape(TerraEnumAdapter.fromTerraStair(shape));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Half getHalf() {
|
||||
return BukkitEnumAdapter.fromBukkitHalf(stairs.getHalf());
|
||||
return BukkitEnumAdapter.fromBukkitHalf(((org.bukkit.block.data.type.Stairs) super.getHandle()).getHalf());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHalf(Half half) {
|
||||
stairs.setHalf(TerraEnumAdapter.fromTerraHalf(half));
|
||||
((org.bukkit.block.data.type.Stairs) super.getHandle()).setHalf(TerraEnumAdapter.fromTerraHalf(half));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFace getFacing() {
|
||||
return BukkitEnumAdapter.fromBukkitBlockFace(stairs.getFacing());
|
||||
return BukkitEnumAdapter.fromBukkitBlockFace(((org.bukkit.block.data.type.Stairs) super.getHandle()).getFacing());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFacing(BlockFace facing) {
|
||||
stairs.setFacing(TerraEnumAdapter.fromTerraBlockFace(facing));
|
||||
((org.bukkit.block.data.type.Stairs) super.getHandle()).setFacing(TerraEnumAdapter.fromTerraBlockFace(facing));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWaterlogged() {
|
||||
return stairs.isWaterlogged();
|
||||
return ((org.bukkit.block.data.type.Stairs) super.getHandle()).isWaterlogged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWaterlogged(boolean waterlogged) {
|
||||
stairs.setWaterlogged(waterlogged);
|
||||
((org.bukkit.block.data.type.Stairs) super.getHandle()).setWaterlogged(waterlogged);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,19 +4,17 @@ import com.dfsek.terra.api.generic.world.block.data.Waterlogged;
|
||||
import com.dfsek.terra.bukkit.world.block.BukkitBlockData;
|
||||
|
||||
public class BukkitWaterlogged extends BukkitBlockData implements Waterlogged {
|
||||
private boolean waterlogged;
|
||||
|
||||
public BukkitWaterlogged(org.bukkit.block.data.Waterlogged delegate) {
|
||||
super(delegate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWaterlogged() {
|
||||
return waterlogged;
|
||||
return ((org.bukkit.block.data.Waterlogged) super.getHandle()).isWaterlogged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWaterlogged(boolean waterlogged) {
|
||||
this.waterlogged = waterlogged;
|
||||
((org.bukkit.block.data.Waterlogged) super.getHandle()).setWaterlogged(waterlogged);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.dfsek.terra.bukkit.world.block.data;
|
||||
|
||||
import com.dfsek.terra.api.generic.world.block.BlockFace;
|
||||
import org.bukkit.block.data.Bisected;
|
||||
import org.bukkit.block.data.type.Slab;
|
||||
import org.bukkit.block.data.type.Stairs;
|
||||
|
||||
/**
|
||||
@@ -81,4 +82,17 @@ public final class TerraEnumAdapter {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
public static Slab.Type fromTerraSlabType(com.dfsek.terra.api.generic.world.block.data.Slab.Type type) {
|
||||
switch(type) {
|
||||
case TOP:
|
||||
return Slab.Type.TOP;
|
||||
case DOUBLE:
|
||||
return Slab.Type.DOUBLE;
|
||||
case BOTTOM:
|
||||
return Slab.Type.BOTTOM;
|
||||
default:
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,16 +15,13 @@ import com.dfsek.terra.config.lang.LangUtil;
|
||||
import com.dfsek.terra.fabric.inventory.FabricItemHandle;
|
||||
import com.dfsek.terra.fabric.mixin.GeneratorTypeAccessor;
|
||||
import com.dfsek.terra.fabric.world.FabricBiome;
|
||||
import com.dfsek.terra.fabric.world.FabricMaterialData;
|
||||
import com.dfsek.terra.fabric.world.FabricWorldHandle;
|
||||
import com.dfsek.terra.fabric.world.TerraBiomeSource;
|
||||
import com.dfsek.terra.fabric.world.generator.FabricChunkGeneratorWrapper;
|
||||
import com.dfsek.terra.registry.ConfigRegistry;
|
||||
import com.dfsek.terra.util.MaterialSet;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.world.GeneratorType;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
@@ -141,18 +138,6 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
MaterialSet set = new MaterialSet();
|
||||
|
||||
set.add(new FabricMaterialData(Blocks.STONE));
|
||||
set.add(new FabricMaterialData(Blocks.DIRT));
|
||||
|
||||
System.out.println("Contains: " + set.contains(new FabricMaterialData(Blocks.AIR)));
|
||||
System.out.println("Contains: " + set.contains(new FabricMaterialData(Blocks.STONE)));
|
||||
|
||||
System.out.println("Matches: " + new FabricMaterialData(Blocks.STONE).matches(new FabricMaterialData(Blocks.STONE)));
|
||||
System.out.println("Matches: " + new FabricMaterialData(Blocks.STONE).matches(new FabricMaterialData(Blocks.DIRT)));
|
||||
|
||||
|
||||
instance = this;
|
||||
plugin.load(this);
|
||||
config = new File(FabricLoader.getInstance().getConfigDir().toFile(), "Terra");
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.dfsek.terra.fabric.world;
|
||||
|
||||
import com.dfsek.terra.registry.TerraRegistry;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public class FabricBiomeRegistry extends TerraRegistry<Biome> {
|
||||
}
|
||||
@@ -5,9 +5,15 @@ import com.dfsek.terra.api.generic.world.WorldHandle;
|
||||
import com.dfsek.terra.api.generic.world.block.Block;
|
||||
import com.dfsek.terra.api.generic.world.block.BlockData;
|
||||
import com.dfsek.terra.api.generic.world.block.MaterialData;
|
||||
import com.dfsek.terra.fabric.world.block.FabricBlockData;
|
||||
import com.dfsek.terra.fabric.world.block.FabricMaterialData;
|
||||
import com.dfsek.terra.fabric.world.block.data.FabricStairs;
|
||||
import com.dfsek.terra.fabric.world.block.data.FabricWaterlogged;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.command.argument.BlockArgumentParser;
|
||||
import net.minecraft.state.property.Properties;
|
||||
|
||||
public class FabricWorldHandle implements WorldHandle {
|
||||
@Override
|
||||
@@ -29,7 +35,11 @@ public class FabricWorldHandle implements WorldHandle {
|
||||
public FabricBlockData createBlockData(String data) {
|
||||
BlockArgumentParser parser = new BlockArgumentParser(new StringReader(data), true);
|
||||
try {
|
||||
return new FabricBlockData(parser.parse(true).getBlockState());
|
||||
BlockState state = parser.parse(true).getBlockState();
|
||||
if(state == null) throw new IllegalArgumentException("Invalid data: " + data);
|
||||
if(state.contains(Properties.STAIR_SHAPE)) return new FabricStairs(state);
|
||||
if(state.contains(Properties.WATERLOGGED)) return new FabricWaterlogged(state);
|
||||
return new FabricBlockData(state);
|
||||
} catch(CommandSyntaxException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.dfsek.terra.fabric.world;
|
||||
package com.dfsek.terra.fabric.world.block;
|
||||
|
||||
import com.dfsek.terra.api.generic.world.block.Block;
|
||||
import com.dfsek.terra.api.generic.world.block.BlockData;
|
||||
import com.dfsek.terra.api.generic.world.block.BlockFace;
|
||||
import com.dfsek.terra.api.generic.world.block.MaterialData;
|
||||
import com.dfsek.terra.api.generic.world.vector.Location;
|
||||
import com.dfsek.terra.fabric.world.FabricAdapters;
|
||||
import com.dfsek.terra.fabric.world.handles.world.FabricWorldAccess;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.dfsek.terra.fabric.world;
|
||||
package com.dfsek.terra.fabric.world.block;
|
||||
|
||||
import com.dfsek.terra.api.generic.world.block.BlockData;
|
||||
import com.dfsek.terra.api.generic.world.block.MaterialData;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
||||
public class FabricBlockData implements BlockData {
|
||||
private final BlockState delegate;
|
||||
protected BlockState delegate;
|
||||
|
||||
public FabricBlockData(BlockState delegate) {
|
||||
this.delegate = delegate;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.fabric.world;
|
||||
package com.dfsek.terra.fabric.world.block;
|
||||
|
||||
import com.dfsek.terra.api.generic.world.block.BlockData;
|
||||
import com.dfsek.terra.api.generic.world.block.MaterialData;
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.dfsek.terra.fabric.world.block.data;
|
||||
|
||||
import com.dfsek.terra.api.generic.world.block.BlockFace;
|
||||
import com.dfsek.terra.api.generic.world.block.data.Bisected;
|
||||
import com.dfsek.terra.api.generic.world.block.data.Stairs;
|
||||
import net.minecraft.block.enums.BlockHalf;
|
||||
import net.minecraft.block.enums.StairShape;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
public final class FabricEnumAdapter {
|
||||
public static Stairs.Shape fromFabricStairShape(StairShape shape) {
|
||||
switch(shape) {
|
||||
case OUTER_RIGHT:
|
||||
return Stairs.Shape.OUTER_RIGHT;
|
||||
case INNER_RIGHT:
|
||||
return Stairs.Shape.INNER_RIGHT;
|
||||
case OUTER_LEFT:
|
||||
return Stairs.Shape.OUTER_LEFT;
|
||||
case INNER_LEFT:
|
||||
return Stairs.Shape.INNER_LEFT;
|
||||
case STRAIGHT:
|
||||
return Stairs.Shape.STRAIGHT;
|
||||
default:
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
public static Bisected.Half fromFabricHalf(BlockHalf half) {
|
||||
switch(half) {
|
||||
case BOTTOM:
|
||||
return Bisected.Half.BOTTOM;
|
||||
case TOP:
|
||||
return Bisected.Half.TOP;
|
||||
default:
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
public static BlockFace fromFabricDirection(Direction direction) {
|
||||
switch(direction) {
|
||||
case DOWN:
|
||||
return BlockFace.DOWN;
|
||||
case UP:
|
||||
return BlockFace.UP;
|
||||
case WEST:
|
||||
return BlockFace.WEST;
|
||||
case EAST:
|
||||
return BlockFace.EAST;
|
||||
case NORTH:
|
||||
return BlockFace.NORTH;
|
||||
case SOUTH:
|
||||
return BlockFace.SOUTH;
|
||||
default:
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.dfsek.terra.fabric.world.block.data;
|
||||
|
||||
import com.dfsek.terra.api.generic.world.block.BlockFace;
|
||||
import com.dfsek.terra.api.generic.world.block.data.Stairs;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.property.Properties;
|
||||
|
||||
public class FabricStairs extends FabricWaterlogged implements Stairs {
|
||||
public FabricStairs(BlockState delegate) {
|
||||
super(delegate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Shape getShape() {
|
||||
return FabricEnumAdapter.fromFabricStairShape(getHandle().get(Properties.STAIR_SHAPE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShape(Shape shape) {
|
||||
super.delegate = getHandle().with(Properties.STAIR_SHAPE, TerraEnumAdapter.fromTerraStairShape(shape));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Half getHalf() {
|
||||
return FabricEnumAdapter.fromFabricHalf(getHandle().get(Properties.BLOCK_HALF));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHalf(Half half) {
|
||||
super.delegate = getHandle().with(Properties.BLOCK_HALF, TerraEnumAdapter.fromTerraHalf(half));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFace getFacing() {
|
||||
return FabricEnumAdapter.fromFabricDirection(getHandle().get(Properties.HORIZONTAL_FACING));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFacing(BlockFace facing) {
|
||||
super.delegate = getHandle().with(Properties.HORIZONTAL_FACING, TerraEnumAdapter.fromTerraBlockFace(facing));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.dfsek.terra.fabric.world.block.data;
|
||||
|
||||
import com.dfsek.terra.api.generic.world.block.data.Waterlogged;
|
||||
import com.dfsek.terra.fabric.world.block.FabricBlockData;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.property.Properties;
|
||||
|
||||
public class FabricWaterlogged extends FabricBlockData implements Waterlogged {
|
||||
public FabricWaterlogged(BlockState delegate) {
|
||||
super(delegate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWaterlogged() {
|
||||
return delegate.get(Properties.WATERLOGGED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWaterlogged(boolean waterlogged) {
|
||||
super.delegate = delegate.with(Properties.WATERLOGGED, waterlogged);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.dfsek.terra.fabric.world.block.data;
|
||||
|
||||
import com.dfsek.terra.api.generic.world.block.BlockFace;
|
||||
import com.dfsek.terra.api.generic.world.block.data.Bisected;
|
||||
import com.dfsek.terra.api.generic.world.block.data.Stairs;
|
||||
import net.minecraft.block.enums.BlockHalf;
|
||||
import net.minecraft.block.enums.StairShape;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
public final class TerraEnumAdapter {
|
||||
public static StairShape fromTerraStairShape(Stairs.Shape shape) {
|
||||
switch(shape) {
|
||||
case STRAIGHT:
|
||||
return StairShape.STRAIGHT;
|
||||
case INNER_LEFT:
|
||||
return StairShape.INNER_LEFT;
|
||||
case OUTER_LEFT:
|
||||
return StairShape.OUTER_LEFT;
|
||||
case INNER_RIGHT:
|
||||
return StairShape.INNER_RIGHT;
|
||||
case OUTER_RIGHT:
|
||||
return StairShape.OUTER_RIGHT;
|
||||
default:
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
public static BlockHalf fromTerraHalf(Bisected.Half half) {
|
||||
switch(half) {
|
||||
case TOP:
|
||||
return BlockHalf.TOP;
|
||||
case BOTTOM:
|
||||
return BlockHalf.BOTTOM;
|
||||
default:
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
public static Direction fromTerraBlockFace(BlockFace face) {
|
||||
switch(face) {
|
||||
case SOUTH:
|
||||
return Direction.SOUTH;
|
||||
case NORTH:
|
||||
return Direction.NORTH;
|
||||
case EAST:
|
||||
return Direction.EAST;
|
||||
case WEST:
|
||||
return Direction.WEST;
|
||||
case UP:
|
||||
return Direction.UP;
|
||||
case DOWN:
|
||||
return Direction.DOWN;
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package com.dfsek.terra.fabric.world.generator;
|
||||
|
||||
import com.dfsek.terra.api.generic.generator.ChunkGenerator;
|
||||
import com.dfsek.terra.api.generic.world.block.BlockData;
|
||||
import com.dfsek.terra.fabric.world.FabricBlockData;
|
||||
import com.dfsek.terra.fabric.world.block.FabricBlockData;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.dfsek.terra.fabric.world.handles.chunk;
|
||||
import com.dfsek.terra.api.generic.world.Chunk;
|
||||
import com.dfsek.terra.api.generic.world.World;
|
||||
import com.dfsek.terra.api.generic.world.block.Block;
|
||||
import com.dfsek.terra.fabric.world.FabricBlock;
|
||||
import com.dfsek.terra.fabric.world.block.FabricBlock;
|
||||
import com.dfsek.terra.fabric.world.handles.world.FabricWorldAccess;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ChunkRegion;
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.dfsek.terra.api.generic.world.Chunk;
|
||||
import com.dfsek.terra.api.generic.world.World;
|
||||
import com.dfsek.terra.api.generic.world.block.Block;
|
||||
import com.dfsek.terra.api.generic.world.vector.Location;
|
||||
import com.dfsek.terra.fabric.world.FabricBlock;
|
||||
import com.dfsek.terra.fabric.world.block.FabricBlock;
|
||||
import com.dfsek.terra.fabric.world.generator.FabricChunkGenerator;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
|
||||
@@ -7,8 +7,9 @@ import com.dfsek.terra.api.generic.world.Chunk;
|
||||
import com.dfsek.terra.api.generic.world.World;
|
||||
import com.dfsek.terra.api.generic.world.block.Block;
|
||||
import com.dfsek.terra.api.generic.world.vector.Location;
|
||||
import com.dfsek.terra.fabric.world.FabricBlock;
|
||||
import com.dfsek.terra.fabric.world.block.FabricBlock;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
|
||||
import java.io.File;
|
||||
@@ -24,7 +25,7 @@ public class FabricWorldAccess implements World {
|
||||
|
||||
@Override
|
||||
public long getSeed() {
|
||||
return 1234; // TODO: actually implement this
|
||||
return ((StructureWorldAccess) delegate).getSeed();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.dfsek.terra.api.generic.world.Chunk;
|
||||
import com.dfsek.terra.api.generic.world.World;
|
||||
import com.dfsek.terra.api.generic.world.block.Block;
|
||||
import com.dfsek.terra.api.generic.world.vector.Location;
|
||||
import com.dfsek.terra.fabric.world.FabricBlock;
|
||||
import com.dfsek.terra.fabric.world.block.FabricBlock;
|
||||
import com.dfsek.terra.fabric.world.generator.FabricChunkGenerator;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ChunkRegion;
|
||||
|
||||
Reference in New Issue
Block a user