Ported to 1.7
This commit is contained in:
@@ -72,7 +72,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
{
|
||||
IInventory inv = getCellUpgradeInventory();
|
||||
ItemStack is = inv.decrStackSize( i, j );
|
||||
inv.onInventoryChanged();
|
||||
inv.markDirty();
|
||||
return is;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
{
|
||||
IInventory inv = getCellUpgradeInventory();
|
||||
ItemStack is = inv.getStackInSlotOnClosing( i );
|
||||
inv.onInventoryChanged();
|
||||
inv.markDirty();
|
||||
return is;
|
||||
}
|
||||
|
||||
@@ -90,17 +90,17 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
{
|
||||
IInventory inv = getCellUpgradeInventory();
|
||||
inv.setInventorySlotContents( i, itemstack );
|
||||
inv.onInventoryChanged();
|
||||
inv.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInvName()
|
||||
public String getInventoryName()
|
||||
{
|
||||
return "Upgrades";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvNameLocalized()
|
||||
public boolean hasCustomInventoryName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryChanged()
|
||||
public void markDirty()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -124,12 +124,12 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChest()
|
||||
public void openInventory()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeChest()
|
||||
public void closeInventory()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
icrafting.sendSlotContents( this, sri.slotNumber, sri.getStack() );
|
||||
}
|
||||
}
|
||||
((EntityPlayerMP) icrafting).playerInventoryBeingManipulated = false;
|
||||
((EntityPlayerMP) icrafting).isChangingQuantityOnly = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ public class ContainerCondenser extends AEBaseContainer
|
||||
if ( changed )
|
||||
{
|
||||
// if the bars changed an item was probably made, so just send shit!
|
||||
((EntityPlayerMP) icrafting).playerInventoryBeingManipulated = false;
|
||||
((EntityPlayerMP) icrafting).isChangingQuantityOnly = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class ContainerIOPort extends ContainerUpgradeable
|
||||
offy = 17;
|
||||
for (int y = 0; y < 3; y++)
|
||||
for (int x = 0; x < 2; x++)
|
||||
addSlotToContainer( new SlotOutput( cells, 6 + x + y * 2, offx + x * 18, offy + y * 18, PlaceableItemType.STORAGE_CELLS.icon ) );
|
||||
addSlotToContainer( new SlotOutput( cells, 6 + x + y * 2, offx + x * 18, offy + y * 18, PlaceableItemType.STORAGE_CELLS.IIcon ) );
|
||||
|
||||
IInventory upgrades = myte.getInventoryByName( "upgrades" );
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0 )).setNotDraggable() );
|
||||
|
||||
@@ -4,11 +4,11 @@ import java.io.IOException;
|
||||
import java.nio.BufferOverflowException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.api.implementations.tiles.IMEChest;
|
||||
import appeng.api.networking.IGrid;
|
||||
@@ -24,11 +24,10 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.ItemList;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonitorHandlerReciever<IAEItemStack>
|
||||
{
|
||||
@@ -64,7 +63,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito
|
||||
}
|
||||
}
|
||||
else
|
||||
ip.player.closeScreen();
|
||||
isContainerValid = false;
|
||||
}
|
||||
else
|
||||
monitor = null;
|
||||
@@ -104,13 +103,12 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito
|
||||
|
||||
if ( !piu.isEmpty() )
|
||||
{
|
||||
Packet p = piu.getPacket();
|
||||
items.resetStatus();
|
||||
|
||||
for (Object c : this.crafters)
|
||||
{
|
||||
if ( c instanceof Player )
|
||||
PacketDispatcher.sendPacketToPlayer( p, (Player) c );
|
||||
if ( c instanceof EntityPlayer )
|
||||
NetworkHandler.instance.sendTo( piu, (EntityPlayerMP) c );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,7 +127,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito
|
||||
{
|
||||
super.addCraftingToCrafters( c );
|
||||
|
||||
if ( Platform.isServer() && c instanceof Player && monitor != null )
|
||||
if ( Platform.isServer() && c instanceof EntityPlayer && monitor != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -144,16 +142,14 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito
|
||||
}
|
||||
catch (BufferOverflowException boe)
|
||||
{
|
||||
Packet p = piu.getPacket();
|
||||
PacketDispatcher.sendPacketToPlayer( p, (Player) c );
|
||||
NetworkHandler.instance.sendTo( piu, (EntityPlayerMP) c );
|
||||
|
||||
piu = new PacketMEInventoryUpdate();
|
||||
piu.appendItem( send );
|
||||
}
|
||||
}
|
||||
|
||||
Packet p = piu.getPacket();
|
||||
PacketDispatcher.sendPacketToPlayer( p, (Player) c );
|
||||
NetworkHandler.instance.sendTo( piu, (EntityPlayerMP) c );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
||||
@@ -37,14 +37,14 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable
|
||||
if ( Platform.isSameItem( civ.getItemStack(), currentItem ) )
|
||||
getPlayerInv().setInventorySlotContents( getPlayerInv().currentItem, civ.getItemStack() );
|
||||
else
|
||||
getPlayerInv().player.closeScreen();
|
||||
isContainerValid = false;
|
||||
}
|
||||
else
|
||||
getPlayerInv().player.closeScreen();
|
||||
isContainerValid = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
getPlayerInv().player.closeScreen();
|
||||
isContainerValid = false;
|
||||
|
||||
// drain 1 ae t
|
||||
ticks++;
|
||||
|
||||
@@ -2,11 +2,12 @@ package appeng.container.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.guiobjects.INetworkTool;
|
||||
import appeng.api.networking.IGrid;
|
||||
@@ -17,11 +18,10 @@ import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ContainerNetworkStatus extends AEBaseContainer
|
||||
}
|
||||
|
||||
if ( network == null && Platform.isServer() )
|
||||
ip.player.closeScreen();
|
||||
isContainerValid = false;
|
||||
}
|
||||
|
||||
private void findNode(IGridHost host, ForgeDirection d)
|
||||
@@ -142,11 +142,10 @@ public class ContainerNetworkStatus extends AEBaseContainer
|
||||
piu.appendItem( ais );
|
||||
}
|
||||
|
||||
Packet p = piu.getPacket();
|
||||
for (Object c : this.crafters)
|
||||
{
|
||||
if ( c instanceof Player )
|
||||
PacketDispatcher.sendPacketToPlayer( p, (Player) c );
|
||||
if ( c instanceof EntityPlayer )
|
||||
NetworkHandler.instance.sendTo( piu, (EntityPlayerMP) c );
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
|
||||
@@ -38,10 +38,10 @@ public class ContainerNetworkTool extends AEBaseContainer
|
||||
if ( Platform.isSameItem( toolInv.getItemStack(), currentItem ) )
|
||||
getPlayerInv().setInventorySlotContents( getPlayerInv().currentItem, toolInv.getItemStack() );
|
||||
else
|
||||
getPlayerInv().player.closeScreen();
|
||||
isContainerValid = false;
|
||||
}
|
||||
else
|
||||
getPlayerInv().player.closeScreen();
|
||||
isContainerValid = false;
|
||||
}
|
||||
|
||||
super.detectAndSendChanges();
|
||||
|
||||
@@ -53,10 +53,10 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
|
||||
super.onContainerClosed( player );
|
||||
|
||||
if ( wirelessIn.getHasStack() )
|
||||
player.dropPlayerItem( wirelessIn.getStack() );
|
||||
player.dropPlayerItemWithRandomChoice( wirelessIn.getStack(), false );
|
||||
|
||||
if ( wirelessOut.getHasStack() )
|
||||
player.dropPlayerItem( wirelessOut.getStack() );
|
||||
player.dropPlayerItemWithRandomChoice( wirelessOut.getStack(), false );
|
||||
}
|
||||
|
||||
public void toggleSetting(String value, EntityPlayer player)
|
||||
|
||||
@@ -18,7 +18,7 @@ public class ContainerSpatialIOPort extends AEBaseContainer
|
||||
myte = te;
|
||||
|
||||
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.SPATIAL_STORAGE_CELLS, te, 0, 71, 14 ) );
|
||||
addSlotToContainer( new SlotOutput( te, 1, 71, 14, PlaceableItemType.SPATIAL_STORAGE_CELLS.icon ) );
|
||||
addSlotToContainer( new SlotOutput( te, 1, 71, 14, PlaceableItemType.SPATIAL_STORAGE_CELLS.IIcon ) );
|
||||
|
||||
bindPlayerInventory( ip, 0, 199 - /* height of playerinventory */82 );
|
||||
}
|
||||
|
||||
@@ -149,10 +149,10 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
|
||||
if ( Platform.isSameItem( tbinv.getItemStack(), currentItem ) )
|
||||
getPlayerInv().setInventorySlotContents( tbslot, tbinv.getItemStack() );
|
||||
else
|
||||
getPlayerInv().player.closeScreen();
|
||||
isContainerValid = false;
|
||||
}
|
||||
else
|
||||
getPlayerInv().player.closeScreen();
|
||||
isContainerValid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ public class ContainerWirelessTerm extends ContainerMEPortableCell
|
||||
|
||||
if ( !wtgo.rangeCheck() )
|
||||
{
|
||||
getPlayerInv().player.closeScreen();
|
||||
getPlayerInv().player.sendChatToPlayer( PlayerMessages.OutOfRange.get() );
|
||||
isContainerValid = false;
|
||||
getPlayerInv().player.addChatMessage( PlayerMessages.OutOfRange.get() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user