pick 97420a31d The big reformat of 2020
This commit is contained in:
@@ -18,27 +18,22 @@
|
||||
|
||||
package appeng.items.contents;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
|
||||
public class CellConfig extends AppEngInternalInventory {
|
||||
|
||||
public class CellConfig extends AppEngInternalInventory
|
||||
{
|
||||
private final ItemStack is;
|
||||
|
||||
private final ItemStack is;
|
||||
public CellConfig(final ItemStack is) {
|
||||
super(null, 63);
|
||||
this.is = is;
|
||||
this.readFromNBT(is.getOrCreateTag(), "list");
|
||||
}
|
||||
|
||||
public CellConfig( final ItemStack is )
|
||||
{
|
||||
super( null, 63 );
|
||||
this.is = is;
|
||||
this.readFromNBT(is.getOrCreateTag(), "list" );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onContentsChanged( int slot )
|
||||
{
|
||||
this.writeToNBT(this.is.getOrCreateTag(), "list" );
|
||||
}
|
||||
@Override
|
||||
protected void onContentsChanged(int slot) {
|
||||
this.writeToNBT(this.is.getOrCreateTag(), "list");
|
||||
}
|
||||
}
|
||||
@@ -18,26 +18,21 @@
|
||||
|
||||
package appeng.items.contents;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.parts.automation.StackUpgradeInventory;
|
||||
|
||||
public final class CellUpgrades extends StackUpgradeInventory {
|
||||
private final ItemStack is;
|
||||
|
||||
public final class CellUpgrades extends StackUpgradeInventory
|
||||
{
|
||||
private final ItemStack is;
|
||||
public CellUpgrades(final ItemStack is, final int upgrades) {
|
||||
super(is, null, upgrades);
|
||||
this.is = is;
|
||||
this.readFromNBT(is.getOrCreateTag(), "upgrades");
|
||||
}
|
||||
|
||||
public CellUpgrades( final ItemStack is, final int upgrades )
|
||||
{
|
||||
super( is, null, upgrades );
|
||||
this.is = is;
|
||||
this.readFromNBT(is.getOrCreateTag(), "upgrades" );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onContentsChanged( int slot )
|
||||
{
|
||||
this.writeToNBT(this.is.getOrCreateTag(), "upgrades" );
|
||||
}
|
||||
@Override
|
||||
protected void onContentsChanged(int slot) {
|
||||
this.writeToNBT(this.is.getOrCreateTag(), "upgrades");
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
package appeng.items.contents;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
@@ -30,72 +29,62 @@ import appeng.util.inv.IAEAppEngInventory;
|
||||
import appeng.util.inv.InvOperation;
|
||||
import appeng.util.inv.filter.IAEItemFilter;
|
||||
|
||||
public class NetworkToolViewer implements INetworkTool, IAEAppEngInventory {
|
||||
|
||||
public class NetworkToolViewer implements INetworkTool, IAEAppEngInventory
|
||||
{
|
||||
private final AppEngInternalInventory inv;
|
||||
private final ItemStack is;
|
||||
private final IGridHost gh;
|
||||
|
||||
private final AppEngInternalInventory inv;
|
||||
private final ItemStack is;
|
||||
private final IGridHost gh;
|
||||
public NetworkToolViewer(final ItemStack is, final IGridHost gHost) {
|
||||
this.is = is;
|
||||
this.gh = gHost;
|
||||
this.inv = new AppEngInternalInventory(this, 9);
|
||||
this.inv.setFilter(new NetworkToolInventoryFilter());
|
||||
if (is.hasTag()) // prevent crash when opening network status screen.
|
||||
{
|
||||
this.inv.readFromNBT(is.getOrCreateTag(), "inv");
|
||||
}
|
||||
}
|
||||
|
||||
public NetworkToolViewer( final ItemStack is, final IGridHost gHost )
|
||||
{
|
||||
this.is = is;
|
||||
this.gh = gHost;
|
||||
this.inv = new AppEngInternalInventory( this, 9 );
|
||||
this.inv.setFilter( new NetworkToolInventoryFilter() );
|
||||
if( is.hasTag() ) // prevent crash when opening network status screen.
|
||||
{
|
||||
this.inv.readFromNBT(is.getOrCreateTag(), "inv" );
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void saveChanges() {
|
||||
this.inv.writeToNBT(this.is.getOrCreateTag(), "inv");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveChanges()
|
||||
{
|
||||
this.inv.writeToNBT(this.is.getOrCreateTag(), "inv" );
|
||||
}
|
||||
@Override
|
||||
public void onChangeInventory(IItemHandler inv, int slot, InvOperation mc, ItemStack removedStack,
|
||||
ItemStack newStack) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory( IItemHandler inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack )
|
||||
{
|
||||
}
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
return this.is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
return this.is;
|
||||
}
|
||||
@Override
|
||||
public IGridHost getGridHost() {
|
||||
return this.gh;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridHost getGridHost()
|
||||
{
|
||||
return this.gh;
|
||||
}
|
||||
private static class NetworkToolInventoryFilter implements IAEItemFilter {
|
||||
@Override
|
||||
public boolean allowExtract(IItemHandler inv, int slot, int amount) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static class NetworkToolInventoryFilter implements IAEItemFilter
|
||||
{
|
||||
@Override
|
||||
public boolean allowExtract( IItemHandler inv, int slot, int amount )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean allowInsert(IItemHandler inv, int slot, ItemStack stack) {
|
||||
return stack.getItem() instanceof IUpgradeModule
|
||||
&& ((IUpgradeModule) stack.getItem()).getType(stack) != null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowInsert( IItemHandler inv, int slot, ItemStack stack )
|
||||
{
|
||||
return stack.getItem() instanceof IUpgradeModule && ( (IUpgradeModule) stack.getItem() ).getType( stack ) != null;
|
||||
}
|
||||
}
|
||||
public IItemHandler getInternalInventory() {
|
||||
return this.inv;
|
||||
}
|
||||
|
||||
public IItemHandler getInternalInventory()
|
||||
{
|
||||
return this.inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getInventory()
|
||||
{
|
||||
return this.inv;
|
||||
}
|
||||
@Override
|
||||
public IItemHandler getInventory() {
|
||||
return this.inv;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
package appeng.items.contents;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
|
||||
@@ -41,71 +40,61 @@ import appeng.container.interfaces.IInventorySlotAware;
|
||||
import appeng.me.helpers.MEMonitorHandler;
|
||||
import appeng.util.ConfigManager;
|
||||
|
||||
public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implements IPortableCell, IInventorySlotAware {
|
||||
|
||||
public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implements IPortableCell, IInventorySlotAware
|
||||
{
|
||||
private final ItemStack target;
|
||||
private final IAEItemPowerStorage ips;
|
||||
private final int inventorySlot;
|
||||
|
||||
private final ItemStack target;
|
||||
private final IAEItemPowerStorage ips;
|
||||
private final int inventorySlot;
|
||||
public PortableCellViewer(final ItemStack is, final int slot) {
|
||||
super(AEApi.instance().registries().cell().getCellInventory(is, null,
|
||||
AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)));
|
||||
this.ips = (IAEItemPowerStorage) is.getItem();
|
||||
this.target = is;
|
||||
this.inventorySlot = slot;
|
||||
}
|
||||
|
||||
public PortableCellViewer( final ItemStack is, final int slot )
|
||||
{
|
||||
super( AEApi.instance().registries().cell().getCellInventory( is, null, AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) );
|
||||
this.ips = (IAEItemPowerStorage) is.getItem();
|
||||
this.target = is;
|
||||
this.inventorySlot = slot;
|
||||
}
|
||||
@Override
|
||||
public int getInventorySlot() {
|
||||
return this.inventorySlot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventorySlot()
|
||||
{
|
||||
return this.inventorySlot;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
return this.target;
|
||||
}
|
||||
@Override
|
||||
public double extractAEPower(double amt, final Actionable mode, final PowerMultiplier usePowerMultiplier) {
|
||||
amt = usePowerMultiplier.multiply(amt);
|
||||
|
||||
@Override
|
||||
public double extractAEPower( double amt, final Actionable mode, final PowerMultiplier usePowerMultiplier )
|
||||
{
|
||||
amt = usePowerMultiplier.multiply( amt );
|
||||
if (mode == Actionable.SIMULATE) {
|
||||
return usePowerMultiplier.divide(Math.min(amt, this.ips.getAECurrentPower(this.target)));
|
||||
}
|
||||
|
||||
if( mode == Actionable.SIMULATE )
|
||||
{
|
||||
return usePowerMultiplier.divide( Math.min( amt, this.ips.getAECurrentPower( this.target ) ) );
|
||||
}
|
||||
return usePowerMultiplier.divide(this.ips.extractAEPower(this.target, amt, Actionable.MODULATE));
|
||||
}
|
||||
|
||||
return usePowerMultiplier.divide( this.ips.extractAEPower( this.target, amt, Actionable.MODULATE ) );
|
||||
}
|
||||
@Override
|
||||
public <T extends IAEStack<T>> IMEMonitor<T> getInventory(IStorageChannel<T> channel) {
|
||||
if (channel == AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)) {
|
||||
return (IMEMonitor<T>) this;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
|
||||
{
|
||||
if( channel == AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) )
|
||||
{
|
||||
return (IMEMonitor<T>) this;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager()
|
||||
{
|
||||
final ConfigManager out = new ConfigManager( ( manager, settingName, newValue ) ->
|
||||
{
|
||||
@Override
|
||||
public IConfigManager getConfigManager() {
|
||||
final ConfigManager out = new ConfigManager((manager, settingName, newValue) -> {
|
||||
final CompoundNBT data = this.target.getOrCreateTag();
|
||||
manager.writeToNBT( data );
|
||||
} );
|
||||
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.registerSetting(Settings.SORT_BY, SortOrder.NAME);
|
||||
out.registerSetting(Settings.VIEW_MODE, ViewItems.ALL);
|
||||
out.registerSetting(Settings.SORT_DIRECTION, SortDir.ASCENDING);
|
||||
|
||||
out.readFromNBT( this.target.getOrCreateTag().copy() );
|
||||
return out;
|
||||
}
|
||||
out.readFromNBT(this.target.getOrCreateTag().copy());
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,25 +18,20 @@
|
||||
|
||||
package appeng.items.contents;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
|
||||
public class QuartzKnifeObj implements IGuiItemObject {
|
||||
|
||||
public class QuartzKnifeObj implements IGuiItemObject
|
||||
{
|
||||
private final ItemStack is;
|
||||
|
||||
private final ItemStack is;
|
||||
public QuartzKnifeObj(final ItemStack o) {
|
||||
this.is = o;
|
||||
}
|
||||
|
||||
public QuartzKnifeObj( final ItemStack o )
|
||||
{
|
||||
this.is = o;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
return this.is;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
return this.is;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user