Fixes #743 crash with plugs, fixes #942 builder integration, closes #319 BC 6 prep

This commit is contained in:
thatsIch
2014-12-21 19:08:05 +01:00
parent cdf949a557
commit e300bf93fd
31 changed files with 261 additions and 1692 deletions
@@ -43,7 +43,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
}
@Override
public ItemStack removeItems(int how_many, ItemStack Filter, IInventoryDestination destination)
public ItemStack removeItems(int amount, ItemStack filter, IInventoryDestination destination)
{
ItemStack target = null;
@@ -51,7 +51,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
{
if ( is != null )
{
if ( is.stackSize > 0 && (Filter == null || Platform.isSameItem( Filter, is )) )
if ( is.stackSize > 0 && ( filter == null || Platform.isSameItem( filter, is )) )
{
if ( destination == null || destination.canInsert( is ) )
{
@@ -65,15 +65,15 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
if ( target != null )
{
ItemStack f = Platform.cloneItemStack( target );
f.stackSize = how_many;
return this.cs.extractItems( f, how_many );
f.stackSize = amount;
return cs.extractItems( f, amount );
}
return null;
}
@Override
public ItemStack simulateRemove(int how_many, ItemStack Filter, IInventoryDestination destination)
public ItemStack simulateRemove(int amount, ItemStack filter, IInventoryDestination destination)
{
ItemStack target = null;
@@ -81,7 +81,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
{
if ( is != null )
{
if ( is.stackSize > 0 && (Filter == null || Platform.isSameItem( Filter, is )) )
if ( is.stackSize > 0 && ( filter == null || Platform.isSameItem( filter, is )) )
{
if ( destination == null || destination.canInsert( is ) )
{
@@ -97,8 +97,8 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
int cnt = this.cs.getItemCount( target );
if ( cnt == 0 )
return null;
if ( cnt > how_many )
cnt = how_many;
if ( cnt > amount )
cnt = amount;
ItemStack c = target.copy();
c.stackSize = cnt;
return c;
@@ -138,7 +138,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
}
@Override
public ItemStack simulateSimilarRemove(int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
public ItemStack simulateSimilarRemove(int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination)
{
ItemStack target = null;
@@ -162,8 +162,8 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
int cnt = this.cs.getItemCount( target );
if ( cnt == 0 )
return null;
if ( cnt > how_many )
cnt = how_many;
if ( cnt > amount )
cnt = amount;
ItemStack c = target.copy();
c.stackSize = cnt;
return c;
@@ -173,17 +173,17 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
}
@Override
public ItemStack addItems(ItemStack A)
public ItemStack addItems(ItemStack toBeAdded )
{
return this.cs.insertItems( A );
return this.cs.insertItems( toBeAdded );
}
@Override
public ItemStack simulateAdd(ItemStack A)
public ItemStack simulateAdd(ItemStack toBeSimulated )
{
int items = this.cs.getSpaceForItem( A );
ItemStack B = Platform.cloneItemStack( A );
if ( A.stackSize <= items )
int items = this.cs.getSpaceForItem( toBeSimulated );
ItemStack B = Platform.cloneItemStack( toBeSimulated );
if ( toBeSimulated.stackSize <= items )
return null;
B.stackSize -= items;
return B;
@@ -1,25 +0,0 @@
/*
* 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.integration.modules.helpers;
public class MJBattery
{
}
@@ -1,81 +0,0 @@
/*
* 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.integration.modules.helpers;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerHandler;
import buildcraft.api.power.PowerHandler.PowerReceiver;
import buildcraft.api.power.PowerHandler.Type;
import appeng.integration.abstraction.helpers.BaseMJPerdition;
public class MJPerdition extends BaseMJPerdition
{
final protected PowerHandler bcPowerHandler;
public MJPerdition(IPowerReceptor te) {
this.bcPowerHandler = new PowerHandler( te, Type.MACHINE );
}
@Override
public void Tick()
{
this.bcPowerHandler.update();
}
@Override
public void writeToNBT(NBTTagCompound data)
{
this.bcPowerHandler.writeToNBT( data, "bcPowerHandler" );
}
@Override
public void readFromNBT(NBTTagCompound data)
{
this.bcPowerHandler.readFromNBT( data, "bcPowerHandler" );
}
@Override
public PowerReceiver getPowerReceiver()
{
return this.bcPowerHandler.getPowerReceiver();
}
@Override
public double useEnergy(double min, double max, boolean doUse)
{
return this.bcPowerHandler.useEnergy( min, max, doUse );
}
@Override
public void addEnergy(float failed)
{
this.bcPowerHandler.addEnergy( failed );
}
@Override
public void configure(int i, int j, float f, int k)
{
this.bcPowerHandler.configure( i, j, f, k );
}
}