Replace useless nullability comments with jetbrains annotation

This commit is contained in:
SilverAndro 2022-12-27 01:13:38 -05:00
parent 58bef3f2cf
commit fb4de1f172
No known key found for this signature in database
GPG key ID: 0796A702F3FFBAC8
4 changed files with 16 additions and 8 deletions
fabric-events-interaction-v0/src/main/java/net/fabricmc/fabric/api/event/player
fabric-item-api-v1/src/main/java/net/fabricmc/fabric/impl/item
fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/entity

View file

@ -25,6 +25,8 @@ import net.minecraft.world.World;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import org.jetbrains.annotations.Nullable;
public final class PlayerBlockBreakEvents {
private PlayerBlockBreakEvents() { }
@ -90,7 +92,7 @@ public final class PlayerBlockBreakEvents {
* @param blockEntity the block entity <strong>before</strong> the block is broken, can be {@code null}
* @return {@code false} to cancel block breaking action, or {@code true} to pass to next listener
*/
boolean beforeBlockBreak(World world, PlayerEntity player, BlockPos pos, BlockState state, /* Nullable */ BlockEntity blockEntity);
boolean beforeBlockBreak(World world, PlayerEntity player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity);
}
@FunctionalInterface
@ -104,7 +106,7 @@ public final class PlayerBlockBreakEvents {
* @param state the block state <strong>before</strong> the block was broken
* @param blockEntity the block entity of the broken block, can be {@code null}
*/
void afterBlockBreak(World world, PlayerEntity player, BlockPos pos, BlockState state, /* Nullable */ BlockEntity blockEntity);
void afterBlockBreak(World world, PlayerEntity player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity);
}
@FunctionalInterface
@ -118,6 +120,6 @@ public final class PlayerBlockBreakEvents {
* @param state the block state of the block that was going to be broken
* @param blockEntity the block entity of the block that was going to be broken, can be {@code null}
*/
void onBlockBreakCanceled(World world, PlayerEntity player, BlockPos pos, BlockState state, /* Nullable */ BlockEntity blockEntity);
void onBlockBreakCanceled(World world, PlayerEntity player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity);
}
}

View file

@ -23,6 +23,8 @@ import net.minecraft.item.Item;
import net.fabricmc.fabric.api.item.v1.CustomDamageHandler;
import net.fabricmc.fabric.api.item.v1.EquipmentSlotProvider;
import org.jetbrains.annotations.Nullable;
public final class FabricItemInternals {
private static final WeakHashMap<Item.Settings, ExtraData> extraData = new WeakHashMap<>();
@ -43,8 +45,8 @@ public final class FabricItemInternals {
}
public static final class ExtraData {
private /* @Nullable */ EquipmentSlotProvider equipmentSlotProvider;
private /* @Nullable */ CustomDamageHandler customDamageHandler;
private @Nullable EquipmentSlotProvider equipmentSlotProvider;
private @Nullable CustomDamageHandler customDamageHandler;
public void equipmentSlot(EquipmentSlotProvider equipmentSlotProvider) {
this.equipmentSlotProvider = equipmentSlotProvider;

View file

@ -19,9 +19,11 @@ package net.fabricmc.fabric.impl.item;
import net.fabricmc.fabric.api.item.v1.CustomDamageHandler;
import net.fabricmc.fabric.api.item.v1.EquipmentSlotProvider;
import org.jetbrains.annotations.Nullable;
public interface ItemExtensions {
/* @Nullable */ EquipmentSlotProvider fabric_getEquipmentSlotProvider();
@Nullable EquipmentSlotProvider fabric_getEquipmentSlotProvider();
void fabric_setEquipmentSlotProvider(EquipmentSlotProvider equipmentSlotProvider);
/* @Nullable */ CustomDamageHandler fabric_getCustomDamageHandler();
@Nullable CustomDamageHandler fabric_getCustomDamageHandler();
void fabric_setCustomDamageHandler(CustomDamageHandler handler);
}

View file

@ -36,6 +36,8 @@ import net.minecraft.world.World;
import net.fabricmc.fabric.impl.object.builder.FabricEntityType;
import org.jetbrains.annotations.Nullable;
/**
* Extended version of {@link EntityType.Builder} with added registration for
* server-&gt;client entity tracking values.
@ -272,7 +274,7 @@ public class FabricEntityTypeBuilder<T extends Entity> {
* @param <T> Entity class.
*/
public static class Living<T extends LivingEntity> extends FabricEntityTypeBuilder<T> {
/* @Nullable */
@Nullable
private Supplier<DefaultAttributeContainer.Builder> defaultAttributeBuilder;
protected Living(SpawnGroup spawnGroup, EntityType.EntityFactory<T> function) {