Most of the 1.8 Port.
This commit is contained in:
@@ -19,23 +19,23 @@
|
||||
package appeng.tile.storage;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.server.gui.IUpdatePlayerListBox;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
@@ -92,7 +92,7 @@ import appeng.util.Platform;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
|
||||
|
||||
public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHandler, ITerminalHost, IPriorityHost, IConfigManagerHost, IColorableTile
|
||||
public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHandler, ITerminalHost, IPriorityHost, IConfigManagerHost, IColorableTile, IUpdatePlayerListBox
|
||||
{
|
||||
|
||||
static final ChestNoHandler NO_HANDLER = new ChestNoHandler();
|
||||
@@ -545,14 +545,14 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
||||
// update the neighbors
|
||||
if( this.worldObj != null )
|
||||
{
|
||||
Platform.notifyBlocksOfNeighbors( this.worldObj, this.xCoord, this.yCoord, this.zCoord );
|
||||
Platform.notifyBlocksOfNeighbors( this.worldObj, pos );
|
||||
this.markForUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, int side )
|
||||
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, EnumFacing side )
|
||||
{
|
||||
if( slotIndex == 1 )
|
||||
{
|
||||
@@ -581,15 +581,15 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, EnumFacing side )
|
||||
{
|
||||
return slotIndex == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide( ForgeDirection side )
|
||||
public int[] getAccessibleSlotsBySide( EnumFacing side )
|
||||
{
|
||||
if( ForgeDirection.SOUTH == side )
|
||||
if( EnumFacing.SOUTH == side )
|
||||
{
|
||||
return FRONT;
|
||||
}
|
||||
@@ -694,7 +694,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill( ForgeDirection from, FluidStack resource, boolean doFill )
|
||||
public int fill( EnumFacing from, FluidStack resource, boolean doFill )
|
||||
{
|
||||
double req = resource.amount / 500.0;
|
||||
double available = this.extractAEPower( req, Actionable.SIMULATE, PowerMultiplier.CONFIG );
|
||||
@@ -722,19 +722,19 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain( ForgeDirection from, FluidStack resource, boolean doDrain )
|
||||
public FluidStack drain( EnumFacing from, FluidStack resource, boolean doDrain )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain( ForgeDirection from, int maxDrain, boolean doDrain )
|
||||
public FluidStack drain( EnumFacing from, int maxDrain, boolean doDrain )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill( ForgeDirection from, Fluid fluid )
|
||||
public boolean canFill( EnumFacing from, Fluid fluid )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -748,13 +748,13 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain( ForgeDirection from, Fluid fluid )
|
||||
public boolean canDrain( EnumFacing from, Fluid fluid )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo( ForgeDirection from )
|
||||
public FluidTankInfo[] getTankInfo( EnumFacing from )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -772,7 +772,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStorageMonitorable getMonitorable( ForgeDirection side, BaseActionSource src )
|
||||
public IStorageMonitorable getMonitorable( EnumFacing side, BaseActionSource src )
|
||||
{
|
||||
if( Platform.canAccess( this.gridProxy, src ) && side != this.getForward() )
|
||||
{
|
||||
@@ -802,7 +802,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
||||
|
||||
}
|
||||
|
||||
public boolean openGui( EntityPlayer p, ICellHandler ch, ItemStack cell, int side )
|
||||
public boolean openGui( EntityPlayer p, ICellHandler ch, ItemStack cell, EnumFacing side )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -842,7 +842,10 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recolourBlock( ForgeDirection side, AEColor newPaintedColor, EntityPlayer who )
|
||||
public boolean recolourBlock(
|
||||
EnumFacing side,
|
||||
AEColor newPaintedColor,
|
||||
EntityPlayer who )
|
||||
{
|
||||
if( this.paintedColor == newPaintedColor )
|
||||
{
|
||||
@@ -858,7 +861,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
||||
@Override
|
||||
public void saveChanges( IMEInventory cellInventory )
|
||||
{
|
||||
this.worldObj.markTileEntityChunkModified( this.xCoord, this.yCoord, this.zCoord, this );
|
||||
this.worldObj.markChunkDirty( pos, this );
|
||||
}
|
||||
|
||||
private static class ChestNoHandler extends Exception
|
||||
|
||||
@@ -19,17 +19,16 @@
|
||||
package appeng.tile.storage;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.tiles.IChestOrDrive;
|
||||
import appeng.api.networking.GridFlags;
|
||||
@@ -46,6 +45,7 @@ import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
import appeng.me.GridAccessException;
|
||||
@@ -248,7 +248,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.SMART;
|
||||
}
|
||||
@@ -295,7 +295,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide( ForgeDirection side )
|
||||
public int[] getAccessibleSlotsBySide( EnumFacing side )
|
||||
{
|
||||
return this.sides;
|
||||
}
|
||||
@@ -417,6 +417,6 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
@Override
|
||||
public void saveChanges( IMEInventory cellInventory )
|
||||
{
|
||||
this.worldObj.markTileEntityChunkModified( this.xCoord, this.yCoord, this.zCoord, this );
|
||||
this.worldObj.markChunkDirty( pos, this );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.FullnessMode;
|
||||
@@ -53,6 +53,7 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.core.settings.TickRates;
|
||||
@@ -141,7 +142,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.SMART;
|
||||
}
|
||||
@@ -173,7 +174,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
|
||||
public void updateRedstoneState()
|
||||
{
|
||||
YesNo currentState = this.worldObj.isBlockIndirectlyGettingPowered( this.xCoord, this.yCoord, this.zCoord ) ? YesNo.YES : YesNo.NO;
|
||||
YesNo currentState = this.worldObj.isBlockIndirectlyGettingPowered( pos ) != 0 ? YesNo.YES : YesNo.NO;
|
||||
if( this.lastRedstoneState != currentState )
|
||||
{
|
||||
this.lastRedstoneState = currentState;
|
||||
@@ -266,7 +267,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, int side )
|
||||
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, EnumFacing side )
|
||||
{
|
||||
for( int inputSlotIndex : this.input )
|
||||
{
|
||||
@@ -280,7 +281,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, EnumFacing side )
|
||||
{
|
||||
for( int outputSlotIndex : this.output )
|
||||
{
|
||||
@@ -294,9 +295,9 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide( ForgeDirection d )
|
||||
public int[] getAccessibleSlotsBySide( EnumFacing d )
|
||||
{
|
||||
if( d == ForgeDirection.UP || d == ForgeDirection.DOWN )
|
||||
if( d == EnumFacing.UP || d == EnumFacing.DOWN )
|
||||
{
|
||||
return this.input;
|
||||
}
|
||||
@@ -509,7 +510,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
private boolean moveSlot( int x )
|
||||
{
|
||||
WrapperInventoryRange wir = new WrapperInventoryRange( this, this.output, true );
|
||||
ItemStack result = InventoryAdaptor.getAdaptor( wir, ForgeDirection.UNKNOWN ).addItems( this.getStackInSlot( x ) );
|
||||
ItemStack result = InventoryAdaptor.getAdaptor( wir, EnumFacing.UP ).addItems( this.getStackInSlot( x ) );
|
||||
|
||||
if( result == null )
|
||||
{
|
||||
@@ -562,9 +563,12 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
* @param drops drops of tile entity
|
||||
*/
|
||||
@Override
|
||||
public void getDrops( World w, int x, int y, int z, List<ItemStack> drops )
|
||||
public void getDrops(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
List<ItemStack> drops )
|
||||
{
|
||||
super.getDrops( w, x, y, z, drops );
|
||||
super.getDrops( w, pos, drops );
|
||||
|
||||
for( int upgradeIndex = 0; upgradeIndex < this.upgrades.getSizeInventory(); upgradeIndex++ )
|
||||
{
|
||||
|
||||
@@ -20,11 +20,10 @@ package appeng.tile.storage;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import appeng.tile.AEBaseInvTile;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
@@ -77,7 +76,7 @@ public class TileSkyChest extends AEBaseInvTile
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory()
|
||||
public void openInventory( EntityPlayer player )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
@@ -88,13 +87,13 @@ public class TileSkyChest extends AEBaseInvTile
|
||||
|
||||
if( this.playerOpen == 1 )
|
||||
{
|
||||
this.getWorldObj().playSoundEffect( this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, "random.chestopen", 0.5F, this.getWorldObj().rand.nextFloat() * 0.1F + 0.9F );
|
||||
this.getWorld().playSoundEffect( pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, "random.chestopen", 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F );
|
||||
this.markForUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory()
|
||||
public void closeInventory( EntityPlayer player )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
@@ -110,7 +109,7 @@ public class TileSkyChest extends AEBaseInvTile
|
||||
|
||||
if( this.playerOpen == 0 )
|
||||
{
|
||||
this.getWorldObj().playSoundEffect( this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, "random.chestclosed", 0.5F, this.getWorldObj().rand.nextFloat() * 0.1F + 0.9F );
|
||||
this.getWorld().playSoundEffect( pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, "random.chestclosed", 0.5F, this.getWorld().rand.nextFloat() * 0.1F + 0.9F );
|
||||
this.markForUpdate();
|
||||
}
|
||||
}
|
||||
@@ -122,7 +121,7 @@ public class TileSkyChest extends AEBaseInvTile
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide( ForgeDirection side )
|
||||
public int[] getAccessibleSlotsBySide( EnumFacing side )
|
||||
{
|
||||
return this.sides;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user