mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-03-28 22:36:59 +00:00
Fix some warnings (#235)
Remove some unused code and fix a bunch of warnings
This commit is contained in:
parent
00c395f689
commit
7d428030df
6
.gitignore
vendored
6
.gitignore
vendored
@ -15,3 +15,9 @@
|
|||||||
.idea
|
.idea
|
||||||
.gradle
|
.gradle
|
||||||
*.DS_Store
|
*.DS_Store
|
||||||
|
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
.settings/
|
||||||
|
bin/
|
||||||
|
*.launch
|
||||||
|
@ -90,7 +90,6 @@ public interface IMount
|
|||||||
* @throws IOException If the file does not exist, or could not be opened.
|
* @throws IOException If the file does not exist, or could not be opened.
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@SuppressWarnings( "deprecation" )
|
|
||||||
default ReadableByteChannel openChannelForRead( @Nonnull String path ) throws IOException
|
default ReadableByteChannel openChannelForRead( @Nonnull String path ) throws IOException
|
||||||
{
|
{
|
||||||
return Channels.newChannel( openForRead( path ) );
|
return Channels.newChannel( openForRead( path ) );
|
||||||
|
@ -67,7 +67,6 @@ public interface IWritableMount extends IMount
|
|||||||
* @throws IOException If the file could not be opened for writing.
|
* @throws IOException If the file could not be opened for writing.
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@SuppressWarnings( "deprecation" )
|
|
||||||
default WritableByteChannel openChannelForWrite( @Nonnull String path ) throws IOException
|
default WritableByteChannel openChannelForWrite( @Nonnull String path ) throws IOException
|
||||||
{
|
{
|
||||||
return Channels.newChannel( openForWrite( path ) );
|
return Channels.newChannel( openForWrite( path ) );
|
||||||
@ -94,7 +93,6 @@ public interface IWritableMount extends IMount
|
|||||||
* @throws IOException If the file could not be opened for writing.
|
* @throws IOException If the file could not be opened for writing.
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@SuppressWarnings( "deprecation" )
|
|
||||||
default WritableByteChannel openChannelForAppend( @Nonnull String path ) throws IOException
|
default WritableByteChannel openChannelForAppend( @Nonnull String path ) throws IOException
|
||||||
{
|
{
|
||||||
return Channels.newChannel( openForAppend( path ) );
|
return Channels.newChannel( openForAppend( path ) );
|
||||||
|
@ -83,6 +83,7 @@ public class HTTPAPI implements ILuaAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings( "resource" )
|
||||||
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] args ) throws LuaException
|
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] args ) throws LuaException
|
||||||
{
|
{
|
||||||
switch( method )
|
switch( method )
|
||||||
@ -95,7 +96,7 @@ public class HTTPAPI implements ILuaAPI
|
|||||||
|
|
||||||
if( args.length >= 1 && args[0] instanceof Map )
|
if( args.length >= 1 && args[0] instanceof Map )
|
||||||
{
|
{
|
||||||
Map<?, ?> options = (Map) args[0];
|
Map<?, ?> options = (Map<?, ?>) args[0];
|
||||||
address = getStringField( options, "url" );
|
address = getStringField( options, "url" );
|
||||||
postString = optStringField( options, "body", null );
|
postString = optStringField( options, "body", null );
|
||||||
headerTable = optTableField( options, "headers", Collections.emptyMap() );
|
headerTable = optTableField( options, "headers", Collections.emptyMap() );
|
||||||
@ -135,7 +136,6 @@ public class HTTPAPI implements ILuaAPI
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
URI uri = HttpRequest.checkUri( address );
|
URI uri = HttpRequest.checkUri( address );
|
||||||
|
|
||||||
HttpRequest request = new HttpRequest( requests, m_apiEnvironment, address, postString, headers, binary, redirect );
|
HttpRequest request = new HttpRequest( requests, m_apiEnvironment, address, postString, headers, binary, redirect );
|
||||||
|
|
||||||
long requestBody = request.body().readableBytes() + HttpRequest.getHeaderSize( headers );
|
long requestBody = request.body().readableBytes() + HttpRequest.getHeaderSize( headers );
|
||||||
|
@ -401,7 +401,6 @@ public class OSAPI implements ILuaAPI
|
|||||||
Instant instant = Instant.ofEpochSecond( time );
|
Instant instant = Instant.ofEpochSecond( time );
|
||||||
ZonedDateTime date;
|
ZonedDateTime date;
|
||||||
ZoneOffset offset;
|
ZoneOffset offset;
|
||||||
boolean isDst;
|
|
||||||
if( format.startsWith( "!" ) )
|
if( format.startsWith( "!" ) )
|
||||||
{
|
{
|
||||||
offset = ZoneOffset.UTC;
|
offset = ZoneOffset.UTC;
|
||||||
|
@ -356,7 +356,6 @@ public class PeripheralAPI implements ILuaAPI, IAPIEnvironment.IPeripheralChange
|
|||||||
ComputerSide side = ComputerSide.valueOfInsensitive( getString( args, 0 ) );
|
ComputerSide side = ComputerSide.valueOfInsensitive( getString( args, 0 ) );
|
||||||
if( side != null )
|
if( side != null )
|
||||||
{
|
{
|
||||||
String type = null;
|
|
||||||
synchronized( m_peripherals )
|
synchronized( m_peripherals )
|
||||||
{
|
{
|
||||||
PeripheralWrapper p = m_peripherals[side.ordinal()];
|
PeripheralWrapper p = m_peripherals[side.ordinal()];
|
||||||
|
@ -239,7 +239,6 @@ public class Computer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@SuppressWarnings( "unused" )
|
|
||||||
public void advance( double dt )
|
public void advance( double dt )
|
||||||
{
|
{
|
||||||
tick();
|
tick();
|
||||||
|
@ -93,7 +93,7 @@ public class JarMount implements IMount
|
|||||||
new MountReference( this );
|
new MountReference( this );
|
||||||
|
|
||||||
// Read in all the entries
|
// Read in all the entries
|
||||||
root = new FileEntry( "" );
|
root = new FileEntry();
|
||||||
Enumeration<? extends ZipEntry> zipEntries = zip.entries();
|
Enumeration<? extends ZipEntry> zipEntries = zip.entries();
|
||||||
while( zipEntries.hasMoreElements() )
|
while( zipEntries.hasMoreElements() )
|
||||||
{
|
{
|
||||||
@ -140,7 +140,7 @@ public class JarMount implements IMount
|
|||||||
FileEntry nextEntry = lastEntry.children.get( part );
|
FileEntry nextEntry = lastEntry.children.get( part );
|
||||||
if( nextEntry == null || !nextEntry.isDirectory() )
|
if( nextEntry == null || !nextEntry.isDirectory() )
|
||||||
{
|
{
|
||||||
lastEntry.children.put( part, nextEntry = new FileEntry( part ) );
|
lastEntry.children.put( part, nextEntry = new FileEntry() );
|
||||||
}
|
}
|
||||||
|
|
||||||
lastEntry = nextEntry;
|
lastEntry = nextEntry;
|
||||||
@ -224,17 +224,10 @@ public class JarMount implements IMount
|
|||||||
|
|
||||||
private static class FileEntry
|
private static class FileEntry
|
||||||
{
|
{
|
||||||
final String name;
|
|
||||||
|
|
||||||
String path;
|
String path;
|
||||||
long size;
|
long size;
|
||||||
Map<String, FileEntry> children;
|
Map<String, FileEntry> children;
|
||||||
|
|
||||||
FileEntry( String name )
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup( ZipEntry entry )
|
void setup( ZipEntry entry )
|
||||||
{
|
{
|
||||||
path = entry.getName();
|
path = entry.getName();
|
||||||
|
@ -51,7 +51,6 @@ public abstract class BlockGeneric extends Block implements ITileEntityProvider
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@SuppressWarnings( "deprecation" )
|
|
||||||
public final void neighborChanged( IBlockState state, World world, BlockPos pos, Block neighbourBlock, BlockPos neighbourPos )
|
public final void neighborChanged( IBlockState state, World world, BlockPos pos, Block neighbourBlock, BlockPos neighbourPos )
|
||||||
{
|
{
|
||||||
TileEntity tile = world.getTileEntity( pos );
|
TileEntity tile = world.getTileEntity( pos );
|
||||||
|
@ -63,7 +63,6 @@ public abstract class TileGeneric extends TileEntity
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( "deprecation" )
|
|
||||||
public void onNeighbourChange( @Nonnull BlockPos neighbour )
|
public void onNeighbourChange( @Nonnull BlockPos neighbour )
|
||||||
{
|
{
|
||||||
onNeighbourChange();
|
onNeighbourChange();
|
||||||
|
@ -220,6 +220,13 @@ public class ServerComputer extends ServerTerminal implements IComputer, IComput
|
|||||||
return m_instanceID;
|
return m_instanceID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* getID and getLabel are deprecated on IComputer, as they do not make sense in ClientComputer.
|
||||||
|
* However, for compatibility reasons, we still need these here, and have no choice but to override the IComputer methods.
|
||||||
|
*
|
||||||
|
* Hence, we suppress the deprecation warning.
|
||||||
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings( "deprecation" )
|
@SuppressWarnings( "deprecation" )
|
||||||
public int getID()
|
public int getID()
|
||||||
|
@ -90,6 +90,7 @@ public class JEIComputerCraft implements IModPlugin
|
|||||||
ingredients.addIngredientsAtRuntime( VanillaTypes.ITEM, upgradeItems );
|
ingredients.addIngredientsAtRuntime( VanillaTypes.ITEM, upgradeItems );
|
||||||
|
|
||||||
// Hide all upgrade recipes
|
// Hide all upgrade recipes
|
||||||
|
@SuppressWarnings( "unchecked" )
|
||||||
IRecipeCategory<? extends IRecipeWrapper> category = (IRecipeCategory<? extends IRecipeWrapper>) registry.getRecipeCategory( VanillaRecipeCategoryUid.CRAFTING );
|
IRecipeCategory<? extends IRecipeWrapper> category = (IRecipeCategory<? extends IRecipeWrapper>) registry.getRecipeCategory( VanillaRecipeCategoryUid.CRAFTING );
|
||||||
if( category != null )
|
if( category != null )
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,7 @@ public abstract class SpeakerPeripheral implements IPeripheral
|
|||||||
{
|
{
|
||||||
// FIXME: Should be abstract, but we need this for Plethora compat. We'll
|
// FIXME: Should be abstract, but we need this for Plethora compat. We'll
|
||||||
// be able to change this in a few versions as we implement both there.
|
// be able to change this in a few versions as we implement both there.
|
||||||
@SuppressWarnings( "deprecation" ) BlockPos pos = getPos();
|
BlockPos pos = getPos();
|
||||||
return new Vec3d( pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5 );
|
return new Vec3d( pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,6 @@ public class TurtlePlaceCommand implements ITurtleCommand
|
|||||||
|
|
||||||
// Remember old block
|
// Remember old block
|
||||||
EnumFacing direction = m_direction.toWorldDir( turtle );
|
EnumFacing direction = m_direction.toWorldDir( turtle );
|
||||||
World world = turtle.getWorld();
|
|
||||||
BlockPos coordinates = turtle.getPosition().offset( direction );
|
BlockPos coordinates = turtle.getPosition().offset( direction );
|
||||||
|
|
||||||
// Create a fake player, and orient it appropriately
|
// Create a fake player, and orient it appropriately
|
||||||
|
@ -35,7 +35,6 @@ public final class StringUtil
|
|||||||
/**
|
/**
|
||||||
* Translates a Stat name
|
* Translates a Stat name
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings( "deprecation" )
|
|
||||||
public static String translate( String key )
|
public static String translate( String key )
|
||||||
{
|
{
|
||||||
return net.minecraft.util.text.translation.I18n.translateToLocal( key );
|
return net.minecraft.util.text.translation.I18n.translateToLocal( key );
|
||||||
@ -44,7 +43,6 @@ public final class StringUtil
|
|||||||
/**
|
/**
|
||||||
* Translates a Stat name with format args
|
* Translates a Stat name with format args
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings( "deprecation" )
|
|
||||||
public static String translateFormatted( String key, Object... format )
|
public static String translateFormatted( String key, Object... format )
|
||||||
{
|
{
|
||||||
return net.minecraft.util.text.translation.I18n.translateToLocalFormatted( key, format );
|
return net.minecraft.util.text.translation.I18n.translateToLocalFormatted( key, format );
|
||||||
|
@ -25,7 +25,6 @@ import net.minecraft.world.World;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Disabled;
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.Tag;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@ -440,20 +439,6 @@ public class NetworkTest
|
|||||||
this.box = (T[]) new Object[size * size * size];
|
this.box = (T[]) new Object[size * size * size];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set( BlockPos pos, T elem )
|
|
||||||
{
|
|
||||||
int x = pos.getX(), y = pos.getY(), z = pos.getZ();
|
|
||||||
|
|
||||||
if( x >= 0 && x < size && y >= 0 && y < size && z >= 0 && z < size )
|
|
||||||
{
|
|
||||||
box[x * size * size + y * size + z] = elem;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new IndexOutOfBoundsException( pos.toString() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public T get( BlockPos pos )
|
public T get( BlockPos pos )
|
||||||
{
|
{
|
||||||
int x = pos.getX(), y = pos.getY(), z = pos.getZ();
|
int x = pos.getX(), y = pos.getY(), z = pos.getZ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user