This commit is contained in:
modmuss50 2024-01-24 19:59:21 +00:00
parent 3945d7aeb7
commit 9bfa344c7d
19 changed files with 87 additions and 232 deletions
fabric-object-builder-api-v1/src/main
java/net/fabricmc/fabric/api/object/builder/v1/entity
resources

View file

@ -23,6 +23,7 @@ import com.google.common.collect.ImmutableSet;
import org.jetbrains.annotations.Nullable;
import net.minecraft.block.Block;
import net.minecraft.class_9168;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.EntityType;
@ -422,7 +423,7 @@ public class FabricEntityTypeBuilder<T extends Entity> {
* @param <T> Entity class.
*/
public static class Mob<T extends MobEntity> extends FabricEntityTypeBuilder.Living<T> {
private SpawnRestriction.Location restrictionLocation;
private class_9168 spawnLocation;
private Heightmap.Type restrictionHeightmap;
private SpawnRestriction.SpawnPredicate<T> spawnPredicate;
@ -535,8 +536,8 @@ public class FabricEntityTypeBuilder<T extends Entity> {
*
* @return this builder for chaining.
*/
public FabricEntityTypeBuilder.Mob<T> spawnRestriction(SpawnRestriction.Location location, Heightmap.Type heightmap, SpawnRestriction.SpawnPredicate<T> spawnPredicate) {
this.restrictionLocation = Objects.requireNonNull(location, "Location cannot be null.");
public FabricEntityTypeBuilder.Mob<T> spawnRestriction(class_9168 spawnLocation, Heightmap.Type heightmap, SpawnRestriction.SpawnPredicate<T> spawnPredicate) {
this.spawnLocation = Objects.requireNonNull(spawnLocation, "Spawn location cannot be null.");
this.restrictionHeightmap = Objects.requireNonNull(heightmap, "Heightmap type cannot be null.");
this.spawnPredicate = Objects.requireNonNull(spawnPredicate, "Spawn predicate cannot be null.");
return this;
@ -547,7 +548,7 @@ public class FabricEntityTypeBuilder<T extends Entity> {
EntityType<T> type = super.build();
if (this.spawnPredicate != null) {
SpawnRestriction.register(type, this.restrictionLocation, this.restrictionHeightmap, this.spawnPredicate);
SpawnRestriction.register(type, this.spawnLocation, this.restrictionHeightmap, this.spawnPredicate);
}
return type;

View file

@ -8,7 +8,7 @@ accessible class net/minecraft/village/TradeOffers$TypeAwareBuyForOneEmeraldFact
mutable field net/minecraft/village/TradeOffers REBALANCED_PROFESSION_TO_LEVELED_TRADE Ljava/util/Map;
mutable field net/minecraft/village/TradeOffers REBALANCED_WANDERING_TRADER_TRADES Ljava/util/List;
accessible method net/minecraft/entity/SpawnRestriction register (Lnet/minecraft/entity/EntityType;Lnet/minecraft/entity/SpawnRestriction$Location;Lnet/minecraft/world/Heightmap$Type;Lnet/minecraft/entity/SpawnRestriction$SpawnPredicate;)V
accessible method net/minecraft/entity/SpawnRestriction register (Lnet/minecraft/entity/EntityType;Lnet/minecraft/class_9168;Lnet/minecraft/world/Heightmap$Type;Lnet/minecraft/entity/SpawnRestriction$SpawnPredicate;)V
accessible field net/minecraft/village/VillagerType BIOME_TO_TYPE Ljava/util/Map;
accessible method net/minecraft/village/VillagerType <init> (Ljava/lang/String;)V