From a092dfdc3be8af5f60ce92f420743c3aac0dfa4e Mon Sep 17 00:00:00 2001 From: dfsek Date: Thu, 23 Dec 2021 14:43:43 -0700 Subject: [PATCH] document a bunch of stuff --- .../com/dfsek/terra/api/addon/BaseAddon.java | 14 +++++ .../addon/bootstrap/BootstrapBaseAddon.java | 10 ++++ .../com/dfsek/terra/api/block/BlockType.java | 15 +++++ .../terra/api/block/state/BlockState.java | 55 +++++++++++++++++++ .../api/block/state/properties/Property.java | 17 +++++- .../properties/base/BooleanProperty.java | 2 +- .../state/properties/base/EnumProperty.java | 2 +- .../state/properties/base/IntProperty.java | 2 +- .../api/config/AbstractableTemplate.java | 3 + .../api/structure/feature/BinaryColumn.java | 35 ++++++++++++ .../exception/AttemptsFailedException.java | 3 + .../dfsek/terra/api/util/vector/Vector2.java | 12 ++-- .../terra/api/util/vector/Vector2Int.java | 12 ++-- .../dfsek/terra/api/util/vector/Vector3.java | 14 ++--- .../terra/api/util/vector/Vector3Int.java | 10 +--- .../dfsek/terra/api/world/BufferedWorld.java | 8 +++ .../dfsek/terra/api/world/ReadableWorld.java | 28 +++++++--- .../java/com/dfsek/terra/api/world/World.java | 15 +++++ .../dfsek/terra/api/world/biome/Biome.java | 19 +++++-- .../world/biome/generation/BiomeProvider.java | 35 ++++++++++++ .../block/state/PropertyMixin.java | 19 ++++--- 21 files changed, 272 insertions(+), 58 deletions(-) diff --git a/common/api/src/main/java/com/dfsek/terra/api/addon/BaseAddon.java b/common/api/src/main/java/com/dfsek/terra/api/addon/BaseAddon.java index 0b8ad7844..4cf38e33e 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/addon/BaseAddon.java +++ b/common/api/src/main/java/com/dfsek/terra/api/addon/BaseAddon.java @@ -16,12 +16,26 @@ import java.util.Map; import com.dfsek.terra.api.util.StringIdentifiable; +/** + * Base interface which all Terra addons extend + */ public interface BaseAddon extends StringIdentifiable { + /** + * Initializes the addon. To be implemented by addons, but never manually invoked. + */ default void initialize() { } + /** + * Gets the dependencies of this addon. + * @return Map of dependency ID to {@link VersionRange} of dependency + */ default Map getDependencies() { return Collections.emptyMap(); } + /** + * Get the version of the addon + * @return Version of addon + */ Version getVersion(); } diff --git a/common/api/src/main/java/com/dfsek/terra/api/addon/bootstrap/BootstrapBaseAddon.java b/common/api/src/main/java/com/dfsek/terra/api/addon/bootstrap/BootstrapBaseAddon.java index f47016a4d..87645eb31 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/addon/bootstrap/BootstrapBaseAddon.java +++ b/common/api/src/main/java/com/dfsek/terra/api/addon/bootstrap/BootstrapBaseAddon.java @@ -12,6 +12,16 @@ import java.nio.file.Path; import com.dfsek.terra.api.addon.BaseAddon; +/** + * Interface representing a bootstrap addon. + * + * A bootstrap addon is the only type of addon Terra implements a loader for. + * It is a minimal base for addon loaders to be implemented on top of. + * + * Unless you are writing your own addon loader, you will want to depend on the + * {@code manifest-addon-loader} addon, and implement its AddonInitializer. + * @param Type of addon this bootstrap addon loads + */ public interface BootstrapBaseAddon extends BaseAddon { /** * Load all the relevant addons in the specified path. diff --git a/common/api/src/main/java/com/dfsek/terra/api/block/BlockType.java b/common/api/src/main/java/com/dfsek/terra/api/block/BlockType.java index ca585c184..2ff7e9849 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/block/BlockType.java +++ b/common/api/src/main/java/com/dfsek/terra/api/block/BlockType.java @@ -11,10 +11,25 @@ import com.dfsek.terra.api.Handle; import com.dfsek.terra.api.block.state.BlockState; +/** + * Represents a type of block + */ public interface BlockType extends Handle { + /** + * Get the default {@link BlockState} of this block + * @return Default block state + */ BlockState getDefaultState(); + /** + * Get whether this block is solid. + * @return Whether this block is solid. + */ boolean isSolid(); + /** + * Get whether this block is water. + * @return Whether this block is water. + */ boolean isWater(); } diff --git a/common/api/src/main/java/com/dfsek/terra/api/block/state/BlockState.java b/common/api/src/main/java/com/dfsek/terra/api/block/state/BlockState.java index 47a286aa9..767ade006 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/block/state/BlockState.java +++ b/common/api/src/main/java/com/dfsek/terra/api/block/state/BlockState.java @@ -14,33 +14,88 @@ import com.dfsek.terra.api.block.BlockType; import com.dfsek.terra.api.block.state.properties.Property; +/** + * Contains basic data about a {@link BlockType} in the world + */ public interface BlockState extends Handle { + /** + * Whether this {@link BlockState} matches another. + * + * "matches" is defined as this {@link BlockState} holding a matching {@link #getBlockType()}. + * @param other Other {@link BlockState} + * @return Whether this state matches the other + */ boolean matches(BlockState other); + /** + * Check whether this {@link BlockState} has a {@link Property}. + * @param property Property to check for + * @return Whether this state has the property. + */ > boolean has(Property property); + /** + * Get the value of a {@link Property} on this state. + * @param property Property to get + * @return Value of the property + */ > T get(Property property); + /** + * Return a new {@link BlockState} with a {@link Property} set to a value. + * @param property Property to set + * @param value Value of property + * @return New {@link BlockState} with property set. + */ > BlockState set(Property property, T value); + /** + * Perform an action on this {@link BlockState} if it contains a {@link Property} + * @param property Property to check for + * @param action Action to perform if property is present + * @return This {@link BlockState} + */ default > BlockState ifProperty(Property property, Consumer action) { if(has(property)) action.accept(this); return this; } + /** + * Set the value of a {@link Property} on this {@link BlockState} if it is present. + * @param property Property to check for/set. + * @param value Value to set if property is present. + * @return Thie {@link BlockState} + */ default > BlockState setIfPresent(Property property, T value) { if(has(property)) set(property, value); return this; } + /** + * Get the {@link BlockType} this state applies to. + * @return Block type. + */ BlockType getBlockType(); + /** + * Get this state and its properties as a String + * @return String representation of this state + */ default String getAsString() { return getAsString(true); } + /** + * Get this state and its properties as a String + * @param properties Whether to include properties + * @return String representation of this state + */ String getAsString(boolean properties); + /** + * Get whether this BlockState is air + * @return Whether this state is air + */ boolean isAir(); } diff --git a/common/api/src/main/java/com/dfsek/terra/api/block/state/properties/Property.java b/common/api/src/main/java/com/dfsek/terra/api/block/state/properties/Property.java index 6384e30f8..77dff153c 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/block/state/properties/Property.java +++ b/common/api/src/main/java/com/dfsek/terra/api/block/state/properties/Property.java @@ -7,13 +7,24 @@ package com.dfsek.terra.api.block.state.properties; +import com.dfsek.terra.api.util.StringIdentifiable; + import java.util.Collection; -public interface Property { +/** + * Represents a property a state holds + */ +public interface Property extends StringIdentifiable { + /** + * Get all possible values of this property + * @return All values of this property + */ Collection values(); + /** + * Get the type of this property. + * @return {@link Class} instance representing the type of this property + */ Class getType(); - - String getName(); } diff --git a/common/api/src/main/java/com/dfsek/terra/api/block/state/properties/base/BooleanProperty.java b/common/api/src/main/java/com/dfsek/terra/api/block/state/properties/base/BooleanProperty.java index 21da000cc..e005145e0 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/block/state/properties/base/BooleanProperty.java +++ b/common/api/src/main/java/com/dfsek/terra/api/block/state/properties/base/BooleanProperty.java @@ -24,7 +24,7 @@ public interface BooleanProperty extends Property { } @Override - public String getName() { + public String getID() { return name; } }; diff --git a/common/api/src/main/java/com/dfsek/terra/api/block/state/properties/base/EnumProperty.java b/common/api/src/main/java/com/dfsek/terra/api/block/state/properties/base/EnumProperty.java index b09bd1215..df0f3b52c 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/block/state/properties/base/EnumProperty.java +++ b/common/api/src/main/java/com/dfsek/terra/api/block/state/properties/base/EnumProperty.java @@ -30,7 +30,7 @@ public interface EnumProperty> extends Property { } @Override - public String getName() { + public String getID() { return name; } }; diff --git a/common/api/src/main/java/com/dfsek/terra/api/block/state/properties/base/IntProperty.java b/common/api/src/main/java/com/dfsek/terra/api/block/state/properties/base/IntProperty.java index 9a56b5690..b671e4689 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/block/state/properties/base/IntProperty.java +++ b/common/api/src/main/java/com/dfsek/terra/api/block/state/properties/base/IntProperty.java @@ -32,7 +32,7 @@ public interface IntProperty extends Property { } @Override - public String getName() { + public String getID() { return name; } }; diff --git a/common/api/src/main/java/com/dfsek/terra/api/config/AbstractableTemplate.java b/common/api/src/main/java/com/dfsek/terra/api/config/AbstractableTemplate.java index dbac9483f..2cdd49291 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/config/AbstractableTemplate.java +++ b/common/api/src/main/java/com/dfsek/terra/api/config/AbstractableTemplate.java @@ -12,5 +12,8 @@ import com.dfsek.tectonic.api.config.template.ConfigTemplate; import com.dfsek.terra.api.util.StringIdentifiable; +/** + * An abstractable config template + */ public interface AbstractableTemplate extends ConfigTemplate, StringIdentifiable { } diff --git a/common/api/src/main/java/com/dfsek/terra/api/structure/feature/BinaryColumn.java b/common/api/src/main/java/com/dfsek/terra/api/structure/feature/BinaryColumn.java index 56a8776e8..ecee83d35 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/structure/feature/BinaryColumn.java +++ b/common/api/src/main/java/com/dfsek/terra/api/structure/feature/BinaryColumn.java @@ -10,24 +10,45 @@ package com.dfsek.terra.api.structure.feature; import java.util.function.IntConsumer; +/** + * A column of binary data + */ public class BinaryColumn { private final boolean[] data; private final int minY; + /** + * Constructs a new {@link BinaryColumn} with all values initiated to {@code false} + * @param minY Minimum Y value + * @param maxY Maximum Y value + */ public BinaryColumn(int minY, int maxY) { this.minY = minY; if(maxY <= minY) throw new IllegalArgumentException("Max y must be greater than min y"); this.data = new boolean[maxY - minY]; } + /** + * Set the value of a height to {@code true}. + * @param y Height of entry to set. + */ public void set(int y) { data[y - minY] = true; } + /** + * Get the value at a height. + * @param y Height of entry to get. + * @return Whether height has been set. + */ public boolean get(int y) { return data[y - minY]; } + /** + * Perform an action for all heights which have been set. + * @param consumer Action to perform + */ public void forEach(IntConsumer consumer) { for(int y = 0; y < data.length; y++) { if(data[y]) { @@ -36,6 +57,13 @@ public class BinaryColumn { } } + /** + * Return a {@link BinaryColumn} of equal height with a boolean AND operation applied to each height. + * @param that Other binary column, must match this column's height. + * @return Merged column. + * + * @throws IllegalArgumentException if column heights do not match + */ public BinaryColumn and(BinaryColumn that) { if(that.minY != this.minY) throw new IllegalArgumentException("Must share same min Y"); if(that.data.length != this.data.length) throw new IllegalArgumentException("Must share same max Y"); @@ -48,6 +76,13 @@ public class BinaryColumn { return next; } + /** + * Return a {@link BinaryColumn} of equal height with a boolean OR operation applied to each height. + * @param that Other binary column, must match this column's height. + * @return Merged column. + * + * @throws IllegalArgumentException if column heights do not match + */ public BinaryColumn or(BinaryColumn that) { if(that.minY != this.minY) throw new IllegalArgumentException("Must share same min Y"); if(that.data.length != this.data.length) throw new IllegalArgumentException("Must share same max Y"); diff --git a/common/api/src/main/java/com/dfsek/terra/api/transform/exception/AttemptsFailedException.java b/common/api/src/main/java/com/dfsek/terra/api/transform/exception/AttemptsFailedException.java index 5f83706f3..8cc6bab87 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/transform/exception/AttemptsFailedException.java +++ b/common/api/src/main/java/com/dfsek/terra/api/transform/exception/AttemptsFailedException.java @@ -13,6 +13,9 @@ import java.util.ArrayList; import java.util.List; +/** + * Thrown when all transformation attempts fail + */ public class AttemptsFailedException extends RuntimeException { @Serial private static final long serialVersionUID = -1160459550006067137L; diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/vector/Vector2.java b/common/api/src/main/java/com/dfsek/terra/api/util/vector/Vector2.java index aa0336253..3f3c0e50f 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/util/vector/Vector2.java +++ b/common/api/src/main/java/com/dfsek/terra/api/util/vector/Vector2.java @@ -15,9 +15,9 @@ import com.dfsek.terra.api.util.MathUtil; /** * oh yeah */ -public class Vector2 implements Cloneable { - private final double x; - private final double z; +public class Vector2 { + protected double x; + protected double z; /** * Create a vector with a given X and Z component @@ -127,12 +127,10 @@ public class Vector2 implements Cloneable { return new Mutable(x, z); } - public static class Mutable { - private double x, z; + public static class Mutable extends Vector2 { private Mutable(double x, double z) { - this.x = x; - this.z = z; + super(x, z); } public double getX() { diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/vector/Vector2Int.java b/common/api/src/main/java/com/dfsek/terra/api/util/vector/Vector2Int.java index 735f80cb7..00418245a 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/util/vector/Vector2Int.java +++ b/common/api/src/main/java/com/dfsek/terra/api/util/vector/Vector2Int.java @@ -2,8 +2,6 @@ package com.dfsek.terra.api.util.vector; import com.dfsek.terra.api.util.Rotation; -import java.util.Objects; - /** * oh yeah @@ -11,8 +9,8 @@ import java.util.Objects; public class Vector2Int { private static final Vector2Int ZERO = new Vector2Int(0, 0); private static final Vector2Int UNIT = new Vector2Int(0, 1); - private final int x; - private final int z; + protected int x; + protected int z; protected Vector2Int(int x, int z) { this.x = x; @@ -56,12 +54,10 @@ public class Vector2Int { }; } - public static class Mutable { - private int x, z; + public static class Mutable extends Vector2Int { protected Mutable(int x, int z) { - this.x = x; - this.z = z; + super(x, z); } public int getZ() { diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/vector/Vector3.java b/common/api/src/main/java/com/dfsek/terra/api/util/vector/Vector3.java index 480c255fd..21ec63ba8 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/util/vector/Vector3.java +++ b/common/api/src/main/java/com/dfsek/terra/api/util/vector/Vector3.java @@ -14,9 +14,9 @@ import com.dfsek.terra.api.util.MathUtil; public class Vector3 { - private final double x; - private final double y; - private final double z; + protected double x; + protected double y; + protected double z; private Vector3(double x, double y, double z) { this.x = x; @@ -146,13 +146,9 @@ public class Vector3 { return new Mutable(x, y, z); } - public static class Mutable { - private double x, y, z; - + public static class Mutable extends Vector3 { private Mutable(double x, double y, double z) { - this.x = x; - this.y = y; - this.z = z; + super(x, y, z); } public static Mutable of(double x, double y, double z) { diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/vector/Vector3Int.java b/common/api/src/main/java/com/dfsek/terra/api/util/vector/Vector3Int.java index 3d5ef04cf..671595949 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/util/vector/Vector3Int.java +++ b/common/api/src/main/java/com/dfsek/terra/api/util/vector/Vector3Int.java @@ -4,7 +4,7 @@ package com.dfsek.terra.api.util.vector; public class Vector3Int { private static final Vector3Int ZERO = new Vector3Int(0, 0, 0); private static final Vector3Int UNIT = new Vector3Int(0, 1, 0); - private final int x, y, z; + protected int x, y, z; protected Vector3Int(int x, int y, int z) { this.x = x; @@ -48,13 +48,9 @@ public class Vector3Int { return Vector3.Mutable.of(x, y, z); } - public static class Mutable { - private int x, y, z; - + public static class Mutable extends Vector3Int { protected Mutable(int x, int y, int z) { - this.x = x; - this.y = y; - this.z = z; + super(x, y, z); } public int getX() { diff --git a/common/api/src/main/java/com/dfsek/terra/api/world/BufferedWorld.java b/common/api/src/main/java/com/dfsek/terra/api/world/BufferedWorld.java index 79e7f5184..ce235e624 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/world/BufferedWorld.java +++ b/common/api/src/main/java/com/dfsek/terra/api/world/BufferedWorld.java @@ -9,6 +9,10 @@ import com.dfsek.terra.api.world.biome.generation.BiomeProvider; import com.dfsek.terra.api.world.chunk.generation.ChunkGenerator; +/** + * A {@link WritableWorld} implementation which delegates read/write operations to + * another {@link WritableWorld}, at an offset. + */ public class BufferedWorld implements WritableWorld { private final WritableWorld delegate; private final int offsetX, offsetY, offsetZ; @@ -76,6 +80,10 @@ public class BufferedWorld implements WritableWorld { return delegate.spawnEntity(x + offsetX, y + offsetY, z + offsetZ, entityType); } + /** + * Get the world this {@link BufferedWorld} delegates to. + * @return Delegate world. + */ public WritableWorld getDelegate() { return delegate; } diff --git a/common/api/src/main/java/com/dfsek/terra/api/world/ReadableWorld.java b/common/api/src/main/java/com/dfsek/terra/api/world/ReadableWorld.java index da62d003b..3be9517bd 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/world/ReadableWorld.java +++ b/common/api/src/main/java/com/dfsek/terra/api/world/ReadableWorld.java @@ -6,25 +6,37 @@ import com.dfsek.terra.api.util.vector.Vector3; import com.dfsek.terra.api.util.vector.Vector3Int; +/** + * A {@link World} with read access. + */ public interface ReadableWorld extends World { + /** + * Get the {@link BlockState} at a location. + * @param x X coordinate + * @param y Y coordinate + * @param z Z coordinate + * @return {@link BlockState} at coordinates. + */ BlockState getBlockState(int x, int y, int z); + /** + * Get the {@link BlockState} at a location. + * @param position Location to get block. + * @return {@link BlockState} at coordinates. + */ default BlockState getBlockState(Vector3 position) { return getBlockState(position.getBlockX(), position.getBlockY(), position.getBlockZ()); } - default BlockState getBlockState(Vector3.Mutable position) { - return getBlockState(position.getBlockX(), position.getBlockY(), position.getBlockZ()); - } - + /** + * Get the {@link BlockState} at a location. + * @param position Location to get block. + * @return {@link BlockState} at coordinates. + */ default BlockState getBlockState(Vector3Int position) { return getBlockState(position.getX(), position.getY(), position.getZ()); } - default BlockState getBlockState(Vector3Int.Mutable position) { - return getBlockState(position.getX(), position.getY(), position.getZ()); - } - BlockEntity getBlockEntity(int x, int y, int z); default BlockEntity getBlockEntity(Vector3 position) { diff --git a/common/api/src/main/java/com/dfsek/terra/api/world/World.java b/common/api/src/main/java/com/dfsek/terra/api/world/World.java index 9c12a3724..973e0194d 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/world/World.java +++ b/common/api/src/main/java/com/dfsek/terra/api/world/World.java @@ -6,10 +6,25 @@ import com.dfsek.terra.api.world.chunk.generation.ChunkGenerator; import com.dfsek.terra.api.world.info.WorldProperties; +/** + * Represents a world. + */ public interface World extends WorldProperties { + /** + * Get the {@link ChunkGenerator} this world uses. + * @return Chunk generator. + */ ChunkGenerator getGenerator(); + /** + * Get the {@link BiomeProvider} this world uses. + * @return Biome provider. + */ BiomeProvider getBiomeProvider(); + /** + * Get the {@link ConfigPack} this world uses. + * @return Config pack. + */ ConfigPack getPack(); } diff --git a/common/api/src/main/java/com/dfsek/terra/api/world/biome/Biome.java b/common/api/src/main/java/com/dfsek/terra/api/world/biome/Biome.java index db611a6e4..bc60c606f 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/world/biome/Biome.java +++ b/common/api/src/main/java/com/dfsek/terra/api/world/biome/Biome.java @@ -11,23 +11,30 @@ package com.dfsek.terra.api.world.biome; import java.util.Set; import com.dfsek.terra.api.properties.PropertyHolder; +import com.dfsek.terra.api.util.StringIdentifiable; /** - * Represents a custom biome + * Represents a Terra biome */ -public interface Biome extends PropertyHolder { +public interface Biome extends PropertyHolder, StringIdentifiable { /** - * Gets the Vanilla biome to represent the custom biome. + * Gets the platform biome this custom biome delegates to. * - * @return TerraBiome - The Vanilla biome. + * @return The platform biome. */ PlatformBiome getPlatformBiome(); + /** + * Get the color of this biome. + * @return ARGB color of this biome + */ int getColor(); + /** + * Get the tags this biome holds + * @return A {@link Set} of String tags this biome holds. + */ Set getTags(); - - String getID(); } diff --git a/common/api/src/main/java/com/dfsek/terra/api/world/biome/generation/BiomeProvider.java b/common/api/src/main/java/com/dfsek/terra/api/world/biome/generation/BiomeProvider.java index 7c2b93c48..b38d537f1 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/world/biome/generation/BiomeProvider.java +++ b/common/api/src/main/java/com/dfsek/terra/api/world/biome/generation/BiomeProvider.java @@ -12,16 +12,51 @@ import com.dfsek.terra.api.util.vector.Vector3; import com.dfsek.terra.api.world.biome.Biome; +/** + * Provides locations of biomes in a world. + */ public interface BiomeProvider { + /** + * Get the biome at a location. + * + * @param x X coordinate + * @param z Z coordinate + * @param seed World seed + * + * @return Biome at the location + */ Biome getBiome(int x, int z, long seed); + /** + * Get the biome at a location. + * + * @param vector2 Location + * @param seed World seed + * + * @return Biome at the location + */ default Biome getBiome(Vector2 vector2, long seed) { return getBiome(vector2.getBlockX(), vector2.getBlockZ(), seed); } + /** + * Get the biome at a location. + * + * @param vector3 Location + * @param seed World seed + * + * @return Biome at the location + */ default Biome getBiome(Vector3 vector3, long seed) { return getBiome(vector3.getBlockX(), vector3.getBlockZ(), seed); } + /** + * Get all biomes this {@link BiomeProvider} is capable of generating in the world. + *

+ * Must contain all biomes that could possibly generate. + * + * @return {@link Iterable} of all biomes this provider can generate. + */ Iterable getBiomes(); } diff --git a/platforms/fabric/src/main/java/com/dfsek/terra/fabric/mixin/implementations/block/state/PropertyMixin.java b/platforms/fabric/src/main/java/com/dfsek/terra/fabric/mixin/implementations/block/state/PropertyMixin.java index 64d34be12..e674fcb69 100644 --- a/platforms/fabric/src/main/java/com/dfsek/terra/fabric/mixin/implementations/block/state/PropertyMixin.java +++ b/platforms/fabric/src/main/java/com/dfsek/terra/fabric/mixin/implementations/block/state/PropertyMixin.java @@ -3,6 +3,10 @@ package com.dfsek.terra.fabric.mixin.implementations.block.state; import com.dfsek.terra.api.block.state.properties.Property; import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Implements; +import org.spongepowered.asm.mixin.Interface; +import org.spongepowered.asm.mixin.Interface.Remap; +import org.spongepowered.asm.mixin.Intrinsic; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -10,7 +14,8 @@ import java.util.Collection; @Mixin(net.minecraft.state.property.Property.class) -public abstract class PropertyMixin implements Property { +@Implements(@Interface(iface = Property.class, prefix = "terra$", remap = Remap.NONE)) +public abstract class PropertyMixin { @Shadow @Final private Class type; @@ -22,18 +27,18 @@ public abstract class PropertyMixin implements Property { @Final private String name; - @Override - public Collection values() { + @Intrinsic + public Collection terra$values() { return getValues(); } - @Override - public Class getType() { + @Intrinsic + public Class terra$getType() { return type; } - @Override - public String getName() { + @Intrinsic + public String terra$getID() { return name; } }