mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-04-14 06:43:16 +00:00
Remove most raw types
This means we can remove even more casts and what not.
This commit is contained in:
parent
9af15d1e30
commit
db9cd15fb3
@ -586,8 +586,7 @@ public class ComputerCraft
|
||||
{
|
||||
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 class ComputerCraft
|
||||
{
|
||||
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 class ComputerCraft
|
||||
{
|
||||
try
|
||||
{
|
||||
IMediaProvider handler = mediaProvider;
|
||||
IMedia media = handler.getMedia( stack );
|
||||
IMedia media = mediaProvider.getMedia( stack );
|
||||
if( media != null )
|
||||
{
|
||||
return media;
|
||||
|
@ -298,36 +298,36 @@ public final class ComputerCraftAPI
|
||||
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 @@ public final class ComputerCraftAPI
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -279,10 +279,10 @@ public class ComputerCraftProxyClient extends ComputerCraftProxyCommon
|
||||
@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 );
|
||||
}
|
||||
|
@ -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 )
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ public class FSAPI implements ILuaAPI
|
||||
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 class FSAPI implements ILuaAPI
|
||||
throw new LuaException( "Expected string" );
|
||||
}
|
||||
String path = (String)args[0];
|
||||
return new Object[]{ m_fileSystem.getDirectory( path ) };
|
||||
return new Object[]{ FileSystem.getDirectory( path ) };
|
||||
}
|
||||
default:
|
||||
{
|
||||
|
@ -201,7 +201,7 @@ public class HTTPAPI implements ILuaAPI
|
||||
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() )
|
||||
{
|
||||
|
@ -477,8 +477,7 @@ public class PeripheralAPI implements ILuaAPI, IAPIEnvironment.IPeripheralChange
|
||||
}
|
||||
if( p != null )
|
||||
{
|
||||
Object[] results = p.call( context, methodName, methodArgs );
|
||||
return results;
|
||||
return p.call( context, methodName, methodArgs );
|
||||
}
|
||||
}
|
||||
throw new LuaException( "No peripheral attached" );
|
||||
|
@ -316,8 +316,6 @@ public class LuaJLuaMachine implements ILuaMachine
|
||||
throw new LuaError( abortMessage );
|
||||
}
|
||||
}
|
||||
|
||||
private static long s_nextUnusedTaskID = 0;
|
||||
|
||||
private LuaTable wrapLuaObject( ILuaObject object )
|
||||
{
|
||||
@ -531,9 +529,8 @@ public class LuaJLuaMachine implements ILuaMachine
|
||||
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 @@ public class LuaJLuaMachine implements ILuaMachine
|
||||
}
|
||||
else if( object instanceof ILuaObject )
|
||||
{
|
||||
LuaValue table = wrapLuaObject( (ILuaObject)object );
|
||||
return table;
|
||||
return wrapLuaObject( (ILuaObject)object );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -623,7 +619,7 @@ public class LuaJLuaMachine implements ILuaMachine
|
||||
{
|
||||
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
|
||||
|
@ -120,9 +120,8 @@ public class CommandAPI implements ILuaAPI
|
||||
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 class CommandAPI implements ILuaAPI
|
||||
{
|
||||
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 ) )
|
||||
|
@ -11,7 +11,6 @@ import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
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 class BlockCommandComputer extends BlockComputerBase
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {
|
||||
Properties.FACING,
|
||||
Properties.STATE
|
||||
});
|
||||
return new BlockStateContainer(this, Properties.FACING, Properties.STATE );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -12,7 +12,6 @@ import dan200.computercraft.shared.computer.core.IComputer;
|
||||
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.entity.EntityLivingBase;
|
||||
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 class BlockComputer extends BlockComputerBase
|
||||
@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
|
||||
|
@ -52,7 +52,7 @@ public class ItemCommandComputer extends ItemComputer
|
||||
}
|
||||
|
||||
@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 ) );
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class ItemComputer extends ItemComputerBase
|
||||
}
|
||||
|
||||
@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 ) );
|
||||
|
@ -36,7 +36,7 @@ public abstract class ItemComputerBase extends ItemBlock implements IComputerIte
|
||||
}
|
||||
|
||||
@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 )
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ public class ItemDiskLegacy extends Item
|
||||
}
|
||||
|
||||
@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 @@ public class ItemDiskLegacy extends Item
|
||||
}
|
||||
|
||||
@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 )
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ public class ItemPrintout extends Item
|
||||
}
|
||||
|
||||
@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 class ItemPrintout extends Item
|
||||
}
|
||||
|
||||
@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 )
|
||||
|
@ -36,12 +36,12 @@ public class ItemTreasureDisk extends Item
|
||||
}
|
||||
|
||||
@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 )
|
||||
|
@ -10,15 +10,14 @@ import dan200.computercraft.ComputerCraft;
|
||||
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 class BlockCable extends BlockPeripheralBase
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {
|
||||
return new BlockStateContainer( this,
|
||||
Properties.MODEM,
|
||||
Properties.CABLE,
|
||||
Properties.NORTH,
|
||||
@ -87,8 +86,8 @@ public class BlockCable extends BlockPeripheralBase
|
||||
Properties.EAST,
|
||||
Properties.WEST,
|
||||
Properties.UP,
|
||||
Properties.DOWN,
|
||||
});
|
||||
Properties.DOWN
|
||||
);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -13,7 +13,6 @@ import dan200.computercraft.shared.peripheral.modem.TileWirelessModem;
|
||||
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.entity.EntityLivingBase;
|
||||
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 class BlockPeripheral extends BlockPeripheralBase
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {
|
||||
Properties.FACING,
|
||||
Properties.VARIANT
|
||||
});
|
||||
return new BlockStateContainer( this, Properties.FACING, Properties.VARIANT );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -49,7 +49,7 @@ public class ItemAdvancedModem extends ItemPeripheralBase
|
||||
}
|
||||
|
||||
@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 ) );
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public class ItemCable extends ItemPeripheralBase
|
||||
}
|
||||
|
||||
@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 ) );
|
||||
|
@ -69,7 +69,7 @@ public class ItemPeripheral extends ItemPeripheralBase
|
||||
}
|
||||
|
||||
@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 ) );
|
||||
|
@ -10,7 +10,6 @@ import dan200.computercraft.ComputerCraft;
|
||||
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 class BlockAdvancedModem extends BlockPeripheralBase
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {
|
||||
Properties.FACING,
|
||||
Properties.ON
|
||||
});
|
||||
return new BlockStateContainer(this, Properties.FACING, Properties.ON );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -79,10 +79,9 @@ public class ContainerPrinter extends Container
|
||||
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;
|
||||
|
@ -80,7 +80,7 @@ public class ItemPocketComputer extends Item implements IComputerItem, IMedia
|
||||
}
|
||||
|
||||
@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 class ItemPocketComputer extends Item implements IComputerItem, IMedia
|
||||
}
|
||||
|
||||
@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 )
|
||||
{
|
||||
|
@ -31,6 +31,7 @@ import net.minecraft.init.Items;
|
||||
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 @@ public abstract class CCTurtleProxyCommon implements ICCTurtleProxy
|
||||
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
|
||||
|
@ -61,7 +61,7 @@ import net.minecraft.item.Item;
|
||||
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 @@ public abstract class ComputerCraftProxyCommon implements IComputerCraftProxy
|
||||
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 @@ public abstract class ComputerCraftProxyCommon implements IComputerCraftProxy
|
||||
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 @@ public abstract class ComputerCraftProxyCommon implements IComputerCraftProxy
|
||||
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 @@ public abstract class ComputerCraftProxyCommon implements IComputerCraftProxy
|
||||
|
||||
// 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 );
|
||||
|
@ -26,8 +26,12 @@ import net.minecraft.entity.Entity;
|
||||
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 class TurtleBrain implements ITurtleAccess
|
||||
@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 @@ public class TurtleBrain implements ITurtleAccess
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,9 +58,8 @@ public class TurtleInspectCommand implements ITurtleCommand
|
||||
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 )
|
||||
|
@ -72,10 +72,9 @@ public class TurtleMoveCommand implements ITurtleCommand
|
||||
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();
|
||||
|
@ -208,8 +208,7 @@ public class TurtlePlaceCommand implements ITurtleCommand
|
||||
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;
|
||||
|
@ -90,14 +90,13 @@ public class TurtleSuckCommand implements ITurtleCommand
|
||||
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
|
||||
|
@ -43,7 +43,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 list )
|
||||
public void getSubItems( @Nonnull Item itemID, @Nonnull CreativeTabs tabs, @Nonnull List<ItemStack> list )
|
||||
{
|
||||
List<ItemStack> all = new ArrayList<ItemStack>();
|
||||
ComputerCraft.addAllUpgradedTurtles( all );
|
||||
|
@ -170,8 +170,7 @@ public class TurtleTool implements ITurtleUpgrade
|
||||
// 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
|
||||
|
@ -16,9 +16,9 @@ import java.util.Arrays;
|
||||
|
||||
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
|
||||
|
@ -35,10 +35,10 @@ public class NBTUtil
|
||||
}
|
||||
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 @@ public class NBTUtil
|
||||
{
|
||||
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
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ import java.lang.reflect.Modifier;
|
||||
|
||||
public class ReflectionUtil
|
||||
{
|
||||
public static Class getOptionalClass( String name )
|
||||
public static Class<?> getOptionalClass( String name )
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -26,16 +26,16 @@ public class ReflectionUtil
|
||||
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 class ReflectionUtil
|
||||
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 class ReflectionUtil
|
||||
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 class ReflectionUtil
|
||||
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 class ReflectionUtil
|
||||
{
|
||||
field.setAccessible( true );
|
||||
}
|
||||
catch( Exception e )
|
||||
catch( Exception ignored )
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -111,16 +111,16 @@ public class ReflectionUtil
|
||||
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 class ReflectionUtil
|
||||
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 class ReflectionUtil
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T safeInvoke( Method method, Object object, Object[] arguments, Class<T> resultClass )
|
||||
{
|
||||
if( method != null )
|
||||
@ -182,6 +183,7 @@ public class ReflectionUtil
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T safeGet( Field field, Object object, Class<T> resultClass )
|
||||
{
|
||||
if( field != null )
|
||||
|
@ -60,10 +60,9 @@ public class WorldUtil
|
||||
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user