Minor code style fixups

- Add missing @Override annotations. I can't find a way to enforce this
   with checkstyle - maybe I need spotbugs too D:.
 - Remove superflous "this"es.
This commit is contained in:
Jonathan Coates 2021-06-12 22:18:35 +01:00
parent d4745ae47e
commit 2fab1a3054
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
24 changed files with 57 additions and 53 deletions

View File

@ -32,7 +32,7 @@ public TransformedModel( @Nonnull IBakedModel model, @Nonnull TransformationMatr
public TransformedModel( @Nonnull IBakedModel model )
{
this.model = Objects.requireNonNull( model );
this.matrix = TransformationMatrix.identity();
matrix = TransformationMatrix.identity();
}
public static TransformedModel of( @Nonnull ModelResourceLocation location )

View File

@ -30,7 +30,7 @@ public FileOperationException( @Nullable String filename, @Nonnull String messag
public FileOperationException( @Nonnull String message )
{
super( Objects.requireNonNull( message, "message cannot be null" ) );
this.filename = null;
filename = null;
}
@Nullable

View File

@ -19,14 +19,14 @@ public class LuaException extends Exception
public LuaException( @Nullable String message )
{
super( message );
this.hasLevel = false;
this.level = 1;
hasLevel = false;
level = 1;
}
public LuaException( @Nullable String message, int level )
{
super( message );
this.hasLevel = true;
hasLevel = true;
this.level = level;
}

View File

@ -30,14 +30,14 @@ public final class MethodResult
private MethodResult( Object[] arguments, ILuaCallback callback )
{
this.result = arguments;
result = arguments;
this.callback = callback;
this.adjust = 0;
adjust = 0;
}
private MethodResult( Object[] arguments, ILuaCallback callback, int adjust )
{
this.result = arguments;
result = arguments;
this.callback = callback;
this.adjust = adjust;
}

View File

@ -62,6 +62,7 @@ public DynamicImageButton(
this.tooltip = tooltip;
}
@Override
public void renderButton( int mouseX, int mouseY, float partialTicks )
{
Minecraft minecraft = Minecraft.getInstance();

View File

@ -305,6 +305,7 @@ public void onFocusedChanged( boolean focused )
}
}
@Override
public void render( int mouseX, int mouseY, float partialTicks )
{
// Draw the screen contents

View File

@ -63,7 +63,7 @@ public final class Generator<T>
{
this.base = base;
this.context = context;
this.interfaces = new String[] { Type.getInternalName( base ) };
interfaces = new String[] { Type.getInternalName( base ) };
this.wrap = wrap;
StringBuilder methodDesc = new StringBuilder().append( "(Ljava/lang/Object;" );

View File

@ -64,7 +64,7 @@ public CobaltLuaMachine( Computer computer, TimeoutState timeout )
{
this.computer = computer;
this.timeout = timeout;
this.context = new LuaContext( computer );
context = new LuaContext( computer );
debug = new TimeoutDebugHandler();
// Create an environment to run in

View File

@ -44,9 +44,9 @@ public Terminal( int width, int height, Runnable changedCallback )
this.height = height;
onChanged = changedCallback;
text = new TextBuffer[this.height];
textColour = new TextBuffer[this.height];
backgroundColour = new TextBuffer[this.height];
text = new TextBuffer[height];
textColour = new TextBuffer[height];
backgroundColour = new TextBuffer[height];
for( int i = 0; i < this.height; i++ )
{
text[i] = new TextBuffer( ' ', this.width );
@ -93,9 +93,9 @@ public synchronized void resize( int width, int height )
this.width = width;
this.height = height;
text = new TextBuffer[this.height];
textColour = new TextBuffer[this.height];
backgroundColour = new TextBuffer[this.height];
text = new TextBuffer[height];
textColour = new TextBuffer[height];
backgroundColour = new TextBuffer[height];
for( int i = 0; i < this.height; i++ )
{
if( i >= oldHeight )

View File

@ -12,7 +12,7 @@ public class TextBuffer
public TextBuffer( char c, int length )
{
text = new char[length];
this.fill( c );
fill( c );
}
public TextBuffer( String text )
@ -79,6 +79,7 @@ public void setChar( int i, char c )
}
}
@Override
public String toString()
{
return new String( text );

View File

@ -33,9 +33,9 @@ private static class Wrapper
Wrapper( ITurtleUpgrade upgrade )
{
this.upgrade = upgrade;
this.id = upgrade.getUpgradeID().toString();
this.modId = ModLoadingContext.get().getActiveNamespace();
this.enabled = true;
id = upgrade.getUpgradeID().toString();
modId = ModLoadingContext.get().getActiveNamespace();
enabled = true;
}
}

View File

@ -61,7 +61,7 @@ public static class Factory implements INamedContainerProvider
public Factory( ContainerType<ContainerHeldItem> type, ItemStack stack, Hand hand )
{
this.type = type;
this.name = stack.getHoverName();
name = stack.getHoverName();
this.hand = hand;
}

View File

@ -25,14 +25,14 @@ public class ContainerViewComputer extends ContainerComputerBase implements ICon
public ContainerViewComputer( int id, ServerComputer computer )
{
super( Registry.ModContainers.VIEW_COMPUTER.get(), id, player -> canInteractWith( computer, player ), computer, computer.getFamily() );
this.width = this.height = 0;
width = height = 0;
}
public ContainerViewComputer( int id, PlayerInventory player, ViewComputerContainerData data )
{
super( Registry.ModContainers.VIEW_COMPUTER.get(), id, player, data );
this.width = data.getWidth();
this.height = data.getHeight();
width = data.getWidth();
height = data.getHeight();
}
private static boolean canInteractWith( @Nonnull ServerComputer computer, @Nonnull PlayerEntity player )

View File

@ -99,6 +99,7 @@ public String describeUndo()
return String.format( "Removing turtle upgrade %s.", id );
}
@Override
public boolean validate( ILogger logger )
{
TrackingLogger trackLog = new TrackingLogger( logger );

View File

@ -41,7 +41,7 @@ public String describe()
@Override
public void undo()
{
if( this.upgrade != null ) TurtleUpgrades.enable( upgrade );
if( upgrade != null ) TurtleUpgrades.enable( upgrade );
}
@Override

View File

@ -40,7 +40,7 @@ public String describe()
@Override
public void undo()
{
if( this.upgrade != null ) TurtleUpgrades.enable( upgrade );
if( upgrade != null ) TurtleUpgrades.enable( upgrade );
}
@Override

View File

@ -339,17 +339,17 @@ private static class UpgradeInfo
UpgradeInfo( ItemStack stack, ITurtleUpgrade turtle )
{
this.stack = stack;
this.ingredient = of( stack );
this.upgrade = this.turtle = turtle;
this.pocket = null;
ingredient = of( stack );
upgrade = this.turtle = turtle;
pocket = null;
}
UpgradeInfo( ItemStack stack, IPocketUpgrade pocket )
{
this.stack = stack;
this.ingredient = of( stack );
this.turtle = null;
this.upgrade = this.pocket = pocket;
ingredient = of( stack );
turtle = null;
upgrade = this.pocket = pocket;
}
List<Shaped> getRecipes()

View File

@ -54,36 +54,36 @@ public TerminalState( boolean colour, @Nullable Terminal terminal, boolean compr
if( terminal == null )
{
this.width = this.height = 0;
this.buffer = null;
width = height = 0;
buffer = null;
}
else
{
this.width = terminal.getWidth();
this.height = terminal.getHeight();
width = terminal.getWidth();
height = terminal.getHeight();
ByteBuf buf = this.buffer = Unpooled.buffer();
ByteBuf buf = buffer = Unpooled.buffer();
terminal.write( new PacketBuffer( buf ) );
}
}
public TerminalState( PacketBuffer buf )
{
this.colour = buf.readBoolean();
this.compress = buf.readBoolean();
colour = buf.readBoolean();
compress = buf.readBoolean();
if( buf.readBoolean() )
{
this.width = buf.readVarInt();
this.height = buf.readVarInt();
width = buf.readVarInt();
height = buf.readVarInt();
int length = buf.readVarInt();
this.buffer = readCompressed( buf, length, compress );
buffer = readCompressed( buf, length, compress );
}
else
{
this.width = this.height = 0;
this.buffer = null;
width = height = 0;
buffer = null;
}
}

View File

@ -16,14 +16,14 @@ public class ComputerContainerData implements ContainerData
public ComputerContainerData( ServerComputer computer )
{
this.id = computer.getInstanceID();
this.family = computer.getFamily();
id = computer.getInstanceID();
family = computer.getFamily();
}
public ComputerContainerData( PacketBuffer buf )
{
this.id = buf.readInt();
this.family = buf.readEnum( ComputerFamily.class );
id = buf.readInt();
family = buf.readEnum( ComputerFamily.class );
}
@Override

View File

@ -24,7 +24,7 @@ final class SaturatedMethod
SaturatedMethod( Object target, NamedMethod<PeripheralMethod> method )
{
this.target = target;
this.name = method.getName();
name = method.getName();
this.method = method.getMethod();
}

View File

@ -53,7 +53,7 @@ private class CableElement extends WiredModemElement
@Override
public World getWorld()
{
return TileCable.this.getLevel();
return getLevel();
}
@Nonnull

View File

@ -46,7 +46,7 @@ public static class Factory implements INamedContainerProvider
public Factory( ServerComputer computer, ItemStack stack, ItemPocketComputer item, Hand hand )
{
this.computer = computer;
this.name = stack.getHoverName();
name = stack.getHoverName();
this.item = item;
this.hand = hand;
}

View File

@ -65,7 +65,7 @@ public TurtleTool( ResourceLocation id, Item item )
public TurtleTool( ResourceLocation id, ItemStack craftItem, ItemStack toolItem )
{
super( id, TurtleUpgradeType.TOOL, craftItem );
this.item = toolItem;
item = toolItem;
}
@Override

View File

@ -324,7 +324,7 @@ public void tick()
@Override
public void disconnect( @Nonnull ITextComponent message )
{
this.closeReason = message;
closeReason = message;
}
@Override