31 lines
1.5 KiB
Diff
31 lines
1.5 KiB
Diff
--- a/net/minecraft/entity/EntitySpawnPlacementRegistry.java
|
|
+++ b/net/minecraft/entity/EntitySpawnPlacementRegistry.java
|
|
@@ -147,10 +147,26 @@
|
|
boolean test(EntityType<T> p_test_1_, IServerWorld p_test_2_, SpawnReason p_test_3_, BlockPos p_test_4_, Random p_test_5_);
|
|
}
|
|
|
|
- public static enum PlacementType {
|
|
+ public static enum PlacementType implements net.minecraftforge.common.IExtensibleEnum {
|
|
ON_GROUND,
|
|
IN_WATER,
|
|
NO_RESTRICTIONS,
|
|
IN_LAVA;
|
|
+
|
|
+ public static PlacementType create(String name, net.minecraftforge.common.util.TriPredicate<net.minecraft.world.IWorldReader, BlockPos, EntityType<? extends MobEntity>> predicate) {
|
|
+ throw new IllegalStateException("Enum not extended");
|
|
+ }
|
|
+
|
|
+ private net.minecraftforge.common.util.TriPredicate<net.minecraft.world.IWorldReader, BlockPos, EntityType<?>> predicate;
|
|
+ private PlacementType() { this(null); }
|
|
+ private PlacementType(net.minecraftforge.common.util.TriPredicate<net.minecraft.world.IWorldReader, BlockPos, EntityType<?>> predicate) {
|
|
+ this.predicate = predicate;
|
|
+ }
|
|
+
|
|
+ public boolean canSpawnAt(net.minecraft.world.IWorldReader world, BlockPos pos, EntityType<?> type) {
|
|
+ if (this == NO_RESTRICTIONS) return true;
|
|
+ if (predicate == null) return net.minecraft.world.spawner.WorldEntitySpawner.canSpawnAtBody(this, world, pos, type);
|
|
+ return predicate.test(world, pos, type);
|
|
+ }
|
|
}
|
|
}
|