Skip to content

Commit

Permalink
more documentation efforts
Browse files Browse the repository at this point in the history
  • Loading branch information
Glease committed Sep 16, 2022
1 parent 7a2328c commit 978938d
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.function.Predicate;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IChatComponent;

Expand Down Expand Up @@ -96,7 +97,9 @@ void setSource(IItemSource source) {
}

public APILevel getAPILevel() {
return definition == null ? APILevel.Legacy : APILevel.V2;
return definition == null
? actor instanceof EntityPlayerMP ? APILevel.Legacy : APILevel.LegacyRelaxed
: APILevel.V2;
}

/**
Expand Down Expand Up @@ -126,6 +129,7 @@ public Consumer<IChatComponent> getChatter() {

/**
* Test if given location is contained within the current piece.
*
* @param offsetA offset in A direction <b>relative to current element</b>
* @param offsetB offset in B direction <b>relative to current element</b>
* @param offsetC offset in C direction <b>relative to current element</b>
Expand Down Expand Up @@ -210,8 +214,25 @@ public boolean takeAll(ItemStack stack, boolean simulate) {
}
}

/**
* Defines the various API level an {@link AutoPlaceEnvironment} has implemented.
* <p>
* Enum constants are defined in chronological order.
*/
public enum APILevel {
/**
* Implements {@link #getChatter()}, {@link #getActor()} and {@link #getSource()}.
* {@link #getActor()} is guaranteed to be an {@link net.minecraft.entity.player.EntityPlayerMP}
*/
Legacy,
/**
* Implements {@link #getChatter()}, {@link #getActor()} and {@link #getSource()}.
* {@link #getActor()} is <b>NOT</b> guaranteed to be an {@link net.minecraft.entity.player.EntityPlayerMP}
*/
LegacyRelaxed,
/**
* Implements everything so far we have defined.
*/
V2,
}
}

0 comments on commit 978938d

Please sign in to comment.