Use correct return type as variable
Added copyright Reformat code Rearrange code
This commit is contained in:
@@ -1,5 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Applied Energistics 2.
|
||||||
|
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
|
*/
|
||||||
|
|
||||||
package appeng.items.storage;
|
package appeng.items.storage;
|
||||||
|
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -10,6 +29,7 @@ import net.minecraft.inventory.IInventory;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
import appeng.api.config.IncludeExclude;
|
import appeng.api.config.IncludeExclude;
|
||||||
@@ -17,7 +37,7 @@ import appeng.api.implementations.items.IItemGroup;
|
|||||||
import appeng.api.implementations.items.IStorageCell;
|
import appeng.api.implementations.items.IStorageCell;
|
||||||
import appeng.api.storage.ICellInventory;
|
import appeng.api.storage.ICellInventory;
|
||||||
import appeng.api.storage.ICellInventoryHandler;
|
import appeng.api.storage.ICellInventoryHandler;
|
||||||
import appeng.api.storage.IMEInventory;
|
import appeng.api.storage.IMEInventoryHandler;
|
||||||
import appeng.api.storage.StorageChannel;
|
import appeng.api.storage.StorageChannel;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
@@ -31,15 +51,16 @@ import appeng.items.materials.MaterialType;
|
|||||||
import appeng.util.InventoryAdaptor;
|
import appeng.util.InventoryAdaptor;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, IItemGroup
|
public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, IItemGroup
|
||||||
{
|
{
|
||||||
|
|
||||||
final MaterialType component;
|
final MaterialType component;
|
||||||
final int totalBytes;
|
final int totalBytes;
|
||||||
final int perType;
|
final int perType;
|
||||||
final double idleDrain;
|
final double idleDrain;
|
||||||
|
|
||||||
public ItemBasicStorageCell(MaterialType whichCell, int Kilobytes) {
|
public ItemBasicStorageCell( MaterialType whichCell, int Kilobytes )
|
||||||
|
{
|
||||||
super( ItemBasicStorageCell.class, Kilobytes + "k" );
|
super( ItemBasicStorageCell.class, Kilobytes + "k" );
|
||||||
|
|
||||||
this.setFeature( EnumSet.of( AEFeature.StorageCells ) );
|
this.setFeature( EnumSet.of( AEFeature.StorageCells ) );
|
||||||
@@ -74,7 +95,7 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
|
|||||||
@Override
|
@Override
|
||||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
||||||
{
|
{
|
||||||
IMEInventory<IAEItemStack> inventory = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
IMEInventoryHandler inventory = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||||
|
|
||||||
if ( inventory instanceof ICellInventoryHandler )
|
if ( inventory instanceof ICellInventoryHandler )
|
||||||
{
|
{
|
||||||
@@ -107,7 +128,8 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBytes(ItemStack cellItem) {
|
public int getBytes( ItemStack cellItem )
|
||||||
|
{
|
||||||
return this.totalBytes;
|
return this.totalBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +221,7 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
InventoryPlayer playerInventory = player.inventory;
|
InventoryPlayer playerInventory = player.inventory;
|
||||||
IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
IMEInventoryHandler inv = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||||
if ( inv != null && playerInventory.getCurrentItem() == stack )
|
if ( inv != null && playerInventory.getCurrentItem() == stack )
|
||||||
{
|
{
|
||||||
InventoryAdaptor ia = InventoryAdaptor.getAdaptor( player, ForgeDirection.UNKNOWN );
|
InventoryAdaptor ia = InventoryAdaptor.getAdaptor( player, ForgeDirection.UNKNOWN );
|
||||||
@@ -250,5 +272,4 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
|
|||||||
{
|
{
|
||||||
return AEApi.instance().materials().materialEmptyStorageCell.stack( 1 );
|
return AEApi.instance().materials().materialEmptyStorageCell.stack( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user