Respect NonNull for real

This commit is contained in:
raoulvdberge
2017-07-31 00:30:42 +02:00
parent 003718b0a8
commit c3b16f758a
2 changed files with 77 additions and 1 deletions

View File

@@ -0,0 +1,75 @@
package com.raoulvdberge.refinedstorage.apiimpl.network.node;
import com.raoulvdberge.refinedstorage.api.network.INetwork;
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class NetworkNodeDummy implements INetworkNode {
@Override
public int getEnergyUsage() {
return 0;
}
@Nonnull
@Override
public ItemStack getItemStack() {
return ItemStack.EMPTY;
}
@Override
public void onConnected(INetwork network) {
// NO OP
}
@Override
public void onDisconnected(INetwork network) {
// NO OP
}
@Override
public boolean canUpdate() {
return false;
}
@Nullable
@Override
public INetwork getNetwork() {
return null;
}
@Override
public void update() {
// NO OP
}
@Override
public NBTTagCompound write(NBTTagCompound tag) {
return tag;
}
@Override
public BlockPos getPos() {
return BlockPos.ORIGIN;
}
@Override
public World getWorld() {
return null;
}
@Override
public void markDirty() {
// NO OP
}
@Override
public String getId() {
return "dummy";
}
}

View File

@@ -3,6 +3,7 @@ package com.raoulvdberge.refinedstorage.capability;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode; import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy; import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeDummy;
import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@@ -29,7 +30,7 @@ public class CapabilityNetworkNodeProxy {
@Override @Override
@Nonnull @Nonnull
public INetworkNode getNode() { public INetworkNode getNode() {
throw new UnsupportedOperationException("Cannot use default implementation"); return new NetworkNodeDummy();
} }
}); });