Most of the 1.8 Port.
This commit is contained in:
@@ -27,8 +27,10 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.inventory.IAEAppEngInventory;
|
||||
@@ -104,7 +106,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
|
||||
* Returns the name of the inventory
|
||||
*/
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
public String getName()
|
||||
{
|
||||
return this.getCustomName();
|
||||
}
|
||||
@@ -113,9 +115,9 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
|
||||
* Returns if the inventory is named
|
||||
*/
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return this.hasCustomName();
|
||||
return getInternalInventory().hasCustomName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,17 +131,19 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
|
||||
{
|
||||
final double squaredMCReach = 64.0D;
|
||||
|
||||
return this.worldObj.getTileEntity( this.xCoord, this.yCoord, this.zCoord ) == this && p.getDistanceSq( this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D ) <= squaredMCReach;
|
||||
return this.worldObj.getTileEntity( pos ) == this && p.getDistanceSq( pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D ) <= squaredMCReach;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory()
|
||||
{
|
||||
}
|
||||
|
||||
public void openInventory(EntityPlayer player) {
|
||||
|
||||
};
|
||||
|
||||
@Override
|
||||
public void closeInventory()
|
||||
public void closeInventory(
|
||||
EntityPlayer player )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,28 +156,63 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
|
||||
public abstract void onChangeInventory( IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added );
|
||||
|
||||
@Override
|
||||
public final int[] getAccessibleSlotsFromSide( int side )
|
||||
public int[] getSlotsForFace(
|
||||
EnumFacing side )
|
||||
{
|
||||
Block blk = this.worldObj.getBlock( this.xCoord, this.yCoord, this.zCoord );
|
||||
Block blk = this.worldObj.getBlockState( pos ).getBlock();
|
||||
if( blk instanceof AEBaseBlock )
|
||||
{
|
||||
ForgeDirection mySide = ForgeDirection.getOrientation( side );
|
||||
return this.getAccessibleSlotsBySide( ( (AEBaseBlock) blk ).mapRotation( this, mySide ) );
|
||||
return this.getAccessibleSlotsBySide( ( (AEBaseBlock) blk ).mapRotation( this, side ) );
|
||||
}
|
||||
return this.getAccessibleSlotsBySide( ForgeDirection.getOrientation( side ) );
|
||||
return this.getAccessibleSlotsBySide( side );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, int side )
|
||||
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, EnumFacing side )
|
||||
{
|
||||
return this.isItemValidForSlot( slotIndex, insertingItem );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, EnumFacing side )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
this.getInternalInventory().clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField(
|
||||
int id )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public void setField(
|
||||
int id,
|
||||
int value )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFieldCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChatComponent getDisplayName()
|
||||
{
|
||||
if ( hasCustomName() )
|
||||
return new ChatComponentText(getName());
|
||||
return new ChatComponentTranslation( getBlockType().getUnlocalizedName() );
|
||||
}
|
||||
|
||||
public abstract int[] getAccessibleSlotsBySide( ForgeDirection whichSide );
|
||||
|
||||
public abstract int[] getAccessibleSlotsBySide( EnumFacing whichSide );
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
package appeng.tile;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
@@ -31,9 +34,7 @@ import java.util.Map;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -42,9 +43,9 @@ import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.implementations.tiles.ISegmentedInventory;
|
||||
import appeng.api.util.ICommonTile;
|
||||
import appeng.api.util.IConfigManager;
|
||||
@@ -70,9 +71,19 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
private int renderFragment = 0;
|
||||
@Nullable
|
||||
public String customName;
|
||||
private ForgeDirection forward = ForgeDirection.UNKNOWN;
|
||||
private ForgeDirection up = ForgeDirection.UNKNOWN;
|
||||
private EnumFacing forward = null;
|
||||
private EnumFacing up = null;
|
||||
|
||||
@Override
|
||||
public boolean shouldRefresh(
|
||||
World world,
|
||||
BlockPos pos,
|
||||
IBlockState oldState,
|
||||
IBlockState newSate )
|
||||
{
|
||||
return newSate.getBlock() != oldState.getBlock(); // state dosn't change tile entities in AE2.
|
||||
}
|
||||
|
||||
public static void registerTileItem( Class<? extends TileEntity> c, ItemStackSrc wat )
|
||||
{
|
||||
ITEM_STACKS.put( c, wat );
|
||||
@@ -86,7 +97,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
|
||||
public boolean notLoaded()
|
||||
{
|
||||
return !this.worldObj.blockExists( this.xCoord, this.yCoord, this.zCoord );
|
||||
return !this.worldObj.isBlockLoaded( pos );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -136,8 +147,8 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
{
|
||||
if( this.canBeRotated() )
|
||||
{
|
||||
this.forward = ForgeDirection.valueOf( data.getString( "orientation_forward" ) );
|
||||
this.up = ForgeDirection.valueOf( data.getString( "orientation_up" ) );
|
||||
this.forward = EnumFacing.valueOf( data.getString( "forward" ) );
|
||||
this.up = EnumFacing.valueOf( data.getString( "up" ) );
|
||||
}
|
||||
}
|
||||
catch( IllegalArgumentException ignored )
|
||||
@@ -158,8 +169,8 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
|
||||
if( this.canBeRotated() )
|
||||
{
|
||||
data.setString( "orientation_forward", this.forward.name() );
|
||||
data.setString( "orientation_up", this.up.name() );
|
||||
data.setString( "forward", this.forward.name() );
|
||||
data.setString( "up", this.up.name() );
|
||||
}
|
||||
|
||||
if( this.customName != null )
|
||||
@@ -173,8 +184,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void updateEntity()
|
||||
public final void update()
|
||||
{
|
||||
for( AETileEventHandler h : this.getHandlerListFor( TileEventType.TICK ) )
|
||||
{
|
||||
@@ -204,13 +214,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
|
||||
stream.capacity( stream.readableBytes() );
|
||||
data.setByteArray( "X", stream.array() );
|
||||
return new S35PacketUpdateTileEntity( this.xCoord, this.yCoord, this.zCoord, 64, data );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean canUpdate()
|
||||
{
|
||||
return this.hasHandlerFor( TileEventType.TICK );
|
||||
return new S35PacketUpdateTileEntity( pos, 64, data );
|
||||
}
|
||||
|
||||
private boolean hasHandlerFor( TileEventType type )
|
||||
@@ -224,9 +228,9 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
public void onDataPacket( NetworkManager net, S35PacketUpdateTileEntity pkt )
|
||||
{
|
||||
// / pkt.actionType
|
||||
if( pkt.func_148853_f() == 64 )
|
||||
if( pkt.getTileEntityType() == 64 )
|
||||
{
|
||||
ByteBuf stream = Unpooled.copiedBuffer( pkt.func_148857_g().getByteArray( "X" ) );
|
||||
ByteBuf stream = Unpooled.copiedBuffer( pkt.getNbtCompound().getByteArray( "X" ) );
|
||||
if( this.readFromStream( stream ) )
|
||||
{
|
||||
this.markForUpdate();
|
||||
@@ -252,12 +256,12 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
|
||||
if( this.canBeRotated() )
|
||||
{
|
||||
ForgeDirection old_Forward = this.forward;
|
||||
ForgeDirection old_Up = this.up;
|
||||
EnumFacing old_Forward = this.forward;
|
||||
EnumFacing old_Up = this.up;
|
||||
|
||||
byte orientation = data.readByte();
|
||||
this.forward = ForgeDirection.getOrientation( orientation & 0x7 );
|
||||
this.up = ForgeDirection.getOrientation( orientation >> 3 );
|
||||
this.forward = EnumFacing.VALUES[ orientation & 0x7 ];
|
||||
this.up = EnumFacing.VALUES[ orientation >> 3 ];
|
||||
|
||||
output = this.forward != old_Forward || this.up != old_Up;
|
||||
}
|
||||
@@ -296,8 +300,8 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
// TODO: Optimize Network Load
|
||||
if( this.worldObj != null )
|
||||
{
|
||||
AELog.blockUpdate( this.xCoord, this.yCoord, this.zCoord, this );
|
||||
this.worldObj.markBlockForUpdate( this.xCoord, this.yCoord, this.zCoord );
|
||||
AELog.blockUpdate( pos, this );
|
||||
this.worldObj.markBlockForUpdate( pos );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -403,27 +407,27 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getForward()
|
||||
public EnumFacing getForward()
|
||||
{
|
||||
return this.forward;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getUp()
|
||||
public EnumFacing getUp()
|
||||
{
|
||||
return this.up;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation( ForgeDirection inForward, ForgeDirection inUp )
|
||||
public void setOrientation( EnumFacing inForward, EnumFacing inUp )
|
||||
{
|
||||
this.forward = inForward;
|
||||
this.up = inUp;
|
||||
this.markForUpdate();
|
||||
Platform.notifyBlocksOfNeighbors( this.worldObj, this.xCoord, this.yCoord, this.zCoord );
|
||||
Platform.notifyBlocksOfNeighbors( this.worldObj, pos );
|
||||
}
|
||||
|
||||
public void onPlacement( ItemStack stack, EntityPlayer player, int side )
|
||||
public void onPlacement( ItemStack stack, EntityPlayer player, EnumFacing side )
|
||||
{
|
||||
if( stack.hasTagCompound() )
|
||||
{
|
||||
@@ -480,7 +484,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
* @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 )
|
||||
{
|
||||
if( this instanceof IInventory )
|
||||
{
|
||||
@@ -497,7 +501,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
}
|
||||
}
|
||||
|
||||
public void getNoDrops( World w, int x, int y, int z, List<ItemStack> drops )
|
||||
public void getNoDrops( World w, BlockPos pos, List<ItemStack> drops )
|
||||
{
|
||||
|
||||
}
|
||||
@@ -566,7 +570,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
|
||||
public void securityBreak()
|
||||
{
|
||||
this.worldObj.func_147480_a( this.xCoord, this.yCoord, this.zCoord, true );
|
||||
this.worldObj.destroyBlock( pos, true );
|
||||
this.disableDrops();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,17 +19,15 @@
|
||||
package appeng.tile.crafting;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import appeng.api.implementations.tiles.IColorableTile;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AEColor;
|
||||
@@ -149,7 +147,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recolourBlock( ForgeDirection side, AEColor newPaintedColor, EntityPlayer who )
|
||||
public boolean recolourBlock( EnumFacing side, AEColor newPaintedColor, EntityPlayer who )
|
||||
{
|
||||
if( this.paintedColor == newPaintedColor )
|
||||
{
|
||||
|
||||
@@ -20,9 +20,9 @@ package appeng.tile.crafting;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.block.crafting.BlockCraftingUnit;
|
||||
|
||||
|
||||
public class TileCraftingStorageTile extends TileCraftingTile
|
||||
@@ -80,16 +80,17 @@ public class TileCraftingStorageTile extends TileCraftingTile
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch( this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord ) & 3 )
|
||||
BlockCraftingUnit unit = (BlockCraftingUnit)this.worldObj.getBlockState( pos ).getBlock();
|
||||
switch( unit.type )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
case STORAGE_1K:
|
||||
return 1024;
|
||||
case 1:
|
||||
case STORAGE_4K:
|
||||
return 4 * 1024;
|
||||
case 2:
|
||||
case STORAGE_16K:
|
||||
return 16 * 1024;
|
||||
case 3:
|
||||
case STORAGE_64K:
|
||||
return 64 * 1024;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,11 +24,11 @@ import java.util.EnumSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.implementations.IPowerChannelState;
|
||||
@@ -37,10 +37,12 @@ import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.api.parts.ISimplifiedBundle;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.block.crafting.BlockCraftingUnit;
|
||||
import appeng.block.crafting.BlockCraftingUnit.CraftingUnitType;
|
||||
import appeng.me.cluster.IAECluster;
|
||||
import appeng.me.cluster.IAEMultiBlock;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCalculator;
|
||||
@@ -55,10 +57,9 @@ import appeng.util.Platform;
|
||||
|
||||
public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IPowerChannelState
|
||||
{
|
||||
|
||||
private final CraftingCPUCalculator calc = new CraftingCPUCalculator( this );
|
||||
|
||||
public ISimplifiedBundle lightCache;
|
||||
|
||||
public NBTTagCompound previousState = null;
|
||||
public boolean isCoreBlock = false;
|
||||
CraftingCPUCluster cluster;
|
||||
@@ -66,7 +67,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
public TileCraftingTile()
|
||||
{
|
||||
this.gridProxy.setFlags( GridFlags.MULTIBLOCK, GridFlags.REQUIRE_CHANNEL );
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,7 +113,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return ( this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord ) & 3 ) == 1;
|
||||
|
||||
BlockCraftingUnit unit = (BlockCraftingUnit)this.worldObj.getBlockState( pos ).getBlock();
|
||||
return unit.type == CraftingUnitType.ACCELERATOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -154,23 +157,23 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
power = this.gridProxy.isActive();
|
||||
}
|
||||
|
||||
int current = this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord );
|
||||
int newMeta = ( current & 3 ) | ( formed ? 8 : 0 ) | ( power ? 4 : 0 );
|
||||
IBlockState current = this.worldObj.getBlockState( pos );
|
||||
IBlockState newState = current.withProperty( BlockCraftingUnit.POWERED, power ).withProperty( BlockCraftingUnit.FORMED, formed );
|
||||
|
||||
if( current != newMeta )
|
||||
if( current != newState )
|
||||
{
|
||||
this.worldObj.setBlockMetadataWithNotify( this.xCoord, this.yCoord, this.zCoord, newMeta, 2 );
|
||||
this.worldObj.setBlockState( pos, newState );
|
||||
}
|
||||
|
||||
if( updateFormed )
|
||||
{
|
||||
if( formed )
|
||||
{
|
||||
this.gridProxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
|
||||
this.gridProxy.setValidSides( EnumSet.allOf( EnumFacing.class ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -179,7 +182,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return ( this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord ) & 8 ) == 8;
|
||||
return (boolean)this.worldObj.getBlockState( pos ).getValue( BlockCraftingUnit.FORMED );
|
||||
}
|
||||
return this.cluster != null;
|
||||
}
|
||||
@@ -284,11 +287,11 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
{
|
||||
TileEntity te = (TileEntity) h;
|
||||
|
||||
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
|
||||
for( AEPartLocation d : AEPartLocation.SIDE_LOCATIONS )
|
||||
{
|
||||
WorldCoord wc = new WorldCoord( te );
|
||||
wc.add( d, 1 );
|
||||
if( this.worldObj.isAirBlock( wc.x, wc.y, wc.z ) )
|
||||
if( this.worldObj.isAirBlock( wc.getPos() ) )
|
||||
{
|
||||
places.add( wc );
|
||||
}
|
||||
@@ -318,7 +321,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
WorldCoord wc = places.poll();
|
||||
places.add( wc );
|
||||
|
||||
Platform.spawnDrops( this.worldObj, wc.x, wc.y, wc.z, Collections.singletonList( g.getItemStack() ) );
|
||||
Platform.spawnDrops( this.worldObj, wc.getPos(), Collections.singletonList( g.getItemStack() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +334,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return ( this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord ) & 4 ) == 4;
|
||||
return (boolean)this.worldObj.getBlockState( pos ).getValue( BlockCraftingUnit.POWERED );
|
||||
}
|
||||
return this.gridProxy.isActive();
|
||||
}
|
||||
|
||||
@@ -19,23 +19,22 @@
|
||||
package appeng.tile.crafting;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
@@ -53,9 +52,9 @@ import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.parts.ISimplifiedBundle;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.container.ContainerNull;
|
||||
@@ -85,9 +84,8 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 9 + 2 );
|
||||
private final IConfigManager settings;
|
||||
private final UpgradeInventory upgrades;
|
||||
public ISimplifiedBundle lightCache;
|
||||
private boolean isPowered = false;
|
||||
private ForgeDirection pushDirection = ForgeDirection.UNKNOWN;
|
||||
private AEPartLocation pushDirection = AEPartLocation.INTERNAL;
|
||||
private ItemStack myPattern = null;
|
||||
private ICraftingPatternDetails myPlan = null;
|
||||
private double progress = 0;
|
||||
@@ -113,7 +111,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pushPattern( ICraftingPatternDetails patternDetails, InventoryCrafting table, ForgeDirection where )
|
||||
public boolean pushPattern( ICraftingPatternDetails patternDetails, InventoryCrafting table, EnumFacing where )
|
||||
{
|
||||
if( this.myPattern == null )
|
||||
{
|
||||
@@ -127,7 +125,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
{
|
||||
this.forcePlan = true;
|
||||
this.myPlan = patternDetails;
|
||||
this.pushDirection = where;
|
||||
this.pushDirection = AEPartLocation.fromFacing( where );
|
||||
|
||||
for( int x = 0; x < table.getSizeInventory(); x++ )
|
||||
{
|
||||
@@ -183,7 +181,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
this.craftingInv.setInventorySlotContents( x, this.inv.getStackInSlot( x ) );
|
||||
}
|
||||
|
||||
return this.myPlan.getOutput( this.craftingInv, this.getWorldObj() ) != null;
|
||||
return this.myPlan.getOutput( this.craftingInv, this.getWorld() ) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -241,14 +239,14 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
|
||||
if( myPat != null && myPat.getItem() instanceof ItemEncodedPattern )
|
||||
{
|
||||
World w = this.getWorldObj();
|
||||
World w = this.getWorld();
|
||||
ItemEncodedPattern iep = (ItemEncodedPattern) myPat.getItem();
|
||||
ICraftingPatternDetails ph = iep.getPatternForItem( myPat, w );
|
||||
if( ph != null && ph.isCraftable() )
|
||||
{
|
||||
this.forcePlan = true;
|
||||
this.myPlan = ph;
|
||||
this.pushDirection = ForgeDirection.getOrientation( data.getInteger( "pushDirection" ) );
|
||||
this.pushDirection = AEPartLocation.fromOrdinal( data.getInteger( "pushDirection" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -274,7 +272,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
{
|
||||
if( !Platform.isSameItem( is, this.myPattern ) )
|
||||
{
|
||||
World w = this.getWorldObj();
|
||||
World w = this.getWorld();
|
||||
ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
|
||||
ICraftingPatternDetails ph = iep.getPatternForItem( is, w );
|
||||
|
||||
@@ -292,14 +290,14 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
this.forcePlan = false;
|
||||
this.myPlan = null;
|
||||
this.myPattern = null;
|
||||
this.pushDirection = ForgeDirection.UNKNOWN;
|
||||
this.pushDirection = AEPartLocation.INTERNAL;
|
||||
}
|
||||
|
||||
this.updateSleepiness();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.COVERED;
|
||||
}
|
||||
@@ -360,7 +358,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
|
||||
if( this.hasPattern() )
|
||||
{
|
||||
return this.myPlan.isValidItemForSlot( i, itemstack, this.getWorldObj() );
|
||||
return this.myPlan.isValidItemForSlot( i, itemstack, this.getWorld() );
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -381,13 +379,13 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, EnumFacing side )
|
||||
{
|
||||
return slotIndex == 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide( ForgeDirection whichSide )
|
||||
public int[] getAccessibleSlotsBySide( EnumFacing whichSide )
|
||||
{
|
||||
return SIDES;
|
||||
}
|
||||
@@ -398,9 +396,12 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@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 h = 0; h < this.upgrades.getSizeInventory(); h++ )
|
||||
{
|
||||
@@ -487,10 +488,10 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
this.progress = 0;
|
||||
ItemStack output = this.myPlan.getOutput( this.craftingInv, this.getWorldObj() );
|
||||
ItemStack output = this.myPlan.getOutput( this.craftingInv, this.getWorld() );
|
||||
if( output != null )
|
||||
{
|
||||
FMLCommonHandler.instance().firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) this.getWorldObj() ), output, this.craftingInv );
|
||||
FMLCommonHandler.instance().firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) this.getWorld() ), output, this.craftingInv );
|
||||
|
||||
this.pushOut( output.copy() );
|
||||
|
||||
@@ -503,16 +504,16 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
{
|
||||
this.forcePlan = false;
|
||||
this.myPlan = null;
|
||||
this.pushDirection = ForgeDirection.UNKNOWN;
|
||||
this.pushDirection = AEPartLocation.INTERNAL;
|
||||
}
|
||||
|
||||
this.ejectHeldItems();
|
||||
|
||||
try
|
||||
{
|
||||
TargetPoint where = new TargetPoint( this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, 32 );
|
||||
TargetPoint where = new TargetPoint( this.worldObj.provider.getDimensionId(), pos.getX(), pos.getY(), pos.getZ(), 32 );
|
||||
IAEItemStack item = AEItemStack.create( output );
|
||||
NetworkHandler.instance.sendToAllAround( new PacketAssemblerAnimation( this.xCoord, this.yCoord, this.zCoord, (byte) speed, item ), where );
|
||||
NetworkHandler.instance.sendToAllAround( new PacketAssemblerAnimation( pos, (byte) speed, item ), where );
|
||||
}
|
||||
catch( IOException e )
|
||||
{
|
||||
@@ -563,16 +564,16 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
|
||||
private void pushOut( ItemStack output )
|
||||
{
|
||||
if( this.pushDirection == ForgeDirection.UNKNOWN )
|
||||
if( this.pushDirection == AEPartLocation.INTERNAL )
|
||||
{
|
||||
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
|
||||
for( EnumFacing d : EnumFacing.VALUES )
|
||||
{
|
||||
output = this.pushTo( output, d );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
output = this.pushTo( output, this.pushDirection );
|
||||
output = this.pushTo( output, this.pushDirection.getFacing() );
|
||||
}
|
||||
|
||||
if( output == null && this.forcePlan )
|
||||
@@ -584,14 +585,14 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
this.inv.setInventorySlotContents( 9, output );
|
||||
}
|
||||
|
||||
private ItemStack pushTo( ItemStack output, ForgeDirection d )
|
||||
private ItemStack pushTo( ItemStack output, EnumFacing d )
|
||||
{
|
||||
if( output == null )
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
TileEntity te = this.getWorldObj().getTileEntity( this.xCoord + d.offsetX, this.yCoord + d.offsetY, this.zCoord + d.offsetZ );
|
||||
TileEntity te = this.getWorld().getTileEntity( pos.offset( d ) );
|
||||
|
||||
if( te == null )
|
||||
{
|
||||
|
||||
@@ -19,16 +19,14 @@
|
||||
package appeng.tile.events;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
|
||||
@@ -21,8 +21,11 @@ package appeng.tile.events;
|
||||
|
||||
public enum TileEventType
|
||||
{
|
||||
/**
|
||||
* Requires IUpdatePlayerListBox, this makes the tile entity tick in 1.8
|
||||
*/
|
||||
TICK,
|
||||
|
||||
|
||||
WORLD_NBT_READ, WORLD_NBT_WRITE,
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,10 +20,9 @@ package appeng.tile.grid;
|
||||
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.me.helpers.IGridProxyable;
|
||||
import appeng.tile.AEBaseInvTile;
|
||||
@@ -61,7 +60,7 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getGridNode( ForgeDirection dir )
|
||||
public IGridNode getGridNode( AEPartLocation dir )
|
||||
{
|
||||
return this.gridProxy.getNode();
|
||||
}
|
||||
@@ -99,4 +98,18 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH
|
||||
{
|
||||
return this.gridProxy.getNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField(
|
||||
int id )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFieldCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,11 +20,10 @@ package appeng.tile.grid;
|
||||
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.me.helpers.IGridProxyable;
|
||||
@@ -69,13 +68,13 @@ public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IA
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getGridNode( ForgeDirection dir )
|
||||
public IGridNode getGridNode( AEPartLocation dir )
|
||||
{
|
||||
return this.gridProxy.getNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.SMART;
|
||||
}
|
||||
|
||||
@@ -20,11 +20,10 @@ package appeng.tile.grid;
|
||||
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.me.helpers.IGridProxyable;
|
||||
@@ -56,13 +55,13 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getGridNode( ForgeDirection dir )
|
||||
public IGridNode getGridNode( AEPartLocation dir )
|
||||
{
|
||||
return this.gridProxy.getNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.SMART;
|
||||
}
|
||||
|
||||
@@ -19,17 +19,19 @@
|
||||
package appeng.tile.grindstone;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.server.gui.IUpdatePlayerListBox;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.implementations.tiles.ICrankable;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.AEBaseTile;
|
||||
@@ -38,7 +40,7 @@ import appeng.tile.events.TileEventType;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class TileCrank extends AEBaseTile implements ICustomCollision
|
||||
public class TileCrank extends AEBaseTile implements ICustomCollision, IUpdatePlayerListBox
|
||||
{
|
||||
|
||||
final int ticksPerRotation = 18;
|
||||
@@ -78,8 +80,8 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
|
||||
return null;
|
||||
}
|
||||
|
||||
ForgeDirection grinder = this.getUp().getOpposite();
|
||||
TileEntity te = this.worldObj.getTileEntity( this.xCoord + grinder.offsetX, this.yCoord + grinder.offsetY, this.zCoord + grinder.offsetZ );
|
||||
EnumFacing grinder = this.getUp().getOpposite();
|
||||
TileEntity te = this.worldObj.getTileEntity( pos.offset( grinder ) );
|
||||
if( te instanceof ICrankable )
|
||||
{
|
||||
return (ICrankable) te;
|
||||
@@ -101,10 +103,11 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation( ForgeDirection inForward, ForgeDirection inUp )
|
||||
public void setOrientation( EnumFacing inForward, EnumFacing inUp )
|
||||
{
|
||||
super.setOrientation( inForward, inUp );
|
||||
this.getBlockType().onNeighborBlockChange( this.worldObj, this.xCoord, this.yCoord, this.zCoord, Platform.AIR_BLOCK );
|
||||
IBlockState state = this.worldObj.getBlockState( pos );
|
||||
this.getBlockType().onNeighborBlockChange( this.worldObj, pos, state, state.getBlock() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -140,8 +143,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
|
||||
this.hits++;
|
||||
if( this.hits > 10 )
|
||||
{
|
||||
this.worldObj.func_147480_a( this.xCoord, this.yCoord, this.zCoord, false );
|
||||
// worldObj.destroyBlock( xCoord, yCoord, zCoord, false );
|
||||
this.worldObj.destroyBlock( pos, false );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,21 +153,30 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, int x, int y, int z, Entity e, boolean isVisual )
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
Entity thePlayer,
|
||||
boolean b )
|
||||
{
|
||||
double xOff = -0.15 * this.getUp().offsetX;
|
||||
double yOff = -0.15 * this.getUp().offsetY;
|
||||
double zOff = -0.15 * this.getUp().offsetZ;
|
||||
return Collections.singletonList( AxisAlignedBB.getBoundingBox( xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85 ) );
|
||||
double xOff = -0.15 * this.getUp().getFrontOffsetX();
|
||||
double yOff = -0.15 * this.getUp().getFrontOffsetY();
|
||||
double zOff = -0.15 * this.getUp().getFrontOffsetZ();
|
||||
return Collections.singletonList( AxisAlignedBB.fromBounds( xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85 ) );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addCollidingBlockToList( World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e )
|
||||
public void addCollidingBlockToList(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
AxisAlignedBB bb,
|
||||
List<AxisAlignedBB> out,
|
||||
Entity e )
|
||||
{
|
||||
double xOff = -0.15 * this.getUp().offsetX;
|
||||
double yOff = -0.15 * this.getUp().offsetY;
|
||||
double zOff = -0.15 * this.getUp().offsetZ;
|
||||
out.add( AxisAlignedBB.getBoundingBox( xOff + 0.15, yOff + 0.15, zOff + 0.15,// ahh
|
||||
double xOff = -0.15 * this.getUp().getFrontOffsetX();
|
||||
double yOff = -0.15 * this.getUp().getFrontOffsetY();
|
||||
double zOff = -0.15 * this.getUp().getFrontOffsetZ();
|
||||
out.add( AxisAlignedBB.fromBounds( xOff + 0.15, yOff + 0.15, zOff + 0.15,// ahh
|
||||
xOff + 0.85, yOff + 0.85, zOff + 0.85 ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,14 +22,13 @@ package appeng.tile.grindstone;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.features.IGrinderEntry;
|
||||
import appeng.api.implementations.tiles.ICrankable;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.tile.AEBaseInvTile;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
@@ -47,10 +46,11 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
|
||||
int points;
|
||||
|
||||
@Override
|
||||
public void setOrientation( ForgeDirection inForward, ForgeDirection inUp )
|
||||
public void setOrientation( EnumFacing inForward, EnumFacing inUp )
|
||||
{
|
||||
super.setOrientation( inForward, inUp );
|
||||
this.getBlockType().onNeighborBlockChange( this.worldObj, this.xCoord, this.yCoord, this.zCoord, Platform.AIR_BLOCK );
|
||||
IBlockState state = worldObj.getBlockState( pos );
|
||||
this.getBlockType().onNeighborBlockChange( this.worldObj, pos, state, state.getBlock() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,7 +66,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, int side )
|
||||
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, EnumFacing side )
|
||||
{
|
||||
if( AEApi.instance().registries().grinder().getRecipeForInput( insertingItem ) == null )
|
||||
{
|
||||
@@ -77,13 +77,13 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, EnumFacing side )
|
||||
{
|
||||
return slotIndex >= 3 && slotIndex <= 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide( ForgeDirection side )
|
||||
public int[] getAccessibleSlotsBySide( EnumFacing side )
|
||||
{
|
||||
return this.sides;
|
||||
}
|
||||
@@ -152,7 +152,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
|
||||
}
|
||||
|
||||
this.points = 0;
|
||||
InventoryAdaptor sia = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this, 3, 3, true ), ForgeDirection.EAST );
|
||||
InventoryAdaptor sia = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this, 3, 3, true ), EnumFacing.EAST );
|
||||
|
||||
this.addItem( sia, r.getOutput() );
|
||||
|
||||
@@ -182,19 +182,15 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
|
||||
ItemStack notAdded = sia.addItems( output );
|
||||
if( notAdded != null )
|
||||
{
|
||||
WorldCoord wc = new WorldCoord( this.xCoord, this.yCoord, this.zCoord );
|
||||
|
||||
wc.add( this.getForward(), 1 );
|
||||
|
||||
List<ItemStack> out = new ArrayList<ItemStack>();
|
||||
out.add( notAdded );
|
||||
|
||||
Platform.spawnDrops( this.worldObj, wc.x, wc.y, wc.z, out );
|
||||
Platform.spawnDrops( this.worldObj, pos.offset( this.getForward() ), out );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCrankAttach( ForgeDirection directionToCrank )
|
||||
public boolean canCrankAttach( EnumFacing directionToCrank )
|
||||
{
|
||||
return this.getUp() == directionToCrank;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.AELog;
|
||||
@@ -218,13 +218,13 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
public String getName()
|
||||
{
|
||||
return "appeng-internal";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -250,16 +250,6 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( int i, ItemStack itemstack )
|
||||
{
|
||||
@@ -276,4 +266,54 @@ public class AppEngInternalAEInventory implements IInventory, Iterable<ItemStack
|
||||
{
|
||||
return new AEInvIterator( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChatComponent getDisplayName()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(
|
||||
EntityPlayer player )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory(
|
||||
EntityPlayer player )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField(
|
||||
int id )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField(
|
||||
int id,
|
||||
int value )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFieldCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
for( int x = 0; x < this.size; x++ )
|
||||
{
|
||||
setInventorySlotContents( x, null );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.core.AELog;
|
||||
import appeng.me.storage.MEIInventoryWrapper;
|
||||
@@ -158,13 +158,13 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
public String getName()
|
||||
{
|
||||
return "appeng-internal";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -190,16 +190,6 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( int i, ItemStack itemstack )
|
||||
{
|
||||
@@ -282,4 +272,53 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
|
||||
{
|
||||
return new InvIterator( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChatComponent getDisplayName()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(
|
||||
EntityPlayer player )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory(
|
||||
EntityPlayer player )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField(
|
||||
int id )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField(
|
||||
int id,
|
||||
int value )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFieldCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
for( int x = 0; x < this.size; x++ )
|
||||
{
|
||||
setInventorySlotContents( x,null );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
|
||||
|
||||
public class AppEngNullInventory implements IInventory
|
||||
@@ -67,13 +68,13 @@ public class AppEngNullInventory implements IInventory
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
public String getName()
|
||||
{
|
||||
return "appeng-internal";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -96,19 +97,56 @@ public class AppEngNullInventory implements IInventory
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( int i, ItemStack itemstack )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChatComponent getDisplayName()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(
|
||||
EntityPlayer player )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory(
|
||||
EntityPlayer player )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField(
|
||||
int id )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField(
|
||||
int id,
|
||||
int value )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFieldCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ import java.util.List;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.config.CopyMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.Upgrades;
|
||||
@@ -235,9 +235,12 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
||||
}
|
||||
|
||||
@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 );
|
||||
|
||||
if( this.cell.getStackInSlot( 0 ) != null )
|
||||
{
|
||||
|
||||
@@ -19,18 +19,18 @@
|
||||
package appeng.tile.misc;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
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.server.gui.IUpdatePlayerListBox;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
@@ -41,6 +41,7 @@ import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
import appeng.api.implementations.tiles.ICrankable;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.tile.TileEvent;
|
||||
@@ -52,7 +53,7 @@ import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
|
||||
public class TileCharger extends AENetworkPowerTile implements ICrankable
|
||||
public class TileCharger extends AENetworkPowerTile implements ICrankable, IUpdatePlayerListBox
|
||||
{
|
||||
|
||||
final int[] sides = new int[] { 0 };
|
||||
@@ -64,14 +65,14 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
|
||||
|
||||
public TileCharger()
|
||||
{
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
|
||||
this.gridProxy.setFlags();
|
||||
this.internalMaxPower = 1500;
|
||||
this.gridProxy.setIdlePowerUsage( 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.COVERED;
|
||||
}
|
||||
@@ -174,7 +175,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation( ForgeDirection inForward, ForgeDirection inUp )
|
||||
public void setOrientation( EnumFacing inForward, EnumFacing inUp )
|
||||
{
|
||||
super.setOrientation( inForward, inUp );
|
||||
this.gridProxy.setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
|
||||
@@ -216,7 +217,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCrankAttach( ForgeDirection directionToCrank )
|
||||
public boolean canCrankAttach( EnumFacing directionToCrank )
|
||||
{
|
||||
return this.getUp() == directionToCrank || this.getUp().getOpposite() == directionToCrank;
|
||||
}
|
||||
@@ -248,7 +249,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, EnumFacing side )
|
||||
{
|
||||
if( Platform.isChargeable( extractedItem ) )
|
||||
{
|
||||
@@ -263,7 +264,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide( ForgeDirection whichSide )
|
||||
public int[] getAccessibleSlotsBySide( EnumFacing whichSide )
|
||||
{
|
||||
return this.sides;
|
||||
}
|
||||
@@ -291,7 +292,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
|
||||
List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
drops.add( myItem );
|
||||
this.setInventorySlotContents( 0, null );
|
||||
Platform.spawnDrops( this.worldObj, this.xCoord + this.getForward().offsetX, this.yCoord + this.getForward().offsetY, this.zCoord + this.getForward().offsetZ, drops );
|
||||
Platform.spawnDrops( this.worldObj, pos.offset( getForward() ), drops );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,11 @@ package appeng.tile.misc;
|
||||
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 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.CondenserOutput;
|
||||
import appeng.api.config.Settings;
|
||||
@@ -209,25 +208,25 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, int side )
|
||||
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, EnumFacing side )
|
||||
{
|
||||
return slotIndex == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, EnumFacing side )
|
||||
{
|
||||
return slotIndex != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide( ForgeDirection side )
|
||||
public int[] getAccessibleSlotsBySide( EnumFacing side )
|
||||
{
|
||||
return this.sides;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill( ForgeDirection from, FluidStack resource, boolean doFill )
|
||||
public int fill( EnumFacing from, FluidStack resource, boolean doFill )
|
||||
{
|
||||
if( doFill )
|
||||
{
|
||||
@@ -238,31 +237,31 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
|
||||
}
|
||||
|
||||
@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 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@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 )
|
||||
{
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
@@ -19,22 +19,20 @@
|
||||
package appeng.tile.misc;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
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.PowerMultiplier;
|
||||
@@ -51,6 +49,7 @@ import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.core.features.registries.entries.InscriberRecipe;
|
||||
import appeng.core.settings.TickRates;
|
||||
@@ -70,6 +69,8 @@ import appeng.util.Platform;
|
||||
import appeng.util.inv.WrapperInventoryRange;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
|
||||
/**
|
||||
* @author AlgorithmX2
|
||||
@@ -96,7 +97,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
@Reflected
|
||||
public TileInscriber()
|
||||
{
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
|
||||
this.internalMaxPower = 1500;
|
||||
this.gridProxy.setIdlePowerUsage( 0 );
|
||||
this.settings = new ConfigManager( this );
|
||||
@@ -111,7 +112,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.COVERED;
|
||||
}
|
||||
@@ -186,7 +187,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation( ForgeDirection inForward, ForgeDirection inUp )
|
||||
public void setOrientation( EnumFacing inForward, EnumFacing inUp )
|
||||
{
|
||||
super.setOrientation( inForward, inUp );
|
||||
this.gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( this.getForward() ) ) );
|
||||
@@ -194,9 +195,12 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
}
|
||||
|
||||
@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 h = 0; h < this.upgrades.getSizeInventory(); h++ )
|
||||
{
|
||||
@@ -280,7 +284,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, EnumFacing side )
|
||||
{
|
||||
if( this.smash )
|
||||
{
|
||||
@@ -291,14 +295,14 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide( ForgeDirection d )
|
||||
public int[] getAccessibleSlotsBySide( EnumFacing d )
|
||||
{
|
||||
if( d == ForgeDirection.UP )
|
||||
if( d == EnumFacing.UP )
|
||||
{
|
||||
return this.top;
|
||||
}
|
||||
|
||||
if( d == ForgeDirection.DOWN )
|
||||
if( d == EnumFacing.DOWN )
|
||||
{
|
||||
return this.bottom;
|
||||
}
|
||||
@@ -429,7 +433,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
if( out != null )
|
||||
{
|
||||
final ItemStack outputCopy = out.getOutput().copy();
|
||||
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this.inv, 3, 1, true ), ForgeDirection.UNKNOWN );
|
||||
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this.inv, 3, 1, true ), EnumFacing.UP );
|
||||
|
||||
if( ad.addItems( outputCopy ) == null )
|
||||
{
|
||||
@@ -498,7 +502,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
|
||||
if( out != null )
|
||||
{
|
||||
ItemStack outputCopy = out.getOutput().copy();
|
||||
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this.inv, 3, 1, true ), ForgeDirection.UNKNOWN );
|
||||
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this.inv, 3, 1, true ), EnumFacing.UP );
|
||||
if( ad.simulateAdd( outputCopy ) == null )
|
||||
{
|
||||
this.smash = true;
|
||||
|
||||
@@ -22,16 +22,14 @@ package appeng.tile.misc;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
||||
@@ -51,6 +49,7 @@ import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.helpers.DualityInterface;
|
||||
@@ -63,12 +62,14 @@ import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.IInventoryDestination;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
|
||||
public class TileInterface extends AENetworkInvTile implements IGridTickable, ITileStorageMonitorable, IStorageMonitorable, IInventoryDestination, IInterfaceHost, IPriorityHost
|
||||
{
|
||||
|
||||
final DualityInterface duality = new DualityInterface( this.gridProxy, this );
|
||||
ForgeDirection pointAt = ForgeDirection.UNKNOWN;
|
||||
AEPartLocation pointAt = AEPartLocation.INTERNAL;
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void stateChange( MENetworkChannelsChanged c )
|
||||
@@ -82,7 +83,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
|
||||
this.duality.notifyNeighbors();
|
||||
}
|
||||
|
||||
public void setSide( ForgeDirection axis )
|
||||
public void setSide( AEPartLocation axis )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
@@ -95,9 +96,9 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
|
||||
}
|
||||
else if( this.pointAt == axis || this.pointAt == axis.getOpposite() )
|
||||
{
|
||||
this.pointAt = ForgeDirection.UNKNOWN;
|
||||
this.pointAt = AEPartLocation.INTERNAL;
|
||||
}
|
||||
else if( this.pointAt == ForgeDirection.UNKNOWN )
|
||||
else if( this.pointAt == AEPartLocation.INTERNAL )
|
||||
{
|
||||
this.pointAt = axis.getOpposite();
|
||||
}
|
||||
@@ -106,20 +107,28 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
|
||||
this.pointAt = Platform.rotateAround( this.pointAt, axis );
|
||||
}
|
||||
|
||||
if( ForgeDirection.UNKNOWN == this.pointAt )
|
||||
if( AEPartLocation.INTERNAL == this.pointAt )
|
||||
{
|
||||
this.setOrientation( this.pointAt, this.pointAt );
|
||||
this.setOrientation( EnumFacing.UP, EnumFacing.UP );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setOrientation( this.pointAt.offsetY != 0 ? ForgeDirection.SOUTH : ForgeDirection.UP, this.pointAt.getOpposite() );
|
||||
this.setOrientation( this.pointAt.yOffset != 0 ? EnumFacing.SOUTH : EnumFacing.UP, this.pointAt.getOpposite().getFacing() );
|
||||
}
|
||||
|
||||
this.gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt ) ) );
|
||||
configureNodeSides();
|
||||
this.markForUpdate();
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
private void configureNodeSides()
|
||||
{
|
||||
if ( this.pointAt == AEPartLocation.INTERNAL )
|
||||
this.gridProxy.setValidSides( EnumSet.allOf(EnumFacing.class) );
|
||||
else
|
||||
this.gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt.getFacing() ) ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
{
|
||||
@@ -127,7 +136,10 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
|
||||
}
|
||||
|
||||
@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 )
|
||||
{
|
||||
this.duality.addDrops( drops );
|
||||
}
|
||||
@@ -141,7 +153,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
|
||||
@Override
|
||||
public void onReady()
|
||||
{
|
||||
this.gridProxy.setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt ) ) );
|
||||
configureNodeSides();
|
||||
super.onReady();
|
||||
this.duality.initialize();
|
||||
}
|
||||
@@ -158,20 +170,20 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
|
||||
{
|
||||
int val = data.getInteger( "pointAt" );
|
||||
|
||||
if( val >= 0 && val < ForgeDirection.values().length )
|
||||
if( val >= 0 && val < AEPartLocation.values().length )
|
||||
{
|
||||
this.pointAt = ForgeDirection.values()[val];
|
||||
this.pointAt = AEPartLocation.values()[val];
|
||||
}
|
||||
else
|
||||
{
|
||||
this.pointAt = ForgeDirection.UNKNOWN;
|
||||
this.pointAt = AEPartLocation.INTERNAL;
|
||||
}
|
||||
|
||||
this.duality.readFromNBT( data );
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return this.duality.getCableConnectionType( dir );
|
||||
}
|
||||
@@ -231,9 +243,9 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide( ForgeDirection side )
|
||||
public int[] getAccessibleSlotsBySide( EnumFacing side )
|
||||
{
|
||||
return this.duality.getAccessibleSlotsFromSide( side.ordinal() );
|
||||
return this.duality.getSlotsForFace( side );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -243,13 +255,13 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<ForgeDirection> getTargets()
|
||||
public EnumSet<EnumFacing> getTargets()
|
||||
{
|
||||
if( this.pointAt == null || this.pointAt == ForgeDirection.UNKNOWN )
|
||||
if( this.pointAt == null || this.pointAt == AEPartLocation.INTERNAL )
|
||||
{
|
||||
return EnumSet.complementOf( EnumSet.of( ForgeDirection.UNKNOWN ) );
|
||||
return EnumSet.allOf( EnumFacing.class );
|
||||
}
|
||||
return EnumSet.of( this.pointAt );
|
||||
return EnumSet.of( this.pointAt.getFacing() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -259,7 +271,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStorageMonitorable getMonitorable( ForgeDirection side, BaseActionSource src )
|
||||
public IStorageMonitorable getMonitorable( EnumFacing side, BaseActionSource src )
|
||||
{
|
||||
return this.duality.getMonitorable( side, src, this );
|
||||
}
|
||||
|
||||
@@ -19,13 +19,14 @@
|
||||
package appeng.tile.misc;
|
||||
|
||||
|
||||
import net.minecraft.server.gui.IUpdatePlayerListBox;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class TileLightDetector extends AEBaseTile
|
||||
public class TileLightDetector extends AEBaseTile implements IUpdatePlayerListBox
|
||||
{
|
||||
|
||||
int lastCheck = 30;
|
||||
@@ -49,12 +50,12 @@ public class TileLightDetector extends AEBaseTile
|
||||
|
||||
public void updateLight()
|
||||
{
|
||||
int val = this.worldObj.getBlockLightValue( this.xCoord, this.yCoord, this.zCoord );
|
||||
int val = this.worldObj.getLight( pos );
|
||||
|
||||
if( this.lastLight != val )
|
||||
{
|
||||
this.lastLight = val;
|
||||
Platform.notifyBlocksOfNeighbors( this.worldObj, this.xCoord, this.yCoord, this.zCoord );
|
||||
Platform.notifyBlocksOfNeighbors( this.worldObj, pos );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,24 +19,21 @@
|
||||
package appeng.tile.misc;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.helpers.Splotch;
|
||||
import appeng.items.misc.ItemPaintBall;
|
||||
@@ -44,6 +41,8 @@ import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
|
||||
public class TilePaint extends AEBaseTile
|
||||
{
|
||||
@@ -53,6 +52,12 @@ public class TilePaint extends AEBaseTile
|
||||
int isLit = 0;
|
||||
List<Splotch> dots = null;
|
||||
|
||||
@Override
|
||||
public boolean canBeRotated()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@TileEvent( TileEventType.WORLD_NBT_WRITE )
|
||||
public void writeToNBT_TilePaint( NBTTagCompound data )
|
||||
{
|
||||
@@ -127,7 +132,7 @@ public class TilePaint extends AEBaseTile
|
||||
|
||||
if( this.worldObj != null )
|
||||
{
|
||||
this.worldObj.updateLightByType( EnumSkyBlock.Block, this.xCoord, this.yCoord, this.zCoord );
|
||||
this.worldObj.getLightFor( EnumSkyBlock.BLOCK, pos );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +156,7 @@ public class TilePaint extends AEBaseTile
|
||||
return;
|
||||
}
|
||||
|
||||
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
|
||||
for( EnumFacing side : EnumFacing.VALUES )
|
||||
{
|
||||
if( !this.isSideValid( side ) )
|
||||
{
|
||||
@@ -162,13 +167,14 @@ public class TilePaint extends AEBaseTile
|
||||
this.updateData();
|
||||
}
|
||||
|
||||
public boolean isSideValid( ForgeDirection side )
|
||||
public boolean isSideValid( EnumFacing side )
|
||||
{
|
||||
Block blk = this.worldObj.getBlock( this.xCoord + side.offsetX, this.yCoord + side.offsetY, this.zCoord + side.offsetZ );
|
||||
return blk.isSideSolid( this.worldObj, this.xCoord + side.offsetX, this.yCoord + side.offsetY, this.zCoord + side.offsetZ, side.getOpposite() );
|
||||
BlockPos p = pos.offset( side );
|
||||
IBlockState blk = this.worldObj.getBlockState( p );
|
||||
return blk.getBlock().isSideSolid( this.worldObj, p, side.getOpposite() );
|
||||
}
|
||||
|
||||
private void removeSide( ForgeDirection side )
|
||||
private void removeSide( EnumFacing side )
|
||||
{
|
||||
Iterator<Splotch> i = this.dots.iterator();
|
||||
while( i.hasNext() )
|
||||
@@ -204,11 +210,11 @@ public class TilePaint extends AEBaseTile
|
||||
|
||||
if( this.dots == null )
|
||||
{
|
||||
this.worldObj.setBlock( this.xCoord, this.yCoord, this.zCoord, Blocks.air );
|
||||
this.worldObj.setBlockToAir( pos );
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanSide( ForgeDirection side )
|
||||
public void cleanSide( EnumFacing side )
|
||||
{
|
||||
if( this.dots == null )
|
||||
{
|
||||
@@ -225,10 +231,12 @@ public class TilePaint extends AEBaseTile
|
||||
return this.isLit;
|
||||
}
|
||||
|
||||
public void addBlot( ItemStack type, ForgeDirection side, Vec3 hitVec )
|
||||
public void addBlot( ItemStack type, EnumFacing side, Vec3 hitVec )
|
||||
{
|
||||
Block blk = this.worldObj.getBlock( this.xCoord + side.offsetX, this.yCoord + side.offsetY, this.zCoord + side.offsetZ );
|
||||
if( blk.isSideSolid( this.worldObj, this.xCoord + side.offsetX, this.yCoord + side.offsetY, this.zCoord + side.offsetZ, side.getOpposite() ) )
|
||||
BlockPos p = pos.offset(side);
|
||||
|
||||
IBlockState blk = this.worldObj.getBlockState( p );
|
||||
if( blk.getBlock().isSideSolid( this.worldObj, p, side.getOpposite() ) )
|
||||
{
|
||||
ItemPaintBall ipb = (ItemPaintBall) type.getItem();
|
||||
|
||||
|
||||
@@ -19,17 +19,17 @@
|
||||
package appeng.tile.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import appeng.api.implementations.IPowerChannelState;
|
||||
import appeng.api.implementations.tiles.ICrystalGrowthAccelerator;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
@@ -44,7 +44,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
|
||||
|
||||
public TileQuartzGrowthAccelerator()
|
||||
{
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
|
||||
this.gridProxy.setFlags();
|
||||
this.gridProxy.setIdlePowerUsage( 8 );
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.COVERED;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation( ForgeDirection inForward, ForgeDirection inUp )
|
||||
public void setOrientation( EnumFacing inForward, EnumFacing inUp )
|
||||
{
|
||||
super.setOrientation( inForward, inUp );
|
||||
this.gridProxy.setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) );
|
||||
|
||||
@@ -19,22 +19,22 @@
|
||||
package appeng.tile.misc;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
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.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.config.Settings;
|
||||
@@ -61,6 +61,7 @@ import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.helpers.PlayerSecurityWrapper;
|
||||
@@ -112,9 +113,12 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@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 )
|
||||
{
|
||||
if( !this.configSlot.isEmpty() )
|
||||
{
|
||||
@@ -187,7 +191,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
||||
this.configSlot.readFromNBT( data, "config" );
|
||||
|
||||
NBTTagCompound storedItems = data.getCompoundTag( "storedItems" );
|
||||
for( Object key : storedItems.func_150296_c() )
|
||||
for( Object key : storedItems.getKeySet() )
|
||||
{
|
||||
NBTBase obj = storedItems.getTag( (String) key );
|
||||
if( obj instanceof NBTTagCompound )
|
||||
@@ -223,7 +227,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.SMART;
|
||||
}
|
||||
@@ -347,7 +351,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recolourBlock( ForgeDirection side, AEColor newPaintedColor, EntityPlayer who )
|
||||
public boolean recolourBlock( EnumFacing side, AEColor newPaintedColor, EntityPlayer who )
|
||||
{
|
||||
if( this.paintedColor == newPaintedColor )
|
||||
{
|
||||
|
||||
@@ -20,13 +20,11 @@ package appeng.tile.misc;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
@@ -34,6 +32,7 @@ import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.settings.TickRates;
|
||||
import appeng.helpers.Reflected;
|
||||
@@ -70,7 +69,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.COVERED;
|
||||
}
|
||||
@@ -141,13 +140,13 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, EnumFacing side )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide( ForgeDirection side )
|
||||
public int[] getAccessibleSlotsBySide( EnumFacing side )
|
||||
{
|
||||
return ACCESSIBLE_SLOTS;
|
||||
}
|
||||
@@ -290,7 +289,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
|
||||
|
||||
if ( this.hasWorldObj() )
|
||||
{
|
||||
Platform.notifyBlocksOfNeighbors( this.worldObj, this.xCoord, this.yCoord, this.zCoord );
|
||||
Platform.notifyBlocksOfNeighbors( this.worldObj, pos );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,21 +19,21 @@
|
||||
package appeng.tile.networking;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.parts.IFacadeContainer;
|
||||
import appeng.api.parts.IPart;
|
||||
@@ -41,6 +41,7 @@ import appeng.api.parts.LayerFlags;
|
||||
import appeng.api.parts.SelectedPart;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.helpers.AEMultiTile;
|
||||
@@ -88,8 +89,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
||||
if( newLV != this.oldLV )
|
||||
{
|
||||
this.oldLV = newLV;
|
||||
this.worldObj.func_147451_t( this.xCoord, this.yCoord, this.zCoord );
|
||||
// worldObj.updateAllLightTypes( xCoord, yCoord, zCoord );
|
||||
this.worldObj.checkLight( pos );
|
||||
}
|
||||
|
||||
this.updateTileSetting();
|
||||
@@ -105,7 +105,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
||||
{
|
||||
tcb = (TileCableBus) BlockCableBus.tesrTile.newInstance();
|
||||
tcb.copyFrom( this );
|
||||
this.getWorldObj().setTileEntity( this.xCoord, this.yCoord, this.zCoord, tcb );
|
||||
this.getWorld().setTileEntity( pos, tcb );
|
||||
}
|
||||
catch( Throwable ignored )
|
||||
{
|
||||
@@ -149,13 +149,13 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getGridNode( ForgeDirection dir )
|
||||
public IGridNode getGridNode( AEPartLocation dir )
|
||||
{
|
||||
return this.cb.getGridNode( dir );
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection side )
|
||||
public AECableType getCableConnectionType( AEPartLocation side )
|
||||
{
|
||||
return this.cb.getCableConnectionType( side );
|
||||
}
|
||||
@@ -179,7 +179,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
||||
if( newLV != this.oldLV )
|
||||
{
|
||||
this.oldLV = newLV;
|
||||
this.worldObj.func_147451_t( this.xCoord, this.yCoord, this.zCoord );
|
||||
this.worldObj.getLight( pos );
|
||||
// worldObj.updateAllLightTypes( xCoord, yCoord, zCoord );
|
||||
}
|
||||
|
||||
@@ -193,13 +193,13 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops( World w, int x, int y, int z, List drops )
|
||||
public void getDrops( World w, BlockPos pos, List drops )
|
||||
{
|
||||
this.cb.getDrops( drops );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNoDrops( World w, int x, int y, int z, List<ItemStack> drops )
|
||||
public void getNoDrops( World w, BlockPos pos, List<ItemStack> drops )
|
||||
{
|
||||
this.cb.getNoDrops( drops );
|
||||
}
|
||||
@@ -210,9 +210,9 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
||||
super.onReady();
|
||||
if( this.cb.isEmpty() )
|
||||
{
|
||||
if( this.worldObj.getTileEntity( this.xCoord, this.yCoord, this.zCoord ) == this )
|
||||
if( this.worldObj.getTileEntity( pos ) == this )
|
||||
{
|
||||
this.worldObj.func_147480_a( this.xCoord, this.yCoord, this.zCoord, true );
|
||||
this.worldObj.destroyBlock( pos, true );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -234,25 +234,31 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAddPart( ItemStack is, ForgeDirection side )
|
||||
public boolean canAddPart( ItemStack is, AEPartLocation side )
|
||||
{
|
||||
return this.cb.canAddPart( is, side );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection addPart( ItemStack is, ForgeDirection side, EntityPlayer player )
|
||||
public AEPartLocation addPart( ItemStack is, AEPartLocation side, EntityPlayer player )
|
||||
{
|
||||
return this.cb.addPart( is, side, player );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPart getPart( ForgeDirection side )
|
||||
public IPart getPart( AEPartLocation side )
|
||||
{
|
||||
return this.cb.getPart( side );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePart( ForgeDirection side, boolean suppressUpdate )
|
||||
public IPart getPart( EnumFacing side )
|
||||
{
|
||||
return this.cb.getPart( side );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePart( AEPartLocation side, boolean suppressUpdate )
|
||||
{
|
||||
this.cb.removePart( side, suppressUpdate );
|
||||
}
|
||||
@@ -276,11 +282,13 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlocked( ForgeDirection side )
|
||||
public boolean isBlocked( EnumFacing side )
|
||||
{
|
||||
return !this.ImmibisMicroblocks_isSideOpen( side.ordinal() );
|
||||
} @Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, int x, int y, int z, Entity e, boolean visual )
|
||||
return !this.ImmibisMicroblocks_isSideOpen( side );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, BlockPos pos, Entity e, boolean visual )
|
||||
{
|
||||
return this.cb.getSelectedBoundingBoxesFromPool( false, true, e, visual );
|
||||
}
|
||||
@@ -304,7 +312,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRedstone( ForgeDirection side )
|
||||
public boolean hasRedstone( AEPartLocation side )
|
||||
{
|
||||
return this.cb.hasRedstone( side );
|
||||
}
|
||||
@@ -333,22 +341,29 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
||||
}
|
||||
}
|
||||
|
||||
this.getWorldObj().setBlock( this.xCoord, this.yCoord, this.zCoord, Platform.AIR_BLOCK );
|
||||
} @Override
|
||||
public void addCollidingBlockToList( World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e )
|
||||
this.getWorld().setBlockToAir( pos );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollidingBlockToList(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
AxisAlignedBB bb,
|
||||
List<AxisAlignedBB> out,
|
||||
Entity e )
|
||||
{
|
||||
for( AxisAlignedBB bx : this.getSelectedBoundingBoxesFromPool( w, x, y, z, e, false ) )
|
||||
for( AxisAlignedBB bx : this.getSelectedBoundingBoxesFromPool( w, pos, e, false ) )
|
||||
{
|
||||
out.add( AxisAlignedBB.getBoundingBox( bx.minX, bx.minY, bx.minZ, bx.maxX, bx.maxY, bx.maxZ ) );
|
||||
out.add( AxisAlignedBB.fromBounds( bx.minX, bx.minY, bx.minZ, bx.maxX, bx.maxY, bx.maxZ ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyNeighbors()
|
||||
{
|
||||
if( this.worldObj != null && this.worldObj.blockExists( this.xCoord, this.yCoord, this.zCoord ) && !CableBusContainer.isLoading() )
|
||||
if( this.worldObj != null && this.worldObj.isBlockLoaded( pos ) && !CableBusContainer.isLoading() )
|
||||
{
|
||||
Platform.notifyBlocksOfNeighbors( this.worldObj, this.xCoord, this.yCoord, this.zCoord );
|
||||
Platform.notifyBlocksOfNeighbors( this.worldObj, pos );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,7 +373,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
||||
return this.cb.isInWorld();
|
||||
}
|
||||
|
||||
public boolean ImmibisMicroblocks_isSideOpen( int side )
|
||||
public boolean ImmibisMicroblocks_isSideOpen( EnumFacing side )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -369,7 +384,10 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recolourBlock( ForgeDirection side, AEColor colour, EntityPlayer who )
|
||||
public boolean recolourBlock(
|
||||
EnumFacing side,
|
||||
AEColor colour,
|
||||
EntityPlayer who )
|
||||
{
|
||||
return this.cb.recolourBlock( side, colour, who );
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class TileCableBusTESR extends TileCableBus
|
||||
{
|
||||
tcb = (TileCableBus) BlockCableBus.noTesrTile.newInstance();
|
||||
tcb.copyFrom( this );
|
||||
this.getWorldObj().setTileEntity( this.xCoord, this.yCoord, this.zCoord, tcb );
|
||||
this.getWorld().setTileEntity( pos, tcb );
|
||||
}
|
||||
catch( Throwable ignored )
|
||||
{
|
||||
|
||||
@@ -23,8 +23,7 @@ import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.events.MENetworkControllerChange;
|
||||
@@ -34,6 +33,9 @@ import appeng.api.networking.events.MENetworkPowerStorage;
|
||||
import appeng.api.networking.events.MENetworkPowerStorage.PowerEventType;
|
||||
import appeng.api.networking.pathing.ControllerState;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.networking.BlockController;
|
||||
import appeng.block.networking.BlockController.ControllerBlockState;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.tile.grid.AENetworkPowerTile;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
@@ -56,7 +58,7 @@ public class TileController extends AENetworkPowerTile
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.DENSE;
|
||||
}
|
||||
@@ -70,9 +72,9 @@ public class TileController extends AENetworkPowerTile
|
||||
|
||||
public void onNeighborChange( boolean force )
|
||||
{
|
||||
boolean xx = this.worldObj.getTileEntity( this.xCoord - 1, this.yCoord, this.zCoord ) instanceof TileController && this.worldObj.getTileEntity( this.xCoord + 1, this.yCoord, this.zCoord ) instanceof TileController;
|
||||
boolean yy = this.worldObj.getTileEntity( this.xCoord, this.yCoord - 1, this.zCoord ) instanceof TileController && this.worldObj.getTileEntity( this.xCoord, this.yCoord + 1, this.zCoord ) instanceof TileController;
|
||||
boolean zz = this.worldObj.getTileEntity( this.xCoord, this.yCoord, this.zCoord - 1 ) instanceof TileController && this.worldObj.getTileEntity( this.xCoord, this.yCoord, this.zCoord + 1 ) instanceof TileController;
|
||||
boolean xx = this.worldObj.getTileEntity( pos.offset( EnumFacing.EAST ) ) instanceof TileController && this.worldObj.getTileEntity( pos.offset( EnumFacing.WEST ) ) instanceof TileController;
|
||||
boolean yy = this.worldObj.getTileEntity( pos.offset( EnumFacing.UP ) ) instanceof TileController && this.worldObj.getTileEntity( pos.offset( EnumFacing.DOWN ) ) instanceof TileController;
|
||||
boolean zz = this.worldObj.getTileEntity( pos.offset( EnumFacing.NORTH ) ) instanceof TileController && this.worldObj.getTileEntity( pos.offset( EnumFacing.SOUTH ) ) instanceof TileController;
|
||||
|
||||
// int meta = world.getBlockMetadata( xCoord, yCoord, zCoord );
|
||||
// boolean hasPower = meta > 0;
|
||||
@@ -86,11 +88,11 @@ public class TileController extends AENetworkPowerTile
|
||||
{
|
||||
if( this.isValid )
|
||||
{
|
||||
this.gridProxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
|
||||
this.gridProxy.setValidSides( EnumSet.allOf( EnumFacing.class ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,26 +106,26 @@ public class TileController extends AENetworkPowerTile
|
||||
return;
|
||||
}
|
||||
|
||||
int meta = 0;
|
||||
|
||||
ControllerBlockState metaState = ControllerBlockState.OFFLINE;
|
||||
|
||||
try
|
||||
{
|
||||
if( this.gridProxy.getEnergy().isNetworkPowered() )
|
||||
{
|
||||
meta = 1;
|
||||
metaState = ControllerBlockState.ONLINE;
|
||||
|
||||
if( this.gridProxy.getPath().getControllerState() == ControllerState.CONTROLLER_CONFLICT )
|
||||
{
|
||||
meta = 2;
|
||||
metaState = ControllerBlockState.CONFLICTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
{
|
||||
meta = 0;
|
||||
metaState = ControllerBlockState.OFFLINE;
|
||||
}
|
||||
|
||||
this.worldObj.setBlockMetadataWithNotify( this.xCoord, this.yCoord, this.zCoord, meta, 2 );
|
||||
this.worldObj.setBlockState( pos, worldObj.getBlockState( pos ).withProperty( BlockController.CONTROLLER_STATE, metaState ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -197,7 +199,7 @@ public class TileController extends AENetworkPowerTile
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide( ForgeDirection side )
|
||||
public int[] getAccessibleSlotsBySide( EnumFacing whichSide )
|
||||
{
|
||||
return this.ACCESSIBLE_SLOTS_BY_SIDE;
|
||||
}
|
||||
|
||||
@@ -19,13 +19,12 @@
|
||||
package appeng.tile.networking;
|
||||
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.networking.energy.IAEPowerStorage;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.tile.grid.AENetworkTile;
|
||||
|
||||
|
||||
@@ -38,7 +37,7 @@ public class TileCreativeEnergyCell extends AENetworkTile implements IAEPowerSto
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.COVERED;
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@ package appeng.tile.networking;
|
||||
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.config.Actionable;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.tile.grid.AENetworkPowerTile;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
@@ -62,7 +62,7 @@ public class TileEnergyAcceptor extends AENetworkPowerTile
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.COVERED;
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public class TileEnergyAcceptor extends AENetworkPowerTile
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide( ForgeDirection side )
|
||||
public int[] getAccessibleSlotsBySide( EnumFacing side )
|
||||
{
|
||||
return this.sides;
|
||||
}
|
||||
|
||||
@@ -20,8 +20,6 @@ package appeng.tile.networking;
|
||||
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
@@ -29,6 +27,8 @@ import appeng.api.networking.energy.IAEPowerStorage;
|
||||
import appeng.api.networking.events.MENetworkPowerStorage;
|
||||
import appeng.api.networking.events.MENetworkPowerStorage.PowerEventType;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.networking.BlockEnergyCell;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
@@ -39,6 +39,7 @@ import appeng.util.SettingsFrom;
|
||||
public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
|
||||
{
|
||||
|
||||
|
||||
protected double internalCurrentPower = 0.0;
|
||||
protected double internalMaxPower = 200000.0;
|
||||
|
||||
@@ -50,7 +51,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.COVERED;
|
||||
}
|
||||
@@ -59,7 +60,8 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
|
||||
public void onReady()
|
||||
{
|
||||
super.onReady();
|
||||
this.currentMeta = (byte) this.worldObj.getBlockMetadata( this.xCoord, this.yCoord, this.zCoord );
|
||||
int value = ( Integer ) this.worldObj.getBlockState( pos ).getValue( BlockEnergyCell.ENERGY_STORAGE );
|
||||
currentMeta = (byte)value;
|
||||
this.changePowerLevel();
|
||||
}
|
||||
|
||||
@@ -84,7 +86,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
|
||||
if( this.currentMeta != boundMetadata )
|
||||
{
|
||||
this.currentMeta = boundMetadata;
|
||||
this.worldObj.setBlockMetadataWithNotify( this.xCoord, this.yCoord, this.zCoord, this.currentMeta, 2 );
|
||||
this.worldObj.setBlockState( pos, this.worldObj.getBlockState( pos ).withProperty( BlockEnergyCell.ENERGY_STORAGE, (int)boundMetadata ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,14 +19,13 @@
|
||||
package appeng.tile.networking;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.IPowerChannelState;
|
||||
import appeng.api.implementations.tiles.IWirelessAccessPoint;
|
||||
@@ -36,6 +35,7 @@ import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.me.GridAccessException;
|
||||
@@ -61,11 +61,11 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
|
||||
public TileWireless()
|
||||
{
|
||||
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation( ForgeDirection inForward, ForgeDirection inUp )
|
||||
public void setOrientation( EnumFacing inForward, EnumFacing inUp )
|
||||
{
|
||||
super.setOrientation( inForward, inUp );
|
||||
this.gridProxy.setValidSides( EnumSet.of( this.getForward().getOpposite() ) );
|
||||
@@ -118,7 +118,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.SMART;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide( ForgeDirection side )
|
||||
public int[] getAccessibleSlotsBySide( EnumFacing side )
|
||||
{
|
||||
return this.sides;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.tile.powersink;
|
||||
|
||||
|
||||
public abstract class AEBasePoweredTile extends MekJoules
|
||||
public abstract class AEBasePoweredTile extends AERootPoweredTile // extends MekJoules
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -22,8 +22,7 @@ package appeng.tile.powersink;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
@@ -46,14 +45,14 @@ public abstract class AERootPoweredTile extends AEBaseInvTile implements IAEPowe
|
||||
protected AccessRestriction internalPowerFlow = AccessRestriction.READ_WRITE;
|
||||
// the current power buffer.
|
||||
protected double internalCurrentPower = 0;
|
||||
private EnumSet<ForgeDirection> internalPowerSides = EnumSet.allOf( ForgeDirection.class );
|
||||
private EnumSet<EnumFacing> internalPowerSides = EnumSet.allOf( EnumFacing.class );
|
||||
|
||||
protected EnumSet<ForgeDirection> getPowerSides()
|
||||
protected EnumSet<EnumFacing> getPowerSides()
|
||||
{
|
||||
return this.internalPowerSides.clone();
|
||||
}
|
||||
|
||||
protected void setPowerSides( EnumSet<ForgeDirection> sides )
|
||||
protected void setPowerSides( EnumSet<EnumFacing> sides )
|
||||
{
|
||||
this.internalPowerSides = sides;
|
||||
// trigger re-calc!
|
||||
|
||||
@@ -22,11 +22,9 @@ package appeng.tile.powersink;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.util.ForgeDirection;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IIC2;
|
||||
|
||||
@@ -19,11 +19,9 @@
|
||||
package appeng.tile.powersink;
|
||||
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import mekanism.api.energy.IStrictEnergyAcceptor;
|
||||
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.util.ForgeDirection;
|
||||
import appeng.transformer.annotations.Integration.Interface;
|
||||
|
||||
|
||||
|
||||
@@ -19,11 +19,9 @@
|
||||
package appeng.tile.powersink;
|
||||
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.util.ForgeDirection;
|
||||
import appeng.transformer.annotations.Integration.Interface;
|
||||
|
||||
|
||||
|
||||
@@ -21,12 +21,10 @@ package appeng.tile.powersink;
|
||||
|
||||
import appeng.transformer.annotations.Integration;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import Reika.RotaryCraft.API.Interfaces.Transducerable;
|
||||
import Reika.RotaryCraft.API.Power.AdvancedShaftPowerReceiver;
|
||||
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.util.ForgeDirection;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.transformer.annotations.Integration.Interface;
|
||||
|
||||
@@ -28,13 +28,13 @@ public abstract class UniversalElectricity extends ThermalExpansion implements I
|
||||
{
|
||||
|
||||
@Override
|
||||
public final boolean canConnect(ForgeDirection direction)
|
||||
public final boolean canConnect(AEPartLocation direction)
|
||||
{
|
||||
return internalCanAcceptPower && getPowerSides().contains( direction );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final float receiveElectricity(ForgeDirection from, ElectricityPack receive, boolean doReceive)
|
||||
public final float receiveElectricity(AEPartLocation from, ElectricityPack receive, boolean doReceive)
|
||||
{
|
||||
float accepted = 0;
|
||||
double receivedPower = receive.getWatts();
|
||||
@@ -56,7 +56,7 @@ public abstract class UniversalElectricity extends ThermalExpansion implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
public final float getRequest(ForgeDirection direction)
|
||||
public final float getRequest(AEPartLocation direction)
|
||||
{
|
||||
return (float) getExternalPowerDemand( PowerUnits.KJ );
|
||||
}
|
||||
@@ -68,13 +68,13 @@ public abstract class UniversalElectricity extends ThermalExpansion implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ElectricityPack provideElectricity(ForgeDirection from, ElectricityPack request, boolean doProvide)
|
||||
public final ElectricityPack provideElectricity(AEPartLocation from, ElectricityPack request, boolean doProvide)
|
||||
{
|
||||
return null; // cannot be dis-charged
|
||||
}
|
||||
|
||||
@Override
|
||||
public final float getProvide(ForgeDirection direction)
|
||||
public final float getProvide(AEPartLocation direction)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -19,25 +19,24 @@
|
||||
package appeng.tile.qnb;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.server.gui.IUpdatePlayerListBox;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cluster.IAECluster;
|
||||
@@ -51,8 +50,10 @@ import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||
|
||||
public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock, IUpdatePlayerListBox
|
||||
{
|
||||
private static final IBlockDefinition RING_DEFINITION = AEApi.instance().definitions().blocks().quantumRing();
|
||||
public final byte corner = 16;
|
||||
@@ -70,7 +71,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||
|
||||
public TileQuantumBridge()
|
||||
{
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
|
||||
this.gridProxy.setFlags( GridFlags.DENSE_CAPACITY );
|
||||
this.gridProxy.setIdlePowerUsage( 22 );
|
||||
this.internalInventory.setMaxStackSize( 1 );
|
||||
@@ -133,7 +134,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide( ForgeDirection side )
|
||||
public int[] getAccessibleSlotsBySide( EnumFacing side )
|
||||
{
|
||||
if( this.isCenter() )
|
||||
{
|
||||
@@ -208,7 +209,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||
|
||||
if( affectWorld )
|
||||
{
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,11 +239,16 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||
|
||||
if( this.isCorner() || this.isCenter() )
|
||||
{
|
||||
this.gridProxy.setValidSides( this.getConnections() );
|
||||
EnumSet<EnumFacing> sides = EnumSet.noneOf( EnumFacing.class );
|
||||
for ( AEPartLocation dir : this.getConnections() )
|
||||
if ( dir != AEPartLocation.INTERNAL )
|
||||
sides.add( dir.getFacing());
|
||||
|
||||
this.gridProxy.setValidSides( sides );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.gridProxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
|
||||
this.gridProxy.setValidSides( EnumSet.allOf( EnumFacing.class ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -252,13 +258,13 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||
return ( this.constructed & this.corner ) == this.corner && this.constructed != -1;
|
||||
}
|
||||
|
||||
public EnumSet<ForgeDirection> getConnections()
|
||||
public EnumSet<AEPartLocation> getConnections()
|
||||
{
|
||||
EnumSet<ForgeDirection> set = EnumSet.noneOf( ForgeDirection.class );
|
||||
EnumSet<AEPartLocation> set = EnumSet.noneOf( AEPartLocation.class );
|
||||
|
||||
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
|
||||
for( AEPartLocation d : AEPartLocation.values() )
|
||||
{
|
||||
TileEntity te = this.worldObj.getTileEntity( this.xCoord + d.offsetX, this.yCoord + d.offsetY, this.zCoord + d.offsetZ );
|
||||
TileEntity te = this.worldObj.getTileEntity( d == AEPartLocation.INTERNAL ? pos : pos.offset( d.getFacing() ) );
|
||||
if( te instanceof TileQuantumBridge )
|
||||
{
|
||||
set.add( d );
|
||||
@@ -307,7 +313,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.DENSE;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,7 @@ import java.util.concurrent.Callable;
|
||||
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.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.config.YesNo;
|
||||
@@ -38,6 +37,7 @@ import appeng.api.networking.events.MENetworkEvent;
|
||||
import appeng.api.networking.events.MENetworkSpatialEvent;
|
||||
import appeng.api.networking.spatial.ISpatialCache;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.me.cache.SpatialPylonCache;
|
||||
@@ -88,7 +88,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements Callable
|
||||
|
||||
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;
|
||||
@@ -159,7 +159,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements Callable
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.SMART;
|
||||
}
|
||||
@@ -189,19 +189,19 @@ public class TileSpatialIOPort extends AENetworkInvTile implements Callable
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, int side )
|
||||
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, EnumFacing side )
|
||||
{
|
||||
return this.isItemValidForSlot( slotIndex, insertingItem );
|
||||
}
|
||||
|
||||
@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 )
|
||||
{
|
||||
return this.sides;
|
||||
}
|
||||
|
||||
@@ -19,12 +19,11 @@
|
||||
package appeng.tile.spatial;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
@@ -63,7 +62,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
|
||||
{
|
||||
this.gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL, GridFlags.MULTIBLOCK );
|
||||
this.gridProxy.setIdlePowerUsage( 0.5 );
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||
this.gridProxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,7 +122,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
|
||||
public void updateStatus( SpatialPylonCluster c )
|
||||
{
|
||||
this.cluster = c;
|
||||
this.gridProxy.setValidSides( c == null ? EnumSet.noneOf( ForgeDirection.class ) : EnumSet.allOf( ForgeDirection.class ) );
|
||||
this.gridProxy.setValidSides( c == null ? EnumSet.noneOf( EnumFacing.class ) : EnumSet.allOf( EnumFacing.class ) );
|
||||
this.recalculateDisplay();
|
||||
}
|
||||
|
||||
@@ -196,7 +195,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
|
||||
if( hasLight != this.didHaveLight )
|
||||
{
|
||||
this.didHaveLight = hasLight;
|
||||
this.worldObj.func_147451_t( this.xCoord, this.yCoord, this.zCoord );
|
||||
this.worldObj.checkLight( pos );
|
||||
// worldObj.updateAllLightTypes( xCoord, yCoord, zCoord );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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