mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-26 19:37:39 +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:
		| @@ -29,6 +29,7 @@ import net.minecraft.world.World; | |||||||
| import org.apache.commons.lang3.tuple.Pair; | import org.apache.commons.lang3.tuple.Pair; | ||||||
|  |  | ||||||
| import javax.annotation.Nonnull; | import javax.annotation.Nonnull; | ||||||
|  | import javax.annotation.Nullable; | ||||||
| import javax.vecmath.Matrix4f; | import javax.vecmath.Matrix4f; | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| @@ -103,7 +104,7 @@ public class TurtleSmartItemModel implements IBakedModel, IResourceManagerReload | |||||||
|         { |         { | ||||||
|             @Nonnull |             @Nonnull | ||||||
|             @Override |             @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(); |                 ItemTurtleBase turtle = (ItemTurtleBase) stack.getItem(); | ||||||
|                 ComputerFamily family = turtle.getFamily( stack ); |                 ComputerFamily family = turtle.getFamily( stack ); | ||||||
|   | |||||||
| @@ -15,6 +15,7 @@ import net.minecraft.item.ItemStack; | |||||||
| import net.minecraft.nbt.NBTTagCompound; | import net.minecraft.nbt.NBTTagCompound; | ||||||
|  |  | ||||||
| import javax.annotation.Nonnull; | import javax.annotation.Nonnull; | ||||||
|  | import javax.annotation.Nullable; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  |  | ||||||
| public class ItemCommandComputer extends ItemComputer | public class ItemCommandComputer extends ItemComputer | ||||||
| @@ -52,7 +53,7 @@ public class ItemCommandComputer extends ItemComputer | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @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 ) ); |         list.add( ComputerItemFactory.create( -1, null, ComputerFamily.Command ) ); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -22,6 +22,7 @@ import net.minecraft.util.EnumFacing; | |||||||
| import net.minecraft.world.World; | import net.minecraft.world.World; | ||||||
|  |  | ||||||
| import javax.annotation.Nonnull; | import javax.annotation.Nonnull; | ||||||
|  | import javax.annotation.Nullable; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  |  | ||||||
| public class ItemComputer extends ItemComputerBase | public class ItemComputer extends ItemComputerBase | ||||||
| @@ -72,7 +73,7 @@ public class ItemComputer extends ItemComputerBase | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @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.Normal ) ); | ||||||
|         list.add( ComputerItemFactory.create( -1, null, ComputerFamily.Advanced ) ); |         list.add( ComputerItemFactory.create( -1, null, ComputerFamily.Advanced ) ); | ||||||
|   | |||||||
| @@ -14,6 +14,7 @@ import net.minecraft.item.Item; | |||||||
| import net.minecraft.item.ItemStack; | import net.minecraft.item.ItemStack; | ||||||
|  |  | ||||||
| import javax.annotation.Nonnull; | import javax.annotation.Nonnull; | ||||||
|  | import javax.annotation.Nullable; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  |  | ||||||
| public class ItemAdvancedModem extends ItemPeripheralBase | public class ItemAdvancedModem extends ItemPeripheralBase | ||||||
| @@ -49,7 +50,7 @@ public class ItemAdvancedModem extends ItemPeripheralBase | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @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 ) ); |         list.add( PeripheralItemFactory.create( PeripheralType.AdvancedModem, null, 1 ) ); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -24,6 +24,7 @@ import net.minecraft.util.EnumFacing; | |||||||
| import net.minecraft.world.World; | import net.minecraft.world.World; | ||||||
|  |  | ||||||
| import javax.annotation.Nonnull; | import javax.annotation.Nonnull; | ||||||
|  | import javax.annotation.Nullable; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  |  | ||||||
| public class ItemCable extends ItemPeripheralBase | public class ItemCable extends ItemPeripheralBase | ||||||
| @@ -63,7 +64,7 @@ public class ItemCable extends ItemPeripheralBase | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @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.WiredModem, null, 1 ) ); | ||||||
|         list.add( PeripheralItemFactory.create( PeripheralType.Cable, null, 1 ) ); |         list.add( PeripheralItemFactory.create( PeripheralType.Cable, null, 1 ) ); | ||||||
|   | |||||||
| @@ -14,6 +14,7 @@ import net.minecraft.item.Item; | |||||||
| import net.minecraft.item.ItemStack; | import net.minecraft.item.ItemStack; | ||||||
|  |  | ||||||
| import javax.annotation.Nonnull; | import javax.annotation.Nonnull; | ||||||
|  | import javax.annotation.Nullable; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  |  | ||||||
| public class ItemPeripheral extends ItemPeripheralBase | public class ItemPeripheral extends ItemPeripheralBase | ||||||
| @@ -69,7 +70,7 @@ public class ItemPeripheral extends ItemPeripheralBase | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @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.DiskDrive, null, 1 ) ); | ||||||
|         list.add( PeripheralItemFactory.create( PeripheralType.Printer, null, 1 ) ); |         list.add( PeripheralItemFactory.create( PeripheralType.Printer, null, 1 ) ); | ||||||
|   | |||||||
| @@ -28,6 +28,7 @@ import net.minecraft.util.math.BlockPos; | |||||||
| import net.minecraft.world.World; | import net.minecraft.world.World; | ||||||
|  |  | ||||||
| import javax.annotation.Nonnull; | import javax.annotation.Nonnull; | ||||||
|  | import javax.annotation.Nullable; | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.List; | 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 ); |     public abstract ItemStack create( int id, String label, Colour colour, ITurtleUpgrade leftUpgrade, ITurtleUpgrade rightUpgrade, int fuelLevel, ResourceLocation overlay ); | ||||||
|  |  | ||||||
|     @Override |     @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>(); |         List<ItemStack> all = new ArrayList<ItemStack>(); | ||||||
|         ComputerCraft.addAllUpgradedTurtles( all ); |         ComputerCraft.addAllUpgradedTurtles( all ); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Daniel Ratcliffe
					Daniel Ratcliffe