Skip to content

Commit 2574f61

Browse files
committed
more documentation efforts
1 parent 339d6da commit 2574f61

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

src/main/java/com/gtnewhorizon/structurelib/structure/AutoPlaceEnvironment.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.util.function.Predicate;
77
import javax.annotation.Nonnull;
88
import net.minecraft.entity.player.EntityPlayer;
9+
import net.minecraft.entity.player.EntityPlayerMP;
910
import net.minecraft.item.ItemStack;
1011
import net.minecraft.util.IChatComponent;
1112

@@ -96,7 +97,9 @@ void setSource(IItemSource source) {
9697
}
9798

9899
public APILevel getAPILevel() {
99-
return definition == null ? APILevel.Legacy : APILevel.V2;
100+
return definition == null
101+
? actor instanceof EntityPlayerMP ? APILevel.Legacy : APILevel.LegacyRelaxed
102+
: APILevel.V2;
100103
}
101104

102105
/**
@@ -126,6 +129,7 @@ public Consumer<IChatComponent> getChatter() {
126129

127130
/**
128131
* Test if given location is contained within the current piece.
132+
*
129133
* @param offsetA offset in A direction <b>relative to current element</b>
130134
* @param offsetB offset in B direction <b>relative to current element</b>
131135
* @param offsetC offset in C direction <b>relative to current element</b>
@@ -210,8 +214,25 @@ public boolean takeAll(ItemStack stack, boolean simulate) {
210214
}
211215
}
212216

217+
/**
218+
* Defines the various API level an {@link AutoPlaceEnvironment} has implemented.
219+
* <p>
220+
* Enum constants are defined in chronological order.
221+
*/
213222
public enum APILevel {
223+
/**
224+
* Implements {@link #getChatter()}, {@link #getActor()} and {@link #getSource()}.
225+
* {@link #getActor()} is guaranteed to be an {@link net.minecraft.entity.player.EntityPlayerMP}
226+
*/
214227
Legacy,
228+
/**
229+
* Implements {@link #getChatter()}, {@link #getActor()} and {@link #getSource()}.
230+
* {@link #getActor()} is <b>NOT</b> guaranteed to be an {@link net.minecraft.entity.player.EntityPlayerMP}
231+
*/
232+
LegacyRelaxed,
233+
/**
234+
* Implements everything so far we have defined.
235+
*/
215236
V2,
216237
}
217238
}

0 commit comments

Comments
 (0)