Merge pull request #372 from yueh/fix-366

Prevent anything but boosters inside WAPs
This commit is contained in:
thatsIch 2014-11-02 12:18:36 +01:00
commit fc973d965e

View file

@ -1,12 +1,16 @@
package appeng.tile.networking; package appeng.tile.networking;
import io.netty.buffer.ByteBuf;
import java.util.EnumSet; import java.util.EnumSet;
import io.netty.buffer.ByteBuf;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.AEApi;
import appeng.api.implementations.IPowerChannelState; import appeng.api.implementations.IPowerChannelState;
import appeng.api.implementations.tiles.IWirelessAccessPoint; import appeng.api.implementations.tiles.IWirelessAccessPoint;
import appeng.api.networking.GridFlags; import appeng.api.networking.GridFlags;
@ -25,6 +29,7 @@ import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.InvOperation; import appeng.tile.inventory.InvOperation;
import appeng.util.Platform; import appeng.util.Platform;
public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoint, IPowerChannelState public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoint, IPowerChannelState
{ {
@ -36,7 +41,8 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
public int clientFlags = 0; public int clientFlags = 0;
public TileWireless() { public TileWireless()
{
gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL ); gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) ); gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
} }
@ -166,6 +172,12 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
return boosters == null ? 0 : boosters.stackSize; return boosters == null ? 0 : boosters.stackSize;
} }
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
{
return AEApi.instance().materials().materialWirelessBooster.sameAsStack( itemstack );
}
@Override @Override
public void onChangeInventory( IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added ) public void onChangeInventory( IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added )
{ {