|
6 | 6 | import java.util.function.Predicate; |
7 | 7 | import javax.annotation.Nonnull; |
8 | 8 | import net.minecraft.entity.player.EntityPlayer; |
| 9 | +import net.minecraft.entity.player.EntityPlayerMP; |
9 | 10 | import net.minecraft.item.ItemStack; |
10 | 11 | import net.minecraft.util.IChatComponent; |
11 | 12 |
|
@@ -96,7 +97,9 @@ void setSource(IItemSource source) { |
96 | 97 | } |
97 | 98 |
|
98 | 99 | 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; |
100 | 103 | } |
101 | 104 |
|
102 | 105 | /** |
@@ -126,6 +129,7 @@ public Consumer<IChatComponent> getChatter() { |
126 | 129 |
|
127 | 130 | /** |
128 | 131 | * Test if given location is contained within the current piece. |
| 132 | + * |
129 | 133 | * @param offsetA offset in A direction <b>relative to current element</b> |
130 | 134 | * @param offsetB offset in B direction <b>relative to current element</b> |
131 | 135 | * @param offsetC offset in C direction <b>relative to current element</b> |
@@ -210,8 +214,25 @@ public boolean takeAll(ItemStack stack, boolean simulate) { |
210 | 214 | } |
211 | 215 | } |
212 | 216 |
|
| 217 | + /** |
| 218 | + * Defines the various API level an {@link AutoPlaceEnvironment} has implemented. |
| 219 | + * <p> |
| 220 | + * Enum constants are defined in chronological order. |
| 221 | + */ |
213 | 222 | 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 | + */ |
214 | 227 | 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 | + */ |
215 | 236 | V2, |
216 | 237 | } |
217 | 238 | } |
0 commit comments