1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-01-14 19:25:43 +00:00

Merge pull request #221 from SquidDev-CC/feature/nullable-annotations

Fix several crashes caused by incorrect NonNull annotations.
This commit is contained in:
Daniel Ratcliffe 2017-05-09 20:00:02 +01:00 committed by GitHub
commit c049de6939
7 changed files with 14 additions and 7 deletions

View File

@ -29,6 +29,7 @@ import net.minecraft.world.World;
import org.apache.commons.lang3.tuple.Pair;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
import java.util.ArrayList;
import java.util.HashMap;
@ -103,7 +104,7 @@ public class TurtleSmartItemModel implements IBakedModel, IResourceManagerReload
{
@Nonnull
@Override
public IBakedModel handleItemState( @Nonnull IBakedModel originalModel, ItemStack stack, @Nonnull World world, @Nonnull EntityLivingBase entity)
public IBakedModel handleItemState( @Nonnull IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entity)
{
ItemTurtleBase turtle = (ItemTurtleBase) stack.getItem();
ComputerFamily family = turtle.getFamily( stack );

View File

@ -15,6 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
public class ItemCommandComputer extends ItemComputer
@ -52,7 +53,7 @@ public class ItemCommandComputer extends ItemComputer
}
@Override
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List<ItemStack> list )
public void getSubItems( @Nonnull Item itemID, @Nullable CreativeTabs tabs, @Nonnull List<ItemStack> list )
{
list.add( ComputerItemFactory.create( -1, null, ComputerFamily.Command ) );
}

View File

@ -22,6 +22,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
public class ItemComputer extends ItemComputerBase
@ -72,7 +73,7 @@ public class ItemComputer extends ItemComputerBase
}
@Override
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List<ItemStack> list )
public void getSubItems( @Nonnull Item itemID, @Nullable CreativeTabs tabs, @Nonnull List<ItemStack> list )
{
list.add( ComputerItemFactory.create( -1, null, ComputerFamily.Normal ) );
list.add( ComputerItemFactory.create( -1, null, ComputerFamily.Advanced ) );

View File

@ -14,6 +14,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
public class ItemAdvancedModem extends ItemPeripheralBase
@ -49,7 +50,7 @@ public class ItemAdvancedModem extends ItemPeripheralBase
}
@Override
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List<ItemStack> list )
public void getSubItems( @Nonnull Item itemID, @Nullable CreativeTabs tabs, @Nonnull List<ItemStack> list )
{
list.add( PeripheralItemFactory.create( PeripheralType.AdvancedModem, null, 1 ) );
}

View File

@ -24,6 +24,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
public class ItemCable extends ItemPeripheralBase
@ -63,7 +64,7 @@ public class ItemCable extends ItemPeripheralBase
}
@Override
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List<ItemStack> list )
public void getSubItems( @Nonnull Item itemID, @Nullable CreativeTabs tabs, @Nonnull List<ItemStack> list )
{
list.add( PeripheralItemFactory.create( PeripheralType.WiredModem, null, 1 ) );
list.add( PeripheralItemFactory.create( PeripheralType.Cable, null, 1 ) );

View File

@ -14,6 +14,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
public class ItemPeripheral extends ItemPeripheralBase
@ -69,7 +70,7 @@ public class ItemPeripheral extends ItemPeripheralBase
}
@Override
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List<ItemStack> list )
public void getSubItems( @Nonnull Item itemID, @Nullable CreativeTabs tabs, @Nonnull List<ItemStack> list )
{
list.add( PeripheralItemFactory.create( PeripheralType.DiskDrive, null, 1 ) );
list.add( PeripheralItemFactory.create( PeripheralType.Printer, null, 1 ) );

View File

@ -28,6 +28,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
@ -43,7 +44,7 @@ public abstract class ItemTurtleBase extends ItemComputerBase implements ITurtle
public abstract ItemStack create( int id, String label, Colour colour, ITurtleUpgrade leftUpgrade, ITurtleUpgrade rightUpgrade, int fuelLevel, ResourceLocation overlay );
@Override
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List<ItemStack> list )
public void getSubItems( @Nonnull Item itemID, @Nullable CreativeTabs tabs, @Nonnull List<ItemStack> list )
{
List<ItemStack> all = new ArrayList<ItemStack>();
ComputerCraft.addAllUpgradedTurtles( all );