Code cleanup

Added missing this, annotations, etc.
This commit is contained in:
yueh
2018-08-30 20:33:08 +02:00
parent fed12cb99f
commit a2091d10fe
77 changed files with 227 additions and 270 deletions
@@ -40,7 +40,6 @@ import appeng.api.util.IConfigManager;
import appeng.container.interfaces.IInventorySlotAware;
import appeng.me.helpers.MEMonitorHandler;
import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
@@ -97,22 +96,17 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
@Override
public IConfigManager getConfigManager()
{
final ConfigManager out = new ConfigManager( new IConfigManagerHost()
final ConfigManager out = new ConfigManager( ( manager, settingName, newValue ) ->
{
@Override
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{
final NBTTagCompound data = Platform.openNbtData( PortableCellViewer.this.target );
manager.writeToNBT( data );
}
final NBTTagCompound data = Platform.openNbtData( PortableCellViewer.this.target );
manager.writeToNBT( data );
} );
out.registerSetting( Settings.SORT_BY, SortOrder.NAME );
out.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
out.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
out.readFromNBT( (NBTTagCompound) Platform.openNbtData( this.target ).copy() );
out.readFromNBT( Platform.openNbtData( this.target ).copy() );
return out;
}
}
@@ -228,15 +228,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
{
final List<MaterialType> types = Arrays.asList( MaterialType.values() );
Collections.sort( types, new Comparator<MaterialType>()
{
@Override
public int compare( final MaterialType o1, final MaterialType o2 )
{
return o1.name().compareTo( o2.name() );
}
} );
Collections.sort( types, ( o1, o2 ) -> o1.name().compareTo( o2.name() ) );
for( final MaterialType mat : types )
{
@@ -174,11 +174,11 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
}
final InventoryPlayer playerInventory = player.inventory;
final IMEInventoryHandler inv = AEApi.instance().registries().cell().getCellInventory( stack, null, getChannel() );
final IMEInventoryHandler inv = AEApi.instance().registries().cell().getCellInventory( stack, null, this.getChannel() );
if( inv != null && playerInventory.getCurrentItem() == stack )
{
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor( player );
final IItemList<IAEItemStack> list = inv.getAvailableItems( getChannel().createList() );
final IItemList<IAEItemStack> list = inv.getAvailableItems( this.getChannel().createList() );
if( list.isEmpty() && ia != null )
{
playerInventory.setInventorySlotContents( playerInventory.currentItem, ItemStack.EMPTY );
@@ -203,7 +203,7 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
}
// drop empty storage cell case
dropEmptyStorageCellCase( ia, player );
this.dropEmptyStorageCellCase( ia, player );
if( player.inventoryContainer != null )
{
@@ -20,7 +20,6 @@ package appeng.items.tools.powered;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -293,15 +292,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
list.add( i );
}
Collections.sort( list, new Comparator<IAEItemStack>()
{
@Override
public int compare( final IAEItemStack a, final IAEItemStack b )
{
return Integer.compare( a.getItemDamage(), b.getItemDamage() );
}
} );
Collections.sort( list, ( a, b ) -> Integer.compare( a.getItemDamage(), b.getItemDamage() ) );
if( list.size() <= 0 )
{
@@ -138,7 +138,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
}
aeAmmo.setStackSize( 1 );
final ItemStack ammo = ( (IAEItemStack) aeAmmo ).createItemStack();
final ItemStack ammo = aeAmmo.createItemStack();
if( ammo == null )
{
return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
@@ -45,7 +45,6 @@ import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
@@ -121,22 +120,17 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
@Override
public IConfigManager getConfigManager( final ItemStack target )
{
final ConfigManager out = new ConfigManager( new IConfigManagerHost()
final ConfigManager out = new ConfigManager( ( manager, settingName, newValue ) ->
{
@Override
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{
final NBTTagCompound data = Platform.openNbtData( target );
manager.writeToNBT( data );
}
final NBTTagCompound data = Platform.openNbtData( target );
manager.writeToNBT( data );
} );
out.registerSetting( Settings.SORT_BY, SortOrder.NAME );
out.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
out.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
out.readFromNBT( (NBTTagCompound) Platform.openNbtData( target ).copy() );
out.readFromNBT( Platform.openNbtData( target ).copy() );
return out;
}