mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-10-23 09:57:39 +00:00
Default Forge/Common API to non-null
This commit is contained in:
@@ -16,8 +16,6 @@ import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* The forge-specific entrypoint for ComputerCraft's API.
|
||||
*/
|
||||
@@ -34,7 +32,7 @@ public final class ForgeComputerCraftAPI {
|
||||
* @see IPeripheral
|
||||
* @see IPeripheralProvider
|
||||
*/
|
||||
public static void registerPeripheralProvider(@Nonnull IPeripheralProvider provider) {
|
||||
public static void registerPeripheralProvider(IPeripheralProvider provider) {
|
||||
getInstance().registerPeripheralProvider(provider);
|
||||
}
|
||||
|
||||
@@ -44,7 +42,7 @@ public final class ForgeComputerCraftAPI {
|
||||
* @param capability The capability to register.
|
||||
* @see GenericSource
|
||||
*/
|
||||
public static void registerGenericCapability(@Nonnull Capability<?> capability) {
|
||||
public static void registerGenericCapability(Capability<?> capability) {
|
||||
getInstance().registerGenericCapability(capability);
|
||||
}
|
||||
|
||||
@@ -57,12 +55,10 @@ public final class ForgeComputerCraftAPI {
|
||||
* @return The element's node
|
||||
* @see IWiredElement#getNode()
|
||||
*/
|
||||
@Nonnull
|
||||
public static LazyOptional<IWiredElement> getWiredElementAt(@Nonnull BlockGetter world, @Nonnull BlockPos pos, @Nonnull Direction side) {
|
||||
public static LazyOptional<IWiredElement> getWiredElementAt(BlockGetter world, BlockPos pos, Direction side) {
|
||||
return getInstance().getWiredElementAt(world, pos, side);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private static ComputerCraftAPIForgeService getInstance() {
|
||||
return ComputerCraftAPIForgeService.get();
|
||||
}
|
||||
|
@@ -8,7 +8,6 @@ package dan200.computercraft.api.turtle.event;
|
||||
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -23,7 +22,7 @@ import java.util.Objects;
|
||||
public abstract class TurtleEvent extends Event {
|
||||
private final ITurtleAccess turtle;
|
||||
|
||||
protected TurtleEvent(@Nonnull ITurtleAccess turtle) {
|
||||
protected TurtleEvent(ITurtleAccess turtle) {
|
||||
Objects.requireNonNull(turtle, "turtle cannot be null");
|
||||
this.turtle = turtle;
|
||||
}
|
||||
@@ -33,7 +32,6 @@ public abstract class TurtleEvent extends Event {
|
||||
*
|
||||
* @return The access for this turtle.
|
||||
*/
|
||||
@Nonnull
|
||||
public ITurtleAccess getTurtle() {
|
||||
return turtle;
|
||||
}
|
||||
|
@@ -9,7 +9,6 @@ import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||
import dan200.computercraft.api.turtle.TurtleRefuelHandler;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -23,9 +22,9 @@ import java.util.Objects;
|
||||
@Deprecated(forRemoval = true)
|
||||
public class TurtleRefuelEvent extends TurtleEvent {
|
||||
private final ItemStack stack;
|
||||
private Handler handler;
|
||||
private @Nullable Handler handler;
|
||||
|
||||
public TurtleRefuelEvent(@Nonnull ITurtleAccess turtle, @Nonnull ItemStack stack) {
|
||||
public TurtleRefuelEvent(ITurtleAccess turtle, ItemStack stack) {
|
||||
super(turtle);
|
||||
|
||||
Objects.requireNonNull(turtle, "turtle cannot be null");
|
||||
@@ -82,6 +81,6 @@ public class TurtleRefuelEvent extends TurtleEvent {
|
||||
* items to consume.
|
||||
* @return The amount of fuel gained.
|
||||
*/
|
||||
int refuel(@Nonnull ITurtleAccess turtle, @Nonnull ItemStack stack, int slot, int limit);
|
||||
int refuel(ITurtleAccess turtle, ItemStack stack, int slot, int limit);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user