diff --git a/src/main/java/net/fabricmc/fabric/entity/FabricEntityTypeBuilder.java b/src/main/java/net/fabricmc/fabric/entity/FabricEntityTypeBuilder.java index 0cf10cc32..389aa7a22 100644 --- a/src/main/java/net/fabricmc/fabric/entity/FabricEntityTypeBuilder.java +++ b/src/main/java/net/fabricmc/fabric/entity/FabricEntityTypeBuilder.java @@ -25,30 +25,34 @@ import java.util.function.Function; // TODO: javadocs public class FabricEntityTypeBuilder { - protected final EntityType.Builder delegate; + private final Class entityClass; + private final Function function; + private boolean saveable = true; + private boolean summonable = true; private int trackingDistance = -1; private int updateIntervalTicks = -1; private boolean alwaysUpdateVelocity = true; - protected FabricEntityTypeBuilder(EntityType.Builder delegate) { - this.delegate = delegate; + protected FabricEntityTypeBuilder(Class entityClass, Function function) { + this.entityClass = entityClass; + this.function = function; } public static FabricEntityTypeBuilder create(Class entityClass) { - return new FabricEntityTypeBuilder<>(EntityType.Builder.create(entityClass)); + return new FabricEntityTypeBuilder<>(entityClass, (w) -> null); } public static FabricEntityTypeBuilder create(Class entityClass, Function function) { - return new FabricEntityTypeBuilder<>(EntityType.Builder.create(entityClass, function)); + return new FabricEntityTypeBuilder<>(entityClass, function); } public FabricEntityTypeBuilder disableSummon() { - delegate.disableSummon(); + this.summonable = false; return this; } public FabricEntityTypeBuilder disableSaving() { - delegate.disableSaving(); + this.saveable = false; return this; } @@ -64,7 +68,12 @@ public class FabricEntityTypeBuilder { } public EntityType build(String id) { - EntityType type = delegate.build(id); + if (this.saveable) { + // SNIP! Modded datafixers are not supported anyway. + // TODO: Flesh out once modded datafixers exist. + } + + EntityType type = new EntityType<>(this.entityClass, this.function, this.saveable, this.summonable, null); if (trackingDistance != -1) { EntityTrackingRegistry.INSTANCE.register(type, trackingDistance, updateIntervalTicks, alwaysUpdateVelocity); }