Fixes #376 IO Port now dropping upgrades properly.

This commit is contained in:
thatsIch 2014-11-02 23:55:01 +01:00
parent c19ed27f0e
commit 19fb264b3b

View file

@ -1,8 +1,27 @@
/*
* 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.tile.storage;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
@ -45,6 +64,8 @@ import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.inv.WrapperInventoryRange;
import java.util.ArrayList;
public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IConfigManagerHost, IGridTickable
{
@ -419,4 +440,28 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
return false;
}
/**
* Adds the items in the upgrade slots to the drop list.
*
* @param w world
* @param x x pos of tile entity
* @param y y pos of tile entity
* @param z z pos of tile entity
* @param drops drops of tile entity
*/
@Override
public void getDrops( World w, int x, int y, int z, ArrayList<ItemStack> drops )
{
super.getDrops( w, x, y, z, drops );
for (int upgradeInventoryIndex = 0; upgradeInventoryIndex < this.upgrades.getSizeInventory(); upgradeInventoryIndex++)
{
ItemStack stackInSlot = this.upgrades.getStackInSlot(upgradeInventoryIndex);
if ( stackInSlot != null )
{
drops.add( stackInSlot );
}
}
}
}