mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-04 23:40:00 +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
|
||||
.gradle
|
||||
*.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.
|
||||
*/
|
||||
@Nonnull
|
||||
@SuppressWarnings( "deprecation" )
|
||||
default ReadableByteChannel openChannelForRead( @Nonnull String path ) throws IOException
|
||||
{
|
||||
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.
|
||||
*/
|
||||
@Nonnull
|
||||
@SuppressWarnings( "deprecation" )
|
||||
default WritableByteChannel openChannelForWrite( @Nonnull String path ) throws IOException
|
||||
{
|
||||
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.
|
||||
*/
|
||||
@Nonnull
|
||||
@SuppressWarnings( "deprecation" )
|
||||
default WritableByteChannel openChannelForAppend( @Nonnull String path ) throws IOException
|
||||
{
|
||||
return Channels.newChannel( openForAppend( path ) );
|
||||
|
@ -83,6 +83,7 @@ public class HTTPAPI implements ILuaAPI
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings( "resource" )
|
||||
public Object[] callMethod( @Nonnull ILuaContext context, int method, @Nonnull Object[] args ) throws LuaException
|
||||
{
|
||||
switch( method )
|
||||
@ -95,7 +96,7 @@ public class HTTPAPI implements ILuaAPI
|
||||
|
||||
if( args.length >= 1 && args[0] instanceof Map )
|
||||
{
|
||||
Map<?, ?> options = (Map) args[0];
|
||||
Map<?, ?> options = (Map<?, ?>) args[0];
|
||||
address = getStringField( options, "url" );
|
||||
postString = optStringField( options, "body", null );
|
||||
headerTable = optTableField( options, "headers", Collections.emptyMap() );
|
||||
@ -135,7 +136,6 @@ public class HTTPAPI implements ILuaAPI
|
||||
try
|
||||
{
|
||||
URI uri = HttpRequest.checkUri( address );
|
||||
|
||||
HttpRequest request = new HttpRequest( requests, m_apiEnvironment, address, postString, headers, binary, redirect );
|
||||
|
||||
long requestBody = request.body().readableBytes() + HttpRequest.getHeaderSize( headers );
|
||||
|
@ -401,7 +401,6 @@ public class OSAPI implements ILuaAPI
|
||||
Instant instant = Instant.ofEpochSecond( time );
|
||||
ZonedDateTime date;
|
||||
ZoneOffset offset;
|
||||
boolean isDst;
|
||||
if( format.startsWith( "!" ) )
|
||||
{
|
||||
offset = ZoneOffset.UTC;
|
||||
|
@ -356,7 +356,6 @@ public class PeripheralAPI implements ILuaAPI, IAPIEnvironment.IPeripheralChange
|
||||
ComputerSide side = ComputerSide.valueOfInsensitive( getString( args, 0 ) );
|
||||
if( side != null )
|
||||
{
|
||||
String type = null;
|
||||
synchronized( m_peripherals )
|
||||
{
|
||||
PeripheralWrapper p = m_peripherals[side.ordinal()];
|
||||
|
@ -239,7 +239,6 @@ public class Computer
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@SuppressWarnings( "unused" )
|
||||
public void advance( double dt )
|
||||
{
|
||||
tick();
|
||||
|
@ -93,7 +93,7 @@ public class JarMount implements IMount
|
||||
new MountReference( this );
|
||||
|
||||
// Read in all the entries
|
||||
root = new FileEntry( "" );
|
||||
root = new FileEntry();
|
||||
Enumeration<? extends ZipEntry> zipEntries = zip.entries();
|
||||
while( zipEntries.hasMoreElements() )
|
||||
{
|
||||
@ -140,7 +140,7 @@ public class JarMount implements IMount
|
||||
FileEntry nextEntry = lastEntry.children.get( part );
|
||||
if( nextEntry == null || !nextEntry.isDirectory() )
|
||||
{
|
||||
lastEntry.children.put( part, nextEntry = new FileEntry( part ) );
|
||||
lastEntry.children.put( part, nextEntry = new FileEntry() );
|
||||
}
|
||||
|
||||
lastEntry = nextEntry;
|
||||
@ -224,17 +224,10 @@ public class JarMount implements IMount
|
||||
|
||||
private static class FileEntry
|
||||
{
|
||||
final String name;
|
||||
|
||||
String path;
|
||||
long size;
|
||||
Map<String, FileEntry> children;
|
||||
|
||||
FileEntry( String name )
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
void setup( ZipEntry entry )
|
||||
{
|
||||
path = entry.getName();
|
||||
|
@ -51,7 +51,6 @@ public abstract class BlockGeneric extends Block implements ITileEntityProvider
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
@SuppressWarnings( "deprecation" )
|
||||
public final void neighborChanged( IBlockState state, World world, BlockPos pos, Block neighbourBlock, BlockPos neighbourPos )
|
||||
{
|
||||
TileEntity tile = world.getTileEntity( pos );
|
||||
|
@ -63,7 +63,6 @@ public abstract class TileGeneric extends TileEntity
|
||||
{
|
||||
}
|
||||
|
||||
@SuppressWarnings( "deprecation" )
|
||||
public void onNeighbourChange( @Nonnull BlockPos neighbour )
|
||||
{
|
||||
onNeighbourChange();
|
||||
|
@ -220,6 +220,13 @@ public class ServerComputer extends ServerTerminal implements IComputer, IComput
|
||||
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
|
||||
@SuppressWarnings( "deprecation" )
|
||||
public int getID()
|
||||
|
@ -90,6 +90,7 @@ public class JEIComputerCraft implements IModPlugin
|
||||
ingredients.addIngredientsAtRuntime( VanillaTypes.ITEM, upgradeItems );
|
||||
|
||||
// Hide all upgrade recipes
|
||||
@SuppressWarnings( "unchecked" )
|
||||
IRecipeCategory<? extends IRecipeWrapper> category = (IRecipeCategory<? extends IRecipeWrapper>) registry.getRecipeCategory( VanillaRecipeCategoryUid.CRAFTING );
|
||||
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
|
||||
// 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 );
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,6 @@ public class TurtlePlaceCommand implements ITurtleCommand
|
||||
|
||||
// Remember old block
|
||||
EnumFacing direction = m_direction.toWorldDir( turtle );
|
||||
World world = turtle.getWorld();
|
||||
BlockPos coordinates = turtle.getPosition().offset( direction );
|
||||
|
||||
// Create a fake player, and orient it appropriately
|
||||
|
@ -35,7 +35,6 @@ public final class StringUtil
|
||||
/**
|
||||
* Translates a Stat name
|
||||
*/
|
||||
@SuppressWarnings( "deprecation" )
|
||||
public static String translate( String 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
|
||||
*/
|
||||
@SuppressWarnings( "deprecation" )
|
||||
public static String translateFormatted( String key, Object... 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.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@ -440,20 +439,6 @@ public class NetworkTest
|
||||
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 )
|
||||
{
|
||||
int x = pos.getX(), y = pos.getY(), z = pos.getZ();
|
||||
|
Loading…
Reference in New Issue
Block a user