diff --git a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/entity/FabricBlockEntityTypeBuilder.java b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/entity/FabricBlockEntityTypeBuilder.java index 0907551fb8..600ed41bbe 100644 --- a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/entity/FabricBlockEntityTypeBuilder.java +++ b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/entity/FabricBlockEntityTypeBuilder.java @@ -38,7 +38,8 @@ public final class FabricBlockEntityTypeBuilder { private final Factory factory; private final Set blocks = new HashSet<>(); - private boolean canPotentiallyExecuteCommands = false; + @Nullable + private Boolean canPotentiallyExecuteCommands = null; private FabricBlockEntityTypeBuilder(Factory factory) { this.factory = factory; diff --git a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/impl/object/builder/ExtendedBlockEntityType.java b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/impl/object/builder/ExtendedBlockEntityType.java index a6d01edb69..07b44c1e33 100644 --- a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/impl/object/builder/ExtendedBlockEntityType.java +++ b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/impl/object/builder/ExtendedBlockEntityType.java @@ -18,22 +18,25 @@ import java.util.Set; +import org.jetbrains.annotations.Nullable; + import net.minecraft.block.Block; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityType; public class ExtendedBlockEntityType extends BlockEntityType { - private final boolean canPotentiallyExecuteCommands; + @Nullable + private final Boolean canPotentiallyExecuteCommands; - public ExtendedBlockEntityType(BlockEntityFactory factory, Set blocks, boolean canPotentiallyExecuteCommands) { + public ExtendedBlockEntityType(BlockEntityFactory factory, Set blocks, @Nullable Boolean canPotentiallyExecuteCommands) { super(factory, blocks); this.canPotentiallyExecuteCommands = canPotentiallyExecuteCommands; } @Override public boolean canPotentiallyExecuteCommands() { - if (canPotentiallyExecuteCommands) { - return true; + if (canPotentiallyExecuteCommands != null) { + return canPotentiallyExecuteCommands; } return super.canPotentiallyExecuteCommands(); diff --git a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/impl/object/builder/FabricEntityTypeImpl.java b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/impl/object/builder/FabricEntityTypeImpl.java index e2c7f067de..8f01070669 100644 --- a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/impl/object/builder/FabricEntityTypeImpl.java +++ b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/impl/object/builder/FabricEntityTypeImpl.java @@ -35,9 +35,9 @@ import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityType; public interface FabricEntityTypeImpl { - void fabric_setAlwaysUpdateVelocity(Boolean alwaysUpdateVelocity); + void fabric_setAlwaysUpdateVelocity(@Nullable Boolean alwaysUpdateVelocity); - void fabric_setCanPotentiallyExecuteCommands(Boolean canPotentiallyExecuteCommands); + void fabric_setCanPotentiallyExecuteCommands(@Nullable Boolean canPotentiallyExecuteCommands); interface Builder { void fabric_setLivingEntityBuilder(Living livingBuilder); diff --git a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/EntityTypeBuilderMixin.java b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/EntityTypeBuilderMixin.java index fe8e896b56..eb1ecd8ba2 100644 --- a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/EntityTypeBuilderMixin.java +++ b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/EntityTypeBuilderMixin.java @@ -47,8 +47,10 @@ public abstract class EntityTypeBuilderMixin implements Fabric public abstract EntityType build(RegistryKey> registryKey); @Unique + @Nullable private Boolean alwaysUpdateVelocity = null; @Unique + @Nullable private Boolean canPotentiallyExecuteCommands = null; @Unique diff --git a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/EntityTypeMixin.java b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/EntityTypeMixin.java index 00c945b5e8..08644ddc8f 100644 --- a/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/EntityTypeMixin.java +++ b/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/EntityTypeMixin.java @@ -16,6 +16,7 @@ package net.fabricmc.fabric.mixin.object.builder; +import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; @@ -29,8 +30,10 @@ @Mixin(EntityType.class) public abstract class EntityTypeMixin implements FabricEntityTypeImpl { @Unique + @Nullable private Boolean alwaysUpdateVelocity; @Unique + @Nullable private Boolean canPotentiallyExecuteCommands; @Inject(method = "alwaysUpdateVelocity", at = @At("HEAD"), cancellable = true) @@ -48,12 +51,12 @@ public void onCanPotentiallyExecuteCommands(CallbackInfoReturnable cir) } @Override - public void fabric_setAlwaysUpdateVelocity(Boolean alwaysUpdateVelocity) { + public void fabric_setAlwaysUpdateVelocity(@Nullable Boolean alwaysUpdateVelocity) { this.alwaysUpdateVelocity = alwaysUpdateVelocity; } @Override - public void fabric_setCanPotentiallyExecuteCommands(Boolean canPotentiallyExecuteCommands) { + public void fabric_setCanPotentiallyExecuteCommands(@Nullable Boolean canPotentiallyExecuteCommands) { this.canPotentiallyExecuteCommands = canPotentiallyExecuteCommands; } }