mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-02 07:55:28 +00:00
remove Block from API
This commit is contained in:
parent
255e4396dd
commit
18d071128d
@ -1,35 +0,0 @@
|
||||
package com.dfsek.terra.api.block;
|
||||
|
||||
import com.dfsek.terra.api.Handle;
|
||||
import com.dfsek.terra.api.block.state.BlockState;
|
||||
import com.dfsek.terra.api.vector.Location;
|
||||
|
||||
public interface Block extends Handle {
|
||||
void setBlockData(BlockData data, boolean physics);
|
||||
|
||||
BlockData getBlockData();
|
||||
|
||||
BlockState getState();
|
||||
|
||||
default Block getRelative(BlockFace face) {
|
||||
return getRelative(face, 1);
|
||||
}
|
||||
|
||||
Block getRelative(BlockFace face, int len);
|
||||
|
||||
boolean isEmpty();
|
||||
|
||||
Location getLocation();
|
||||
|
||||
default BlockType getType() {
|
||||
return getBlockData().getBlockType();
|
||||
}
|
||||
|
||||
int getX();
|
||||
|
||||
int getZ();
|
||||
|
||||
int getY();
|
||||
|
||||
boolean isPassable();
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package com.dfsek.terra.api.block.state;
|
||||
|
||||
import com.dfsek.terra.api.Handle;
|
||||
import com.dfsek.terra.api.block.Block;
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.vector.Vector3;
|
||||
|
||||
public interface BlockState extends Handle {
|
||||
Block getBlock();
|
||||
Vector3 getPosition();
|
||||
|
||||
int getX();
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.dfsek.terra.api.event.events.world.generation;
|
||||
|
||||
import com.dfsek.terra.api.block.Block;
|
||||
import com.dfsek.terra.api.block.state.Container;
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.api.event.events.AbstractCancellable;
|
||||
@ -8,20 +7,19 @@ import com.dfsek.terra.api.event.events.Cancellable;
|
||||
import com.dfsek.terra.api.event.events.PackEvent;
|
||||
import com.dfsek.terra.api.structure.LootTable;
|
||||
import com.dfsek.terra.api.structure.Structure;
|
||||
import com.dfsek.terra.api.vector.Vector3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when loot is populated.
|
||||
*/
|
||||
public class LootPopulateEvent extends AbstractCancellable implements PackEvent, Cancellable {
|
||||
private final Block block;
|
||||
private final Container container;
|
||||
private LootTable table;
|
||||
private final ConfigPack pack;
|
||||
private final Structure structure;
|
||||
|
||||
public LootPopulateEvent(Block block, Container container, LootTable table, ConfigPack pack, Structure structure) {
|
||||
this.block = block;
|
||||
public LootPopulateEvent(Container container, LootTable table, ConfigPack pack, Structure structure) {
|
||||
this.container = container;
|
||||
this.table = table;
|
||||
this.pack = pack;
|
||||
@ -33,13 +31,8 @@ public class LootPopulateEvent extends AbstractCancellable implements PackEvent,
|
||||
return pack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the block containing the tile entity loot is applied to.
|
||||
*
|
||||
* @return Block at which loot is applied.
|
||||
*/
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
public Vector3 getPosition() {
|
||||
return container.getPosition();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.dfsek.terra.api.inventory;
|
||||
|
||||
import com.dfsek.terra.api.block.Block;
|
||||
import com.dfsek.terra.api.vector.Vector3;
|
||||
|
||||
public interface BlockInventoryHolder extends InventoryHolder {
|
||||
Block getBlock();
|
||||
Vector3 getPosition();
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.dfsek.terra.api.vector;
|
||||
|
||||
import com.dfsek.terra.api.block.Block;
|
||||
import com.dfsek.terra.api.world.World;
|
||||
|
||||
public interface Location extends Cloneable {
|
||||
@ -34,8 +33,6 @@ public interface Location extends Cloneable {
|
||||
|
||||
Location add(double x, double y, double z);
|
||||
|
||||
Block getBlock();
|
||||
|
||||
Location subtract(int x, int y, int z);
|
||||
|
||||
Location add(Vector3 add);
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.dfsek.terra.api.world;
|
||||
|
||||
import com.dfsek.terra.api.block.Block;
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
|
||||
public interface Chunk extends ChunkAccess {
|
||||
int getX();
|
||||
@ -9,5 +9,11 @@ public interface Chunk extends ChunkAccess {
|
||||
|
||||
World getWorld();
|
||||
|
||||
Block getBlock(int x, int y, int z);
|
||||
BlockData getBlockData(int x, int y, int z);
|
||||
|
||||
void setBlockData(int x, int y, int z, BlockData data, boolean physics);
|
||||
|
||||
default void setBlockData(int x, int y, int z, BlockData data) {
|
||||
setBlockData(x, y, z, data, false);
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
package com.dfsek.terra.api.world;
|
||||
|
||||
import com.dfsek.terra.api.block.Block;
|
||||
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;
|
||||
|
||||
public interface Flora {
|
||||
List<Block> getValidSpawnsAt(Chunk chunk, int x, int z, Range check);
|
||||
List<Vector3> getValidSpawnsAt(Chunk chunk, int x, int z, Range check);
|
||||
|
||||
boolean plant(Location l);
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
package com.dfsek.terra.api.world;
|
||||
|
||||
import com.dfsek.terra.api.Handle;
|
||||
import com.dfsek.terra.api.block.Block;
|
||||
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.generator.ChunkGenerator;
|
||||
import com.dfsek.terra.api.world.generator.GeneratorWrapper;
|
||||
import com.dfsek.terra.api.world.generator.TerraChunkGenerator;
|
||||
@ -22,10 +23,20 @@ public interface World extends Handle {
|
||||
return getChunkAt(location.getBlockX() >> 4, location.getBlockZ() >> 4);
|
||||
}
|
||||
|
||||
Block getBlockAt(int x, int y, int z);
|
||||
BlockData getBlockData(int x, int y, int z);
|
||||
|
||||
default Block getBlockAt(Location l) {
|
||||
return getBlockAt(l.getBlockX(), l.getBlockY(), l.getBlockZ());
|
||||
default BlockData getBlockData(Vector3 position) {
|
||||
return getBlockData(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||
}
|
||||
|
||||
void setBlockData(int x, int y, int z, BlockData data, boolean physics);
|
||||
|
||||
default void setBlockData(int x, int y, int z, BlockData data) {
|
||||
setBlockData(x, y, z, data, false);
|
||||
}
|
||||
|
||||
default void setBlockData(Vector3 position, BlockData data) {
|
||||
setBlockData(position.getBlockX(), position.getBlockY(), position.getBlockZ(), data);
|
||||
}
|
||||
|
||||
Entity spawnEntity(Location location, EntityType entityType);
|
||||
|
Loading…
x
Reference in New Issue
Block a user