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 ) public TransformedModel( @Nonnull IBakedModel model )
{ {
this.model = Objects.requireNonNull( model ); this.model = Objects.requireNonNull( model );
this.matrix = TransformationMatrix.identity(); matrix = TransformationMatrix.identity();
} }
public static TransformedModel of( @Nonnull ModelResourceLocation location ) 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 ) public FileOperationException( @Nonnull String message )
{ {
super( Objects.requireNonNull( message, "message cannot be null" ) ); super( Objects.requireNonNull( message, "message cannot be null" ) );
this.filename = null; filename = null;
} }
@Nullable @Nullable

View File

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

View File

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

View File

@ -62,6 +62,7 @@ public DynamicImageButton(
this.tooltip = tooltip; this.tooltip = tooltip;
} }
@Override
public void renderButton( int mouseX, int mouseY, float partialTicks ) public void renderButton( int mouseX, int mouseY, float partialTicks )
{ {
Minecraft minecraft = Minecraft.getInstance(); 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 ) public void render( int mouseX, int mouseY, float partialTicks )
{ {
// Draw the screen contents // Draw the screen contents

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,14 +25,14 @@ public class ContainerViewComputer extends ContainerComputerBase implements ICon
public ContainerViewComputer( int id, ServerComputer computer ) public ContainerViewComputer( int id, ServerComputer computer )
{ {
super( Registry.ModContainers.VIEW_COMPUTER.get(), id, player -> canInteractWith( computer, player ), computer, computer.getFamily() ); 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 ) public ContainerViewComputer( int id, PlayerInventory player, ViewComputerContainerData data )
{ {
super( Registry.ModContainers.VIEW_COMPUTER.get(), id, player, data ); super( Registry.ModContainers.VIEW_COMPUTER.get(), id, player, data );
this.width = data.getWidth(); width = data.getWidth();
this.height = data.getHeight(); height = data.getHeight();
} }
private static boolean canInteractWith( @Nonnull ServerComputer computer, @Nonnull PlayerEntity player ) 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 ); return String.format( "Removing turtle upgrade %s.", id );
} }
@Override
public boolean validate( ILogger logger ) public boolean validate( ILogger logger )
{ {
TrackingLogger trackLog = new TrackingLogger( logger ); TrackingLogger trackLog = new TrackingLogger( logger );

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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