mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 02:20:57 +00:00
Entity SNBT Support and Cleanup
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
package com.dfsek.terra.api.block;
|
||||
|
||||
import com.dfsek.terra.api.Handle;
|
||||
|
||||
|
||||
public interface BlockData extends Handle {
|
||||
String toString();
|
||||
}
|
||||
@@ -12,12 +12,13 @@ import java.util.function.Consumer;
|
||||
import com.dfsek.terra.api.Handle;
|
||||
import com.dfsek.terra.api.block.BlockType;
|
||||
import com.dfsek.terra.api.block.state.properties.Property;
|
||||
import com.dfsek.terra.api.data.Extendable;
|
||||
|
||||
|
||||
/**
|
||||
* Contains basic data about a {@link BlockType} in the world
|
||||
*/
|
||||
public interface BlockState extends Handle {
|
||||
public interface BlockState extends Handle, Extendable {
|
||||
|
||||
/**
|
||||
* Whether this {@link BlockState} matches another.
|
||||
@@ -115,12 +116,4 @@ public interface BlockState extends Handle {
|
||||
* @return Whether this state is air
|
||||
*/
|
||||
boolean isAir();
|
||||
|
||||
/**
|
||||
* Get whether this BlockState is an extended state.
|
||||
* Extended states are states that contain extra data not normally present in a BlockState.
|
||||
*
|
||||
* @return Whether this state is extended.
|
||||
*/
|
||||
default boolean isExtended() { return false; }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.dfsek.terra.api.block.state;
|
||||
|
||||
import com.dfsek.terra.api.block.BlockData;
|
||||
import com.dfsek.terra.api.data.ExtendedData;
|
||||
|
||||
|
||||
public interface BlockStateExtended extends BlockState {
|
||||
@@ -9,7 +9,7 @@ public interface BlockStateExtended extends BlockState {
|
||||
*
|
||||
* @return BlockData of this BlockStateExtended
|
||||
*/
|
||||
BlockData getData();
|
||||
ExtendedData getData();
|
||||
|
||||
/**
|
||||
* Sets the BlockData.
|
||||
@@ -18,7 +18,7 @@ public interface BlockStateExtended extends BlockState {
|
||||
*
|
||||
* @return New BlockStateExtended with the given BlockData
|
||||
*/
|
||||
BlockStateExtended setData(BlockData data);
|
||||
BlockStateExtended setData(ExtendedData data);
|
||||
|
||||
/**
|
||||
* Gets the BlockState.
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.dfsek.terra.api.data;
|
||||
|
||||
public interface Extendable {
|
||||
/**
|
||||
* Get whether this BlockState is an extended state.
|
||||
* Extended states are states that contain extra data not normally present in a BlockState.
|
||||
*
|
||||
* @return Whether this state is extended.
|
||||
*/
|
||||
default boolean isExtended() { return false; }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.dfsek.terra.api.data;
|
||||
|
||||
import com.dfsek.terra.api.Handle;
|
||||
|
||||
|
||||
public interface ExtendedData extends Handle {
|
||||
String toString();
|
||||
}
|
||||
@@ -8,7 +8,8 @@
|
||||
package com.dfsek.terra.api.entity;
|
||||
|
||||
import com.dfsek.terra.api.Handle;
|
||||
import com.dfsek.terra.api.data.Extendable;
|
||||
|
||||
|
||||
public interface EntityType extends Handle {
|
||||
public interface EntityType extends Handle, Extendable {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.dfsek.terra.api.entity;
|
||||
|
||||
import com.dfsek.terra.api.data.ExtendedData;
|
||||
|
||||
|
||||
public interface EntityTypeExtended extends EntityType {
|
||||
/**
|
||||
* Gets the BlockData.
|
||||
*
|
||||
* @return BlockData of this EntityTypeExtended
|
||||
*/
|
||||
ExtendedData getData();
|
||||
|
||||
/**
|
||||
* Sets the BlockData.
|
||||
*
|
||||
* @param data BlockData to set
|
||||
*
|
||||
* @return New EntityTypeExtended with the given BlockData
|
||||
*/
|
||||
EntityTypeExtended setData(ExtendedData data);
|
||||
|
||||
/**
|
||||
* Gets the EntityType.
|
||||
*
|
||||
* @return Raw EntityType of this EntityTypeExtended
|
||||
*/
|
||||
EntityType getType();
|
||||
|
||||
@Override
|
||||
default boolean isExtended() { return true; }
|
||||
}
|
||||
Reference in New Issue
Block a user