Remove most raw types

This means we can remove even more casts and what not.
This commit is contained in:
SquidDev 2017-05-07 01:16:08 +01:00
parent 9af15d1e30
commit db9cd15fb3
38 changed files with 106 additions and 141 deletions

View File

@ -586,8 +586,7 @@ public static IPeripheral getPeripheralAt( World world, BlockPos pos, EnumFacing
{
try
{
IPeripheralProvider handler = peripheralProvider;
IPeripheral peripheral = handler.getPeripheral( world, pos, side );
IPeripheral peripheral = peripheralProvider.getPeripheral( world, pos, side );
if( peripheral != null )
{
return peripheral;
@ -624,8 +623,7 @@ public static int getBundledRedstoneOutput( World world, BlockPos pos, EnumFacin
{
try
{
IBundledRedstoneProvider handler = bundledRedstoneProvider;
int signal = handler.getBundledRedstoneOutput( world, pos, side );
int signal = bundledRedstoneProvider.getBundledRedstoneOutput( world, pos, side );
if( signal >= 0 )
{
if( combinedSignal < 0 )
@ -655,8 +653,7 @@ public static IMedia getMedia( ItemStack stack )
{
try
{
IMediaProvider handler = mediaProvider;
IMedia media = handler.getMedia( stack );
IMedia media = mediaProvider.getMedia( stack );
if( media != null )
{
return media;

View File

@ -298,36 +298,36 @@ private static void findCC()
if( !ccSearched ) {
try {
computerCraft = Class.forName( "dan200.computercraft.ComputerCraft" );
computerCraft_getVersion = findCCMethod( "getVersion", new Class[]{
computerCraft_getVersion = findCCMethod( "getVersion", new Class<?>[]{
} );
computerCraft_createUniqueNumberedSaveDir = findCCMethod( "createUniqueNumberedSaveDir", new Class[]{
computerCraft_createUniqueNumberedSaveDir = findCCMethod( "createUniqueNumberedSaveDir", new Class<?>[]{
World.class, String.class
} );
computerCraft_createSaveDirMount = findCCMethod( "createSaveDirMount", new Class[] {
computerCraft_createSaveDirMount = findCCMethod( "createSaveDirMount", new Class<?>[] {
World.class, String.class, Long.TYPE
} );
computerCraft_createResourceMount = findCCMethod( "createResourceMount", new Class[] {
computerCraft_createResourceMount = findCCMethod( "createResourceMount", new Class<?>[] {
Class.class, String.class, String.class
} );
computerCraft_registerPeripheralProvider = findCCMethod( "registerPeripheralProvider", new Class[] {
computerCraft_registerPeripheralProvider = findCCMethod( "registerPeripheralProvider", new Class<?>[] {
IPeripheralProvider.class
} );
computerCraft_registerTurtleUpgrade = findCCMethod( "registerTurtleUpgrade", new Class[] {
computerCraft_registerTurtleUpgrade = findCCMethod( "registerTurtleUpgrade", new Class<?>[] {
ITurtleUpgrade.class
} );
computerCraft_registerBundledRedstoneProvider = findCCMethod( "registerBundledRedstoneProvider", new Class[] {
computerCraft_registerBundledRedstoneProvider = findCCMethod( "registerBundledRedstoneProvider", new Class<?>[] {
IBundledRedstoneProvider.class
} );
computerCraft_getDefaultBundledRedstoneOutput = findCCMethod( "getDefaultBundledRedstoneOutput", new Class[] {
computerCraft_getDefaultBundledRedstoneOutput = findCCMethod( "getDefaultBundledRedstoneOutput", new Class<?>[] {
World.class, BlockPos.class, EnumFacing.class
} );
computerCraft_registerMediaProvider = findCCMethod( "registerMediaProvider", new Class[] {
computerCraft_registerMediaProvider = findCCMethod( "registerMediaProvider", new Class<?>[] {
IMediaProvider.class
} );
computerCraft_registerPermissionProvider = findCCMethod( "registerPermissionProvider", new Class[] {
computerCraft_registerPermissionProvider = findCCMethod( "registerPermissionProvider", new Class<?>[] {
ITurtlePermissionProvider.class
} );
computerCraft_registerPocketUpgrade = findCCMethod( "registerPocketUpgrade", new Class[] {
computerCraft_registerPocketUpgrade = findCCMethod( "registerPocketUpgrade", new Class<?>[] {
IPocketUpgrade.class
} );
} catch( Exception e ) {
@ -353,7 +353,7 @@ private static Method findCCMethod( String name, Class<?>[] args )
}
private static boolean ccSearched = false;
private static Class computerCraft = null;
private static Class<?> computerCraft = null;
private static Method computerCraft_getVersion = null;
private static Method computerCraft_createUniqueNumberedSaveDir = null;
private static Method computerCraft_createSaveDirMount = null;

View File

@ -279,10 +279,10 @@ public Object getFixedWidthFontRenderer()
@Override
public String getRecordInfo( ItemStack recordStack )
{
List info = new ArrayList(1);
List<String> info = new ArrayList<String>( 1 );
recordStack.getItem().addInformation( recordStack, null, info, false );
if( info.size() > 0 ) {
return info.get(0).toString();
return info.get( 0 );
} else {
return super.getRecordInfo( recordStack );
}

View File

@ -25,7 +25,7 @@ public class TurtleMultiModel implements IBakedModel
private IBakedModel m_rightUpgradeModel;
private Matrix4f m_rightUpgradeTransform;
private List<BakedQuad> m_generalQuads;
private List<BakedQuad> m_faceQuads[];
private List<BakedQuad>[] m_faceQuads;
public TurtleMultiModel( IBakedModel baseModel, IBakedModel overlayModel, IBakedModel leftUpgradeModel, Matrix4f leftUpgradeTransform, IBakedModel rightUpgradeModel, Matrix4f rightUpgradeTransform )
{

View File

@ -124,7 +124,7 @@ public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull O
throw new LuaException( "Expected string" );
}
String path = (String)args[0];
return new Object[]{ m_fileSystem.getName( path ) };
return new Object[]{ FileSystem.getName( path ) };
}
case 3:
{
@ -359,7 +359,7 @@ public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull O
throw new LuaException( "Expected string" );
}
String path = (String)args[0];
return new Object[]{ m_fileSystem.getDirectory( path ) };
return new Object[]{ FileSystem.getDirectory( path ) };
}
default:
{

View File

@ -201,7 +201,7 @@ public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull O
Map<String, String> headers = null;
if( args.length >= 3 && args[2] instanceof Map )
{
Map table = (Map)args[2];
Map<?, ?> table = (Map<?, ?>)args[2];
headers = new HashMap<String, String>( table.size() );
for( Object key : table.keySet() )
{

View File

@ -477,8 +477,7 @@ public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull O
}
if( p != null )
{
Object[] results = p.call( context, methodName, methodArgs );
return results;
return p.call( context, methodName, methodArgs );
}
}
throw new LuaException( "No peripheral attached" );

View File

@ -316,8 +316,6 @@ private void tryAbort() throws LuaError
throw new LuaError( abortMessage );
}
}
private static long s_nextUnusedTaskID = 0;
private LuaTable wrapLuaObject( ILuaObject object )
{
@ -531,9 +529,8 @@ else if( m_valuesInProgress.containsKey( object ) )
m_valuesInProgress.put( object, table );
// Convert all keys
for( Object o : ((Map) object).entrySet() )
for( Map.Entry<?, ?> pair : ((Map<?, ?>) object).entrySet() )
{
Map.Entry pair = (Map.Entry) o;
LuaValue key = toValue( pair.getKey() );
LuaValue value = toValue( pair.getValue() );
if( !key.isnil() && !value.isnil() )
@ -554,8 +551,7 @@ else if( m_valuesInProgress.containsKey( object ) )
}
else if( object instanceof ILuaObject )
{
LuaValue table = wrapLuaObject( (ILuaObject)object );
return table;
return wrapLuaObject( (ILuaObject)object );
}
else
{
@ -623,7 +619,7 @@ else if( m_objectsInProgress.containsKey( value ) )
{
return m_objectsInProgress.get( value );
}
Map table = new HashMap();
Map<Object, Object> table = new HashMap<Object, Object>();
m_objectsInProgress.put( value, table );
// Convert all keys

View File

@ -120,9 +120,8 @@ private Object getBlockInfo( World world, BlockPos pos )
table.put( "metadata", metadata );
Map<Object, Object> stateTable = new HashMap<Object, Object>();
for( Object o : state.getActualState( world, pos ).getProperties().entrySet() )
for( ImmutableMap.Entry<IProperty<?>, Comparable<?>> entry : state.getActualState( world, pos ).getProperties().entrySet() )
{
ImmutableMap.Entry<IProperty, Object> entry = (ImmutableMap.Entry<IProperty, Object>)o;
String propertyName = entry.getKey().getName();
Object value = entry.getValue();
if( value instanceof String || value instanceof Number || value instanceof Boolean )
@ -194,12 +193,11 @@ public Object[] execute() throws LuaException
{
ICommandManager commandManager = server.getCommandManager();
ICommandSender commmandSender = m_computer.getCommandSender();
Map commands = commandManager.getCommands();
for( Object entryObject : commands.entrySet() )
Map<String, ICommand> commands = commandManager.getCommands();
for( Map.Entry<String, ICommand> entry : commands.entrySet() )
{
Map.Entry entry = (Map.Entry)entryObject;
String name = (String)entry.getKey();
ICommand command = (ICommand)entry.getValue();
String name = entry.getKey();
ICommand command = entry.getValue();
try
{
if( command.checkPermission( server, commmandSender ) )

View File

@ -11,7 +11,6 @@
import dan200.computercraft.shared.computer.core.IComputer;
import dan200.computercraft.shared.util.DirectionUtil;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
@ -55,10 +54,7 @@ public BlockCommandComputer()
@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {
Properties.FACING,
Properties.STATE
});
return new BlockStateContainer(this, Properties.FACING, Properties.STATE );
}
@Nonnull

View File

@ -12,7 +12,6 @@
import dan200.computercraft.shared.computer.items.ItemComputer;
import dan200.computercraft.shared.util.DirectionUtil;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.properties.PropertyEnum;
@ -22,8 +21,8 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -58,11 +57,7 @@ public BlockComputer()
@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {
Properties.FACING,
Properties.ADVANCED,
Properties.STATE
});
return new BlockStateContainer( this, Properties.FACING, Properties.ADVANCED, Properties.STATE );
}
@Nonnull

View File

@ -52,7 +52,7 @@ public ItemStack create( int id, String label, ComputerFamily family )
}
@Override
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List list )
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List<ItemStack> list )
{
list.add( ComputerItemFactory.create( -1, null, ComputerFamily.Command ) );
}

View File

@ -72,7 +72,7 @@ public ItemStack create( int id, String label, ComputerFamily family )
}
@Override
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List list )
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List<ItemStack> list )
{
list.add( ComputerItemFactory.create( -1, null, ComputerFamily.Normal ) );
list.add( ComputerItemFactory.create( -1, null, ComputerFamily.Advanced ) );

View File

@ -36,7 +36,7 @@ public final int getMetadata( int damage )
}
@Override
public void addInformation( @Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull List list, boolean debug )
public void addInformation( @Nonnull ItemStack stack, @Nonnull EntityPlayer player, @Nonnull List<String> list, boolean debug )
{
if( debug )
{

View File

@ -35,7 +35,7 @@ public ItemDiskLegacy()
}
@Override
public void getSubItems( @Nonnull Item itemID, CreativeTabs tabs, List list )
public void getSubItems( @Nonnull Item itemID, CreativeTabs tabs, List<ItemStack> list )
{
for( int colour=0; colour<16; ++colour )
{
@ -80,7 +80,7 @@ protected void setDiskID( ItemStack stack, int id )
}
@Override
public void addInformation( ItemStack stack, EntityPlayer player, List list, boolean debug )
public void addInformation( ItemStack stack, EntityPlayer player, List<String> list, boolean debug )
{
if( debug )
{

View File

@ -42,7 +42,7 @@ public ItemPrintout()
}
@Override
public void getSubItems( @Nonnull Item itemID, CreativeTabs tabs, List list )
public void getSubItems( @Nonnull Item itemID, CreativeTabs tabs, List<ItemStack> list )
{
list.add( createSingleFromTitleAndText( null, new String[ LINES_PER_PAGE ], new String[ LINES_PER_PAGE ] ) );
list.add( createMultipleFromTitleAndText( null, new String[ 2*LINES_PER_PAGE ], new String[ 2*LINES_PER_PAGE ] ) );
@ -50,7 +50,7 @@ public void getSubItems( @Nonnull Item itemID, CreativeTabs tabs, List list )
}
@Override
public void addInformation( ItemStack itemstack, EntityPlayer par2EntityPlayer, List list, boolean flag )
public void addInformation( ItemStack itemstack, EntityPlayer par2EntityPlayer, List<String> list, boolean flag )
{
String title = getTitle( itemstack );
if( title != null && title.length() > 0 )

View File

@ -36,12 +36,12 @@ public ItemTreasureDisk()
}
@Override
public void getSubItems( @Nonnull Item itemID, CreativeTabs tabs, List list )
public void getSubItems( @Nonnull Item itemID, CreativeTabs tabs, List<ItemStack> list )
{
}
@Override
public void addInformation( ItemStack stack, EntityPlayer player, List list, boolean bool )
public void addInformation( ItemStack stack, EntityPlayer player, List<String> list, boolean bool )
{
String label = getTitle( stack );
if( label != null && label.length() > 0 )

View File

@ -10,15 +10,14 @@
import dan200.computercraft.shared.peripheral.PeripheralType;
import dan200.computercraft.shared.peripheral.modem.TileCable;
import net.minecraft.block.Block;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import javax.annotation.Nonnull;
@ -79,7 +78,7 @@ public BlockCable()
@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {
return new BlockStateContainer( this,
Properties.MODEM,
Properties.CABLE,
Properties.NORTH,
@ -87,8 +86,8 @@ protected BlockStateContainer createBlockState()
Properties.EAST,
Properties.WEST,
Properties.UP,
Properties.DOWN,
});
Properties.DOWN
);
}
@Nonnull

View File

@ -13,7 +13,6 @@
import dan200.computercraft.shared.peripheral.monitor.TileMonitor;
import dan200.computercraft.shared.peripheral.printer.TilePrinter;
import dan200.computercraft.shared.util.DirectionUtil;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
@ -22,9 +21,9 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@ -62,10 +61,7 @@ public BlockRenderLayer getBlockLayer()
@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {
Properties.FACING,
Properties.VARIANT
});
return new BlockStateContainer( this, Properties.FACING, Properties.VARIANT );
}
@Nonnull

View File

@ -49,7 +49,7 @@ public ItemStack create( PeripheralType type, String label, int quantity )
}
@Override
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List list )
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List<ItemStack> list )
{
list.add( PeripheralItemFactory.create( PeripheralType.AdvancedModem, null, 1 ) );
}

View File

@ -63,7 +63,7 @@ public ItemStack create( PeripheralType type, String label, int quantity )
}
@Override
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List list )
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List<ItemStack> list )
{
list.add( PeripheralItemFactory.create( PeripheralType.WiredModem, null, 1 ) );
list.add( PeripheralItemFactory.create( PeripheralType.Cable, null, 1 ) );

View File

@ -69,7 +69,7 @@ public ItemStack create( PeripheralType type, String label, int quantity )
}
@Override
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List list )
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List<ItemStack> list )
{
list.add( PeripheralItemFactory.create( PeripheralType.DiskDrive, null, 1 ) );
list.add( PeripheralItemFactory.create( PeripheralType.Printer, null, 1 ) );

View File

@ -10,7 +10,6 @@
import dan200.computercraft.shared.peripheral.PeripheralType;
import dan200.computercraft.shared.peripheral.common.BlockPeripheralBase;
import dan200.computercraft.shared.peripheral.common.TilePeripheralBase;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
@ -45,10 +44,7 @@ public BlockAdvancedModem()
@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {
Properties.FACING,
Properties.ON
});
return new BlockStateContainer(this, Properties.FACING, Properties.ON );
}
@Nonnull

View File

@ -79,10 +79,9 @@ public void detectAndSendChanges()
boolean printing = m_printer.isPrinting();
for( IContainerListener listener : listeners )
{
IContainerListener icrafting = listener;
if( printing != m_lastPrinting )
{
icrafting.sendProgressBarUpdate( this, 0, printing ? 1 : 0 );
listener.sendProgressBarUpdate( this, 0, printing ? 1 : 0 );
}
}
m_lastPrinting = printing;

View File

@ -80,7 +80,7 @@ public ItemStack create( int id, String label, ComputerFamily family, IPocketUpg
}
@Override
public void getSubItems( @Nonnull Item itemID, CreativeTabs tabs, List list )
public void getSubItems( @Nonnull Item itemID, CreativeTabs tabs, List<ItemStack> list )
{
getSubItems( list, ComputerFamily.Normal );
getSubItems( list, ComputerFamily.Advanced );
@ -216,7 +216,7 @@ public String getItemStackDisplayName( @Nonnull ItemStack stack )
}
@Override
public void addInformation( ItemStack stack, EntityPlayer player, List list, boolean debug )
public void addInformation( ItemStack stack, EntityPlayer player, List<String> list, boolean debug )
{
if( debug )
{

View File

@ -31,6 +31,7 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
@ -275,7 +276,7 @@ private void registerTurtleUpgradeInternal( ITurtleUpgrade upgrade )
if( isUpgradeVanilla( upgrade ) )
{
// Add fake recipes to fool NEI
List recipeList = CraftingManager.getInstance().getRecipeList();
List<IRecipe> recipeList = CraftingManager.getInstance().getRecipeList();
ItemStack craftingItem = upgrade.getCraftingItem();
// A turtle just containing this upgrade

View File

@ -61,7 +61,7 @@
import net.minecraft.item.ItemRecord;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.IThreadListener;
@ -212,7 +212,7 @@ private void processPacket( ComputerCraftPacket packet, EntityPlayer player )
if (tileEntity != null && tileEntity instanceof TileGeneric)
{
TileGeneric generic = (TileGeneric) tileEntity;
Packet description = generic.getUpdatePacket();
SPacketUpdateTileEntity description = generic.getUpdatePacket();
if (description != null)
{
((EntityPlayerMP) player).connection.sendPacket( description );
@ -376,7 +376,7 @@ private void registerItems()
ItemStack paper = new ItemStack( Items.PAPER, 1 );
ItemStack redstone = new ItemStack( Items.REDSTONE, 1 );
ItemStack basicDisk = ItemDiskLegacy.createFromIDAndColour( -1, null, Colour.Blue.getHex() );
GameRegistry.addRecipe( new ImpostorShapelessRecipe( basicDisk, new Object[]{redstone, paper} ) );
GameRegistry.addRecipe( new ImpostorShapelessRecipe( basicDisk, new ItemStack[]{redstone, paper} ) );
for (int colour = 0; colour < 16; ++colour)
{
@ -387,12 +387,12 @@ private void registerItems()
if (colour != otherColour)
{
ItemStack otherDisk = ItemDiskLegacy.createFromIDAndColour( -1, null, Colour.values()[colour].getHex() );
GameRegistry.addRecipe( new ImpostorShapelessRecipe( disk, new Object[]{
GameRegistry.addRecipe( new ImpostorShapelessRecipe( disk, new ItemStack[]{
otherDisk, dye
} ) );
}
}
GameRegistry.addRecipe( new ImpostorShapelessRecipe( disk, new Object[]{
GameRegistry.addRecipe( new ImpostorShapelessRecipe( disk, new ItemStack[]{
redstone, paper, dye
} ) );
}
@ -406,10 +406,10 @@ private void registerItems()
// Impostor Printout recipes (to fool NEI)
ItemStack string = new ItemStack( Items.STRING, 1, 0 );
GameRegistry.addRecipe( new ImpostorShapelessRecipe( multiplePrintout, new Object[]{singlePrintout, singlePrintout, string} ) );
GameRegistry.addRecipe( new ImpostorShapelessRecipe( multiplePrintout, new ItemStack[]{singlePrintout, singlePrintout, string} ) );
ItemStack leather = new ItemStack( Items.LEATHER, 1, 0 );
GameRegistry.addRecipe( new ImpostorShapelessRecipe( bookPrintout, new Object[]{leather, singlePrintout, string} ) );
GameRegistry.addRecipe( new ImpostorShapelessRecipe( bookPrintout, new ItemStack[]{leather, singlePrintout, string} ) );
// Pocket Computer
ItemStack pocketComputer = PocketComputerItemFactory.create( -1, null, ComputerFamily.Normal, null );

View File

@ -26,8 +26,12 @@
import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.*;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
@ -573,8 +577,7 @@ public Vec3d getVisualPosition( float f )
@Override
public float getVisualYaw( float f )
{
float forward = DirectionUtil.toYawAngle( getDirection() );
float yaw = forward;
float yaw = DirectionUtil.toYawAngle( getDirection() );
switch( m_animation )
{
case TurnLeft:
@ -1133,19 +1136,16 @@ private void updateAnimation()
}
AxisAlignedBB aabb = new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ );
List list = world.getEntitiesWithinAABBExcludingEntity( null, aabb );
List<Entity> list = world.getEntitiesWithinAABBExcludingEntity( null, aabb );
if( !list.isEmpty() )
{
double pushStep = 1.0f / (float) ANIM_DURATION;
double pushStepX = (double) moveDir.getFrontOffsetX() * pushStep;
double pushStepY = (double) moveDir.getFrontOffsetY() * pushStep;
double pushStepZ = (double) moveDir.getFrontOffsetZ() * pushStep;
for (Object aList : list)
for (Entity entity : list)
{
Entity entity = (Entity) aList;
entity.moveEntity(
pushStepX, pushStepY, pushStepZ
);
entity.moveEntity( pushStepX, pushStepY, pushStepZ );
}
}
}

View File

@ -58,9 +58,8 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
table.put( "metadata", metadata );
Map<Object, Object> stateTable = new HashMap<Object, Object>();
for( Object o : state.getActualState( world, newPosition ).getProperties().entrySet() )
for( ImmutableMap.Entry<IProperty<?>, ?> entry : state.getActualState( world, newPosition ).getProperties().entrySet() )
{
ImmutableMap.Entry<IProperty, Object> entry = (ImmutableMap.Entry<IProperty, Object>)o;
String propertyName = entry.getKey().getName();
Object value = entry.getValue();
if( value instanceof String || value instanceof Number || value instanceof Boolean )

View File

@ -72,10 +72,9 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
if( ComputerCraft.turtlesCanPush && m_direction != MoveDirection.Up && m_direction != MoveDirection.Down )
{
// Check there is space for all the pushable entities to be pushed
List list = oldWorld.getEntitiesWithinAABBExcludingEntity( null, aabb );
for( Object aList : list )
List<Entity> list = oldWorld.getEntitiesWithinAABBExcludingEntity( null, aabb );
for( Entity entity : list )
{
Entity entity = (Entity) aList;
if( !entity.isDead && entity.preventEntitySpawning )
{
AxisAlignedBB entityBB = entity.getEntityBoundingBox();

View File

@ -208,8 +208,7 @@ private static ItemStack deployOnEntity( ItemStack stack, final ITurtleAccess tu
final BlockPos position = turtle.getPosition();
Vec3d turtlePos = new Vec3d( turtlePlayer.posX, turtlePlayer.posY, turtlePlayer.posZ );
Vec3d rayDir = turtlePlayer.getLook( 1.0f );
Vec3d rayStart = turtlePos;
Pair<Entity, Vec3d> hit = WorldUtil.rayTraceEntities( world, rayStart, rayDir, 1.5 );
Pair<Entity, Vec3d> hit = WorldUtil.rayTraceEntities( world, turtlePos, rayDir, 1.5 );
if( hit == null )
{
return stack;

View File

@ -90,14 +90,13 @@ public TurtleCommandResult execute( @Nonnull ITurtleAccess turtle )
newPosition.getX(), newPosition.getY(), newPosition.getZ(),
newPosition.getX() + 1.0, newPosition.getY() + 1.0, newPosition.getZ() + 1.0
);
List list = world.getEntitiesWithinAABBExcludingEntity( null, aabb );
List<Entity> list = world.getEntitiesWithinAABBExcludingEntity( null, aabb );
if( list.size() > 0 )
{
boolean foundItems = false;
boolean storedItems = false;
for( Object aList : list )
for( Entity entity : list )
{
Entity entity = (Entity) aList;
if( entity != null && entity instanceof EntityItem && !entity.isDead )
{
// Suck up the item

View File

@ -43,7 +43,7 @@ protected ItemTurtleBase( Block block )
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 list )
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List<ItemStack> list )
{
List<ItemStack> all = new ArrayList<ItemStack>();
ComputerCraft.addAllUpgradedTurtles( all );

View File

@ -170,8 +170,7 @@ private TurtleCommandResult attack( final ITurtleAccess turtle, EnumFacing direc
// See if there is an entity present
Vec3d turtlePos = new Vec3d( turtlePlayer.posX, turtlePlayer.posY, turtlePlayer.posZ );
Vec3d rayDir = turtlePlayer.getLook( 1.0f );
Vec3d rayStart = turtlePos;
Pair<Entity, Vec3d> hit = WorldUtil.rayTraceEntities( world, rayStart, rayDir, 1.5 );
Pair<Entity, Vec3d> hit = WorldUtil.rayTraceEntities( world, turtlePos, rayDir, 1.5 );
if( hit != null )
{
// Load up the turtle's inventory

View File

@ -16,9 +16,9 @@
public class ImpostorShapelessRecipe extends ShapelessRecipes
{
public ImpostorShapelessRecipe( ItemStack result, Object[] ingredients )
public ImpostorShapelessRecipe( ItemStack result, ItemStack[] ingredients )
{
super( result, new ArrayList(Arrays.asList( ingredients )));
super( result, new ArrayList<ItemStack>(Arrays.asList( ingredients )));
}
@Override

View File

@ -35,10 +35,10 @@ else if( object instanceof String )
}
else if( object instanceof Map )
{
Map<Object, Object> m = (Map<Object, Object>)object;
Map<?, ?> m = (Map<?, ?>)object;
NBTTagCompound nbt = new NBTTagCompound();
int i=0;
for( Map.Entry<Object, Object> entry : m.entrySet() )
for( Map.Entry<?, ?> entry : m.entrySet() )
{
NBTBase key = toNBTTag( entry.getKey() );
NBTBase value = toNBTTag( entry.getKey() );
@ -85,18 +85,15 @@ private static Object fromNBTTag( NBTBase tag )
{
case Constants.NBT.TAG_BYTE: // byte
{
boolean b = (((NBTTagByte)tag).getByte() > 0);
return b;
return (((NBTTagByte)tag).getByte() > 0);
}
case Constants.NBT.TAG_DOUBLE: // Double
{
double d = ((NBTTagDouble)tag).getDouble();
return d;
return ((NBTTagDouble)tag).getDouble();
}
case Constants.NBT.TAG_STRING: // String
{
String s = ((NBTTagString)tag).getString();
return s;
return ((NBTTagString)tag).getString();
}
case Constants.NBT.TAG_COMPOUND: // Compound
{

View File

@ -13,7 +13,7 @@
public class ReflectionUtil
{
public static Class getOptionalClass( String name )
public static Class<?> getOptionalClass( String name )
{
try
{
@ -26,16 +26,16 @@ public static Class getOptionalClass( String name )
return null;
}
public static Class getOptionalInnerClass( Class enclosingClass, String name )
public static Class<?> getOptionalInnerClass( Class<?> enclosingClass, String name )
{
if( enclosingClass != null )
{
try
{
Class[] declaredClasses = enclosingClass.getDeclaredClasses();
Class<?>[] declaredClasses = enclosingClass.getDeclaredClasses();
if( declaredClasses != null )
{
for( Class declaredClass : declaredClasses )
for( Class<?> declaredClass : declaredClasses )
{
if( declaredClass.getSimpleName().equals( name ) )
{
@ -52,7 +52,7 @@ public static Class getOptionalInnerClass( Class enclosingClass, String name )
return null;
}
public static Method getOptionalMethod( Class clazz, String name, Class[] arguments )
public static Method getOptionalMethod( Class<?> clazz, String name, Class<?>[] arguments )
{
if( clazz != null )
{
@ -68,7 +68,7 @@ public static Method getOptionalMethod( Class clazz, String name, Class[] argume
return null;
}
public static Constructor getOptionalConstructor( Class clazz, Class[] arguments )
public static <T> Constructor<T> getOptionalConstructor( Class<T> clazz, Class<?>[] arguments )
{
if( clazz != null )
{
@ -84,7 +84,7 @@ public static Constructor getOptionalConstructor( Class clazz, Class[] arguments
return null;
}
public static Field getOptionalField( Class clazz, String name )
public static Field getOptionalField( Class<?> clazz, String name )
{
if( clazz != null )
{
@ -97,7 +97,7 @@ public static Field getOptionalField( Class clazz, String name )
{
field.setAccessible( true );
}
catch( Exception e )
catch( Exception ignored )
{
}
}
@ -111,16 +111,16 @@ public static Field getOptionalField( Class clazz, String name )
return null;
}
public static <T> T safeNew( Constructor constructor, Object[] arguments, Class<T> resultClass )
public static <T> T safeNew( Constructor<T> constructor, Object[] arguments, Class<T> resultClass )
{
if( constructor != null )
{
try
{
Object result = constructor.newInstance( arguments );
T result = constructor.newInstance( arguments );
if( result != null && resultClass.isInstance( result ) )
{
return (T)result;
return result;
}
}
catch( Exception e )
@ -131,7 +131,7 @@ public static <T> T safeNew( Constructor constructor, Object[] arguments, Class<
return null;
}
public static boolean safeInstanceOf( Object object, Class clazz )
public static boolean safeInstanceOf( Object object, Class<?> clazz )
{
if( clazz != null )
{
@ -158,6 +158,7 @@ public static void safeInvoke( Method method, Object object, Object[] arguments
}
}
@SuppressWarnings("unchecked")
public static <T> T safeInvoke( Method method, Object object, Object[] arguments, Class<T> resultClass )
{
if( method != null )
@ -182,6 +183,7 @@ public static <T> T safeInvoke( Method method, Object object, Object[] arguments
return null;
}
@SuppressWarnings("unchecked")
public static <T> T safeGet( Field field, Object object, Class<T> resultClass )
{
if( field != null )

View File

@ -60,10 +60,9 @@ public static Pair<Entity, Vec3d> rayTraceEntities( World world, Vec3d vecStart,
Entity closest = null;
double closestDist = 99.0;
List list = world.getEntitiesWithinAABBExcludingEntity( null, bigBox );
for( Object aList : list )
List<Entity> list = world.getEntitiesWithinAABBExcludingEntity( null, bigBox );
for( Entity entity : list )
{
Entity entity = (Entity) aList;
if( entity.isDead || !entity.canBeCollidedWith() )
{
continue;