Clean up null issues, add more annotations (#3590)

This commit is contained in:
James Mitchell authored and LexManos committed 2017-01-11 15:17:56 -08:00
1 parent 43efa3cfc4
commit c545b8ecd4
130 files changed
+629 -262

No files matched your search

@@ -32,6 +32,7 @@ import java.lang.ref.WeakReference;
import com.google.common.base.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class VanillaDoubleChestItemHandler extends WeakReference<TileEntityChest> implements IItemHandlerModifiable
{
@@ -41,7 +42,7 @@ public class VanillaDoubleChestItemHandler extends WeakReference<TileEntityChest
private final TileEntityChest mainChest;
private final int hashCode;
public VanillaDoubleChestItemHandler(TileEntityChest mainChest, TileEntityChest other, boolean mainChestIsUpper)
public VanillaDoubleChestItemHandler(@Nullable TileEntityChest mainChest, @Nullable TileEntityChest other, boolean mainChestIsUpper)
{
super(other);
this.mainChest = mainChest;
@@ -49,6 +50,7 @@ public class VanillaDoubleChestItemHandler extends WeakReference<TileEntityChest
hashCode = Objects.hashCode(mainChestIsUpper ? mainChest : other) * 31 + Objects.hashCode(!mainChestIsUpper ? mainChest : other);
}
@Nullable
public static VanillaDoubleChestItemHandler get(TileEntityChest chest)
{
World world = chest.getWorld();
@@ -81,6 +83,7 @@ public class VanillaDoubleChestItemHandler extends WeakReference<TileEntityChest
return NO_ADJACENT_CHESTS_INSTANCE; //All alone
}
@Nullable
public TileEntityChest getChest(boolean accessingUpper)
{
if (accessingUpper == mainChestIsUpper)
@@ -91,6 +94,7 @@ public class VanillaDoubleChestItemHandler extends WeakReference<TileEntityChest
}
}
@Nullable
private TileEntityChest getOtherChest()
{
TileEntityChest tileEntityChest = get();
@@ -43,6 +43,7 @@ public class VanillaInventoryCodeHooks
* Copied from TileEntityHopper#captureDroppedItems and added capability support
* @return Null if we did nothing {no IItemHandler}, True if we moved an item, False if we moved no items
*/
@Nullable
public static Boolean extractHook(IHopper dest)
{
Pair<IItemHandler, Object> itemHandlerResult = getItemHandler(dest, EnumFacing.UP);