2013-12-27 23:59:59 +01:00
|
|
|
package appeng.util;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
2014-02-15 04:16:44 +01:00
|
|
|
import net.minecraft.block.BlockAir;
|
2013-12-27 23:59:59 +01:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
|
|
|
public class InWorldToolOperationResult
|
|
|
|
{
|
|
|
|
|
|
|
|
public ItemStack BlockItem;
|
|
|
|
public List<ItemStack> Drops;
|
|
|
|
|
|
|
|
public static InWorldToolOperationResult getBlockOperationResult(ItemStack[] items)
|
|
|
|
{
|
|
|
|
List<ItemStack> temp = new ArrayList<ItemStack>();
|
|
|
|
ItemStack b = null;
|
|
|
|
|
|
|
|
for (ItemStack l : items)
|
|
|
|
{
|
|
|
|
if ( b == null )
|
|
|
|
{
|
2014-02-09 02:34:52 +01:00
|
|
|
Block bl = Block.getBlockFromItem( l.getItem() );
|
2013-12-27 23:59:59 +01:00
|
|
|
|
2014-02-15 04:16:44 +01:00
|
|
|
if ( bl != null && !(bl instanceof BlockAir) )
|
2014-02-09 02:34:52 +01:00
|
|
|
{
|
|
|
|
b = l;
|
|
|
|
continue;
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
temp.add( l );
|
|
|
|
}
|
|
|
|
|
|
|
|
return new InWorldToolOperationResult( b, temp );
|
|
|
|
}
|
|
|
|
|
|
|
|
public InWorldToolOperationResult() {
|
|
|
|
BlockItem = null;
|
|
|
|
Drops = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public InWorldToolOperationResult(ItemStack block, List<ItemStack> drops) {
|
|
|
|
BlockItem = block;
|
|
|
|
Drops = drops;
|
|
|
|
}
|
|
|
|
|
|
|
|
public InWorldToolOperationResult(ItemStack block) {
|
|
|
|
BlockItem = block;
|
|
|
|
Drops = null;
|
|
|
|
}
|
|
|
|
}
|