Most of the 1.8 Port.

This commit is contained in:
AlgorithmX2
2015-06-15 19:44:59 -05:00
parent 17465e68e8
commit 38afde724b
824 changed files with 12120 additions and 9158 deletions
+25 -25
View File
@@ -19,15 +19,15 @@
package appeng.parts;
import io.netty.buffer.ByteBuf;
import java.io.IOException;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -36,14 +36,12 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
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 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.api.AEApi;
import appeng.api.config.Upgrades;
import appeng.api.definitions.IDefinitions;
@@ -57,12 +55,13 @@ import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.parts.ISimplifiedBundle;
import appeng.api.parts.PartItemStack;
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.client.render.IRenderHelper;
import appeng.helpers.ICustomNameObject;
import appeng.helpers.IPriorityHost;
import appeng.me.helpers.AENetworkProxy;
@@ -78,16 +77,15 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
protected final AENetworkProxy proxy;
protected final ItemStack is;
protected ISimplifiedBundle renderCache = null;
protected TileEntity tile = null;
protected IPartHost host = null;
protected ForgeDirection side = null;
protected AEPartLocation side = null;
public AEBasePart( ItemStack is )
{
this.is = is;
this.proxy = new AENetworkProxy( this, "part", is, this instanceof PartCable );
this.proxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.proxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
}
public IPartHost getHost()
@@ -96,13 +94,13 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
}
@Override
public IGridNode getGridNode( ForgeDirection dir )
public IGridNode getGridNode( AEPartLocation dir )
{
return this.proxy.getNode();
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( AEPartLocation dir )
{
return AECableType.GLASS;
}
@@ -115,7 +113,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
List<ItemStack> items = new ArrayList<ItemStack>();
items.add( this.is.copy() );
this.host.removePart( this.side, false );
Platform.spawnDrops( this.tile.getWorldObj(), this.tile.xCoord, this.tile.yCoord, this.tile.zCoord, items );
Platform.spawnDrops( this.tile.getWorld(), this.tile.getPos(), items );
this.is.stackSize = 0;
}
}
@@ -141,7 +139,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
return 0;
} @Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
{
rh.setBounds( 1, 1, 1, 15, 15, 15 );
rh.renderInventoryBox( renderer );
@@ -189,12 +187,14 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
public String getCustomName()
{
return this.is.getDisplayName();
} @Override
}
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
rh.setBounds( 1, 1, 1, 15, 15, 15 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
}
@Override
@@ -214,7 +214,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
@Override
@SideOnly( Side.CLIENT )
public void renderDynamic( double x, double y, double z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderDynamic( double x, double y, double z, IPartRenderHelper rh, IRenderHelper renderer )
{
}
@@ -310,7 +310,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
}
@Override
public void setPartHostInfo( ForgeDirection side, IPartHost host, TileEntity tile )
public void setPartHostInfo( AEPartLocation side, IPartHost host, TileEntity tile )
{
this.side = side;
this.tile = tile;
@@ -325,7 +325,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
@Override
@SideOnly( Side.CLIENT )
public void randomDisplayTick( World world, int x, int y, int z, Random r )
public void randomDisplayTick( World world, BlockPos pos, Random r )
{
}
@@ -522,7 +522,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
}
@Override
public void onPlacement( EntityPlayer player, ItemStack held, ForgeDirection side )
public void onPlacement( EntityPlayer player, ItemStack held, AEPartLocation side )
{
this.proxy.setOwner( player );
}
@@ -541,7 +541,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
@Override
@SideOnly( Side.CLIENT )
public IIcon getBreakingTexture()
public TextureAtlasSprite getBreakingTexture(IRenderHelper renderer)
{
return null;
}
@@ -23,9 +23,9 @@ import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.util.AEPartLocation;
public class BusCollisionHelper implements IPartCollisionHelper
@@ -33,14 +33,14 @@ public class BusCollisionHelper implements IPartCollisionHelper
final List<AxisAlignedBB> boxes;
private final ForgeDirection x;
private final ForgeDirection y;
private final ForgeDirection z;
private final EnumFacing x;
private final EnumFacing y;
private final EnumFacing z;
private final Entity entity;
private final boolean isVisual;
public BusCollisionHelper( List<AxisAlignedBB> boxes, ForgeDirection x, ForgeDirection y, ForgeDirection z, Entity e, boolean visual )
public BusCollisionHelper( List<AxisAlignedBB> boxes, EnumFacing x, EnumFacing y, EnumFacing z, Entity e, boolean visual )
{
this.boxes = boxes;
this.x = x;
@@ -50,7 +50,7 @@ public class BusCollisionHelper implements IPartCollisionHelper
this.isVisual = visual;
}
public BusCollisionHelper( List<AxisAlignedBB> boxes, ForgeDirection s, Entity e, boolean visual )
public BusCollisionHelper( List<AxisAlignedBB> boxes, AEPartLocation s, Entity e, boolean visual )
{
this.boxes = boxes;
this.entity = e;
@@ -59,40 +59,40 @@ public class BusCollisionHelper implements IPartCollisionHelper
switch( s )
{
case DOWN:
this.x = ForgeDirection.EAST;
this.y = ForgeDirection.NORTH;
this.z = ForgeDirection.DOWN;
this.x = EnumFacing.EAST;
this.y = EnumFacing.NORTH;
this.z = EnumFacing.DOWN;
break;
case UP:
this.x = ForgeDirection.EAST;
this.y = ForgeDirection.SOUTH;
this.z = ForgeDirection.UP;
this.x = EnumFacing.EAST;
this.y = EnumFacing.SOUTH;
this.z = EnumFacing.UP;
break;
case EAST:
this.x = ForgeDirection.SOUTH;
this.y = ForgeDirection.UP;
this.z = ForgeDirection.EAST;
this.x = EnumFacing.SOUTH;
this.y = EnumFacing.UP;
this.z = EnumFacing.EAST;
break;
case WEST:
this.x = ForgeDirection.NORTH;
this.y = ForgeDirection.UP;
this.z = ForgeDirection.WEST;
this.x = EnumFacing.NORTH;
this.y = EnumFacing.UP;
this.z = EnumFacing.WEST;
break;
case NORTH:
this.x = ForgeDirection.WEST;
this.y = ForgeDirection.UP;
this.z = ForgeDirection.NORTH;
this.x = EnumFacing.WEST;
this.y = EnumFacing.UP;
this.z = EnumFacing.NORTH;
break;
case SOUTH:
this.x = ForgeDirection.EAST;
this.y = ForgeDirection.UP;
this.z = ForgeDirection.SOUTH;
this.x = EnumFacing.EAST;
this.y = EnumFacing.UP;
this.z = EnumFacing.SOUTH;
break;
case UNKNOWN:
case INTERNAL:
default:
this.x = ForgeDirection.EAST;
this.y = ForgeDirection.UP;
this.z = ForgeDirection.SOUTH;
this.x = EnumFacing.EAST;
this.y = EnumFacing.UP;
this.z = EnumFacing.SOUTH;
break;
}
}
@@ -115,27 +115,27 @@ public class BusCollisionHelper implements IPartCollisionHelper
maxY /= 16.0;
maxZ /= 16.0;
double aX = minX * this.x.offsetX + minY * this.y.offsetX + minZ * this.z.offsetX;
double aY = minX * this.x.offsetY + minY * this.y.offsetY + minZ * this.z.offsetY;
double aZ = minX * this.x.offsetZ + minY * this.y.offsetZ + minZ * this.z.offsetZ;
double aX = minX * this.x.getFrontOffsetX() + minY * this.y.getFrontOffsetX() + minZ * this.z.getFrontOffsetX();
double aY = minX * this.x.getFrontOffsetY() + minY * this.y.getFrontOffsetY() + minZ * this.z.getFrontOffsetY();
double aZ = minX * this.x.getFrontOffsetZ() + minY * this.y.getFrontOffsetZ() + minZ * this.z.getFrontOffsetZ();
double bX = maxX * this.x.offsetX + maxY * this.y.offsetX + maxZ * this.z.offsetX;
double bY = maxX * this.x.offsetY + maxY * this.y.offsetY + maxZ * this.z.offsetY;
double bZ = maxX * this.x.offsetZ + maxY * this.y.offsetZ + maxZ * this.z.offsetZ;
double bX = maxX * this.x.getFrontOffsetX() + maxY * this.y.getFrontOffsetX() + maxZ * this.z.getFrontOffsetX();
double bY = maxX * this.x.getFrontOffsetY() + maxY * this.y.getFrontOffsetY() + maxZ * this.z.getFrontOffsetY();
double bZ = maxX * this.x.getFrontOffsetZ() + maxY * this.y.getFrontOffsetZ() + maxZ * this.z.getFrontOffsetZ();
if( this.x.offsetX + this.y.offsetX + this.z.offsetX < 0 )
if( this.x.getFrontOffsetX() + this.y.getFrontOffsetX() + this.z.getFrontOffsetX() < 0 )
{
aX += 1;
bX += 1;
}
if( this.x.offsetY + this.y.offsetY + this.z.offsetY < 0 )
if( this.x.getFrontOffsetY() + this.y.getFrontOffsetY() + this.z.getFrontOffsetY() < 0 )
{
aY += 1;
bY += 1;
}
if( this.x.offsetZ + this.y.offsetZ + this.z.offsetZ < 0 )
if( this.x.getFrontOffsetZ() + this.y.getFrontOffsetZ() + this.z.getFrontOffsetZ() < 0 )
{
aZ += 1;
bZ += 1;
@@ -148,23 +148,23 @@ public class BusCollisionHelper implements IPartCollisionHelper
maxY = Math.max( aY, bY );
maxZ = Math.max( aZ, bZ );
this.boxes.add( AxisAlignedBB.getBoundingBox( minX, minY, minZ, maxX, maxY, maxZ ) );
this.boxes.add( AxisAlignedBB.fromBounds( minX, minY, minZ, maxX, maxY, maxZ ) );
}
@Override
public ForgeDirection getWorldX()
public EnumFacing getWorldX()
{
return this.x;
}
@Override
public ForgeDirection getWorldY()
public EnumFacing getWorldY()
{
return this.y;
}
@Override
public ForgeDirection getWorldZ()
public EnumFacing getWorldZ()
{
return this.z;
}
@@ -19,6 +19,8 @@
package appeng.parts;
import io.netty.buffer.ByteBuf;
import java.io.IOException;
import java.util.EnumSet;
import java.util.LinkedList;
@@ -26,8 +28,6 @@ import java.util.List;
import java.util.Random;
import java.util.Set;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@@ -36,13 +36,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
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 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.api.AEApi;
import appeng.api.config.YesNo;
import appeng.api.exceptions.FailedConnection;
@@ -60,6 +59,7 @@ import appeng.api.parts.PartItemStack;
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.client.render.CableRenderHelper;
import appeng.core.AELog;
@@ -103,15 +103,15 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
{
IPart[] newSides = new IPart[6];
newSides[ForgeDirection.UP.ordinal()] = this.getSide( ForgeDirection.UP );
newSides[ForgeDirection.DOWN.ordinal()] = this.getSide( ForgeDirection.DOWN );
newSides[AEPartLocation.UP.ordinal()] = this.getSide( AEPartLocation.UP );
newSides[AEPartLocation.DOWN.ordinal()] = this.getSide( AEPartLocation.DOWN );
newSides[ForgeDirection.EAST.ordinal()] = this.getSide( ForgeDirection.NORTH );
newSides[ForgeDirection.SOUTH.ordinal()] = this.getSide( ForgeDirection.EAST );
newSides[ForgeDirection.WEST.ordinal()] = this.getSide( ForgeDirection.SOUTH );
newSides[ForgeDirection.NORTH.ordinal()] = this.getSide( ForgeDirection.WEST );
newSides[AEPartLocation.EAST.ordinal()] = this.getSide( AEPartLocation.NORTH );
newSides[AEPartLocation.SOUTH.ordinal()] = this.getSide( AEPartLocation.EAST );
newSides[AEPartLocation.WEST.ordinal()] = this.getSide( AEPartLocation.SOUTH );
newSides[AEPartLocation.NORTH.ordinal()] = this.getSide( AEPartLocation.WEST );
for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
for( AEPartLocation dir : AEPartLocation.SIDE_LOCATIONS )
{
this.setSide( dir, newSides[dir.ordinal()] );
}
@@ -126,7 +126,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public boolean canAddPart( ItemStack is, ForgeDirection side )
public boolean canAddPart( ItemStack is, AEPartLocation side )
{
if( PartPlacement.isFacade( is, side ) != null )
{
@@ -146,7 +146,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
if( bp instanceof IPartCable )
{
boolean canPlace = true;
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
for( AEPartLocation d : AEPartLocation.SIDE_LOCATIONS )
{
if( this.getPart( d ) != null && !this.getPart( d ).canBePlacedOn( ( (IPartCable) bp ).supportsBuses() ) )
{
@@ -159,11 +159,11 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
return false;
}
return this.getPart( ForgeDirection.UNKNOWN ) == null;
return this.getPart( AEPartLocation.INTERNAL ) == null;
}
else if( !( bp instanceof IPartCable ) && side != ForgeDirection.UNKNOWN )
else if( !( bp instanceof IPartCable ) && side != AEPartLocation.INTERNAL )
{
IPart cable = this.getPart( ForgeDirection.UNKNOWN );
IPart cable = this.getPart( AEPartLocation.INTERNAL );
if( cable != null && !bp.canBePlacedOn( ( (IPartCable) cable ).supportsBuses() ) )
{
return false;
@@ -177,7 +177,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public ForgeDirection addPart( ItemStack is, ForgeDirection side, EntityPlayer player )
public AEPartLocation addPart( ItemStack is, AEPartLocation side, EntityPlayer player )
{
if( this.canAddPart( is, side ) )
{
@@ -192,7 +192,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
if( bp instanceof IPartCable )
{
boolean canPlace = true;
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
for( AEPartLocation d : AEPartLocation.SIDE_LOCATIONS )
{
if( this.getPart( d ) != null && !this.getPart( d ).canBePlacedOn( ( (IPartCable) bp ).supportsBuses() ) )
{
@@ -205,13 +205,13 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
return null;
}
if( this.getPart( ForgeDirection.UNKNOWN ) != null )
if( this.getPart( AEPartLocation.INTERNAL ) != null )
{
return null;
}
this.setCenter( (IPartCable) bp );
bp.setPartHostInfo( ForgeDirection.UNKNOWN, this, this.tcb.getTile() );
bp.setPartHostInfo( AEPartLocation.INTERNAL, this, this.tcb.getTile() );
if( player != null )
{
@@ -226,7 +226,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
IGridNode cn = this.getCenter().getGridNode();
if( cn != null )
{
for( ForgeDirection ins : ForgeDirection.VALID_DIRECTIONS )
for( AEPartLocation ins : AEPartLocation.SIDE_LOCATIONS )
{
IPart sbp = this.getPart( ins );
if( sbp != null )
@@ -236,7 +236,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
{
try
{
new GridConnection( cn, sn, ForgeDirection.UNKNOWN );
new GridConnection( cn, sn, AEPartLocation.INTERNAL );
}
catch( FailedConnection e )
{
@@ -255,11 +255,11 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
this.markForUpdate();
this.markForSave();
this.partChanged();
return ForgeDirection.UNKNOWN;
return AEPartLocation.INTERNAL;
}
else if( bp != null && !( bp instanceof IPartCable ) && side != ForgeDirection.UNKNOWN )
else if( bp != null && !( bp instanceof IPartCable ) && side != AEPartLocation.INTERNAL )
{
IPart cable = this.getPart( ForgeDirection.UNKNOWN );
IPart cable = this.getPart( AEPartLocation.INTERNAL );
if( cable != null && !bp.canBePlacedOn( ( (IPartCable) cable ).supportsBuses() ) )
{
return null;
@@ -287,7 +287,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
{
try
{
new GridConnection( cn, sn, ForgeDirection.UNKNOWN );
new GridConnection( cn, sn, AEPartLocation.INTERNAL );
}
catch( FailedConnection e )
{
@@ -313,19 +313,25 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public IPart getPart( ForgeDirection side )
public IPart getPart( AEPartLocation partLocation )
{
if( side == ForgeDirection.UNKNOWN )
if( partLocation == AEPartLocation.INTERNAL )
{
return this.getCenter();
}
return this.getSide( side );
return this.getSide( partLocation );
}
@Override
public void removePart( ForgeDirection side, boolean suppressUpdate )
public IPart getPart( EnumFacing side )
{
if( side == ForgeDirection.UNKNOWN )
return this.getSide( AEPartLocation.fromFacing( side ) );
}
@Override
public void removePart( AEPartLocation side, boolean suppressUpdate )
{
if( side == AEPartLocation.INTERNAL )
{
if( this.getCenter() != null )
{
@@ -388,7 +394,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public boolean isBlocked( ForgeDirection side )
public boolean isBlocked( EnumFacing side )
{
return this.tcb.isBlocked( side );
}
@@ -396,7 +402,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
@Override
public SelectedPart selectPart( Vec3 pos )
{
for( ForgeDirection side : ForgeDirection.values() )
for( AEPartLocation side : AEPartLocation.values() )
{
IPart p = this.getPart( side );
if( p != null )
@@ -419,7 +425,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
if( AEApi.instance().partHelper().getCableRenderMode().opaqueFacades )
{
IFacadeContainer fc = this.getFacadeContainer();
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
for( AEPartLocation side : AEPartLocation.SIDE_LOCATIONS )
{
IFacadePart p = fc.getFacade( side );
if( p != null )
@@ -457,7 +463,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
List<ItemStack> facades = new LinkedList<ItemStack>();
IFacadeContainer fc = this.getFacadeContainer();
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
for( AEPartLocation d : AEPartLocation.SIDE_LOCATIONS )
{
IFacadePart fp = fc.getFacade( d );
if( fp != null )
@@ -470,7 +476,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
if( !facades.isEmpty() )
{
TileEntity te = this.tcb.getTile();
Platform.spawnDrops( te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, facades );
Platform.spawnDrops( te.getWorld(), te.getPos(), facades );
}
}
@@ -478,7 +484,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public boolean hasRedstone( ForgeDirection side )
public boolean hasRedstone( AEPartLocation side )
{
if( this.hasRedstone == YesNo.UNDECIDED )
{
@@ -492,7 +498,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
public boolean isEmpty()
{
IFacadeContainer fc = this.getFacadeContainer();
for( ForgeDirection s : ForgeDirection.values() )
for( AEPartLocation s : AEPartLocation.values() )
{
IPart part = this.getPart( s );
if( part != null )
@@ -500,7 +506,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
return false;
}
if( s != ForgeDirection.UNKNOWN )
if( s != AEPartLocation.INTERNAL )
{
IFacadePart fp = fc.getFacade( s );
if( fp != null )
@@ -539,13 +545,13 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
private void updateRedstone()
{
TileEntity te = this.getTile();
this.hasRedstone = te.getWorldObj().isBlockIndirectlyGettingPowered( te.xCoord, te.yCoord, te.zCoord ) ? YesNo.YES : YesNo.NO;
this.hasRedstone = te.getWorld().isBlockIndirectlyGettingPowered( te.getPos() ) != 0 ? YesNo.YES : YesNo.NO;
}
public void updateDynamicRender()
{
this.requiresDynamicRender = false;
for( ForgeDirection s : ForgeDirection.VALID_DIRECTIONS )
for( AEPartLocation s : AEPartLocation.SIDE_LOCATIONS )
{
IPart p = this.getPart( s );
if( p != null )
@@ -562,9 +568,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
{
if( this.getCenter() != null )
{
EnumSet<ForgeDirection> sides = EnumSet.allOf( ForgeDirection.class );
EnumSet<EnumFacing> sides = EnumSet.allOf( EnumFacing.class );
for( ForgeDirection s : ForgeDirection.VALID_DIRECTIONS )
for( EnumFacing s : EnumFacing.VALUES )
{
if( this.getPart( s ) != null || this.isBlocked( s ) )
{
@@ -596,7 +602,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
// start with the center, then install the side parts into the grid.
for( int x = 6; x >= 0; x-- )
{
ForgeDirection s = ForgeDirection.getOrientation( x );
AEPartLocation s = AEPartLocation.fromOrdinal( x );
IPart part = this.getPart( s );
if( part != null )
@@ -604,7 +610,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
part.setPartHostInfo( s, this, te );
part.addToWorld();
if( s != ForgeDirection.UNKNOWN )
if( s != AEPartLocation.INTERNAL )
{
IGridNode sn = part.getGridNode();
if( sn != null )
@@ -613,7 +619,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
// here?
// if ( !sn.getConnections().iterator().hasNext() )
IPart center = this.getPart( ForgeDirection.UNKNOWN );
IPart center = this.getPart( AEPartLocation.INTERNAL );
if( center != null )
{
IGridNode cn = center.getGridNode();
@@ -648,7 +654,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
this.inWorld = false;
for( ForgeDirection s : ForgeDirection.values() )
for( AEPartLocation s : AEPartLocation.values() )
{
IPart part = this.getPart( s );
if( part != null )
@@ -661,7 +667,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public IGridNode getGridNode( ForgeDirection side )
public IGridNode getGridNode( AEPartLocation side )
{
IPart part = this.getPart( side );
if( part != null )
@@ -682,7 +688,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( AEPartLocation dir )
{
IPart part = this.getPart( dir );
if( part instanceof IGridHost )
@@ -705,7 +711,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
@Override
public void securityBreak()
{
for( ForgeDirection d : ForgeDirection.values() )
for( AEPartLocation d : AEPartLocation.values() )
{
IPart p = this.getPart( d );
if( p instanceof IGridHost )
@@ -720,7 +726,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
List<AxisAlignedBB> boxes = new LinkedList<AxisAlignedBB>();
IFacadeContainer fc = this.getFacadeContainer();
for( ForgeDirection s : ForgeDirection.values() )
for( AEPartLocation s : AEPartLocation.values() )
{
IPartCollisionHelper bch = new BusCollisionHelper( boxes, s, e, visual );
@@ -739,7 +745,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
if( AEApi.instance().partHelper().getCableRenderMode().opaqueFacades || !visual )
{
if( includeFacades && s != null && s != ForgeDirection.UNKNOWN )
if( includeFacades && s != null && s != AEPartLocation.INTERNAL )
{
IFacadePart fp = fc.getFacade( s );
if( fp != null )
@@ -754,23 +760,23 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public int isProvidingStrongPower( ForgeDirection side )
public int isProvidingStrongPower( EnumFacing side )
{
IPart part = this.getPart( side );
return part != null ? part.isProvidingStrongPower() : 0;
}
@Override
public int isProvidingWeakPower( ForgeDirection side )
public int isProvidingWeakPower( EnumFacing side )
{
IPart part = this.getPart( side );
return part != null ? part.isProvidingWeakPower() : 0;
}
@Override
public boolean canConnectRedstone( EnumSet<ForgeDirection> enumSet )
public boolean canConnectRedstone( EnumSet<EnumFacing> enumSet )
{
for( ForgeDirection dir : enumSet )
for( EnumFacing dir : enumSet )
{
IPart part = this.getPart( dir );
if( part != null && part.canConnectRedstone() )
@@ -784,7 +790,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
@Override
public void onEntityCollision( Entity entity )
{
for( ForgeDirection s : ForgeDirection.values() )
for( AEPartLocation s : AEPartLocation.values() )
{
IPart part = this.getPart( s );
if( part != null )
@@ -810,7 +816,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
{
this.hasRedstone = YesNo.UNDECIDED;
for( ForgeDirection s : ForgeDirection.values() )
for( AEPartLocation s : AEPartLocation.values() )
{
IPart part = this.getPart( s );
if( part != null )
@@ -821,15 +827,15 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public boolean isSolidOnSide( ForgeDirection side )
public boolean isSolidOnSide( EnumFacing side )
{
if( side == null || side == ForgeDirection.UNKNOWN )
if( side == null )
{
return false;
}
// facades are solid..
IFacadePart fp = this.getFacadeContainer().getFacade( side );
IFacadePart fp = this.getFacadeContainer().getFacade( AEPartLocation.fromFacing( side ) );
if( fp != null )
{
return true;
@@ -843,7 +849,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
@Override
public boolean isLadder( EntityLivingBase entity )
{
for( ForgeDirection side : ForgeDirection.values() )
for( AEPartLocation side : AEPartLocation.values() )
{
IPart p = this.getPart( side );
if( p != null )
@@ -859,14 +865,14 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public void randomDisplayTick( World world, int x, int y, int z, Random r )
public void randomDisplayTick( World world, BlockPos pos, Random r )
{
for( ForgeDirection side : ForgeDirection.values() )
for( AEPartLocation side : AEPartLocation.values() )
{
IPart p = this.getPart( side );
if( p != null )
{
p.randomDisplayTick( world, x, y, z, r );
p.randomDisplayTick( world, pos, r );
}
}
}
@@ -876,7 +882,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
{
int light = 0;
for( ForgeDirection d : ForgeDirection.values() )
for( AEPartLocation d : AEPartLocation.values() )
{
IPart p = this.getPart( d );
if( p != null )
@@ -894,7 +900,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@SideOnly( Side.CLIENT )
public void renderStatic( double x, double y, double z )
public void renderStatic()
{
CableRenderHelper.getInstance().renderStatic( this, this.getFacadeContainer() );
}
@@ -910,7 +916,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
int sides = 0;
for( int x = 0; x < 7; x++ )
{
IPart p = this.getPart( ForgeDirection.getOrientation( x ) );
IPart p = this.getPart( AEPartLocation.fromOrdinal( x ) );
if( p != null )
{
sides |= ( 1 << x );
@@ -922,7 +928,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
for( int x = 0; x < 7; x++ )
{
ItemStack is = null;
IPart p = this.getPart( ForgeDirection.getOrientation( x ) );
IPart p = this.getPart( AEPartLocation.fromOrdinal( x ) );
if( p != null )
{
is = p.getItemStack( PartItemStack.Network );
@@ -945,7 +951,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
for( int x = 0; x < 7; x++ )
{
ForgeDirection side = ForgeDirection.getOrientation( x );
AEPartLocation side = AEPartLocation.fromOrdinal( x );
if( ( ( sides & ( 1 << x ) ) == ( 1 << x ) ) )
{
IPart p = this.getPart( side );
@@ -997,7 +1003,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
data.setInteger( "hasRedstone", this.hasRedstone.ordinal() );
IFacadeContainer fc = this.getFacadeContainer();
for( ForgeDirection s : ForgeDirection.values() )
for( AEPartLocation s : AEPartLocation.values() )
{
fc.writeToNBT( data );
@@ -1016,15 +1022,15 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
}
ForgeDirection getSide( IPart part )
AEPartLocation getSide( IPart part )
{
if( this.getCenter() == part )
{
return ForgeDirection.UNKNOWN;
return AEPartLocation.INTERNAL;
}
else
{
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
for( AEPartLocation side : AEPartLocation.SIDE_LOCATIONS )
{
if( this.getSide( side ) == part )
{
@@ -1045,7 +1051,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
for( int x = 0; x < 7; x++ )
{
ForgeDirection side = ForgeDirection.getOrientation( x );
AEPartLocation side = AEPartLocation.fromOrdinal( x );
NBTTagCompound def = data.getCompoundTag( "def:" + side.ordinal() );
NBTTagCompound extra = data.getCompoundTag( "extra:" + side.ordinal() );
@@ -1090,7 +1096,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
public List getDrops( List drops )
{
for( ForgeDirection s : ForgeDirection.values() )
for( AEPartLocation s : AEPartLocation.values() )
{
IPart part = this.getPart( s );
if( part != null )
@@ -1099,7 +1105,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
part.getDrops( drops, false );
}
if( s != ForgeDirection.UNKNOWN )
if( s != AEPartLocation.INTERNAL )
{
IFacadePart fp = this.getFacadeContainer().getFacade( s );
if( fp != null )
@@ -1114,7 +1120,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
public List getNoDrops( List drops )
{
for( ForgeDirection s : ForgeDirection.values() )
for( AEPartLocation s : AEPartLocation.values() )
{
IPart part = this.getPart( s );
if( part != null )
@@ -1127,9 +1133,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public boolean recolourBlock( ForgeDirection side, AEColor colour, EntityPlayer who )
public boolean recolourBlock( EnumFacing side, AEColor colour, EntityPlayer who )
{
IPart cable = this.getPart( ForgeDirection.UNKNOWN );
IPart cable = this.getPart( AEPartLocation.INTERNAL );
if( cable != null )
{
IPartCable pc = (IPartCable) cable;
@@ -19,11 +19,10 @@
package appeng.parts;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.implementations.parts.IPartCable;
import appeng.api.parts.IFacadePart;
import appeng.api.parts.IPart;
import appeng.api.util.AEPartLocation;
/**
@@ -46,7 +45,7 @@ public class CableBusStorage
this.center = center;
}
protected IPart getSide( ForgeDirection side )
protected IPart getSide( AEPartLocation side )
{
int x = side.ordinal();
if( this.sides != null && this.sides.length > x )
@@ -57,7 +56,7 @@ public class CableBusStorage
return null;
}
protected void setSide( ForgeDirection side, IPart part )
protected void setSide( AEPartLocation side, IPart part )
{
int x = side.ordinal();
@@ -25,13 +25,12 @@ import java.util.Random;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
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 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.api.parts.SelectedPart;
import appeng.api.util.AEColor;
@@ -39,11 +38,11 @@ import appeng.api.util.AEColor;
public interface ICableBusContainer
{
int isProvidingStrongPower( ForgeDirection opposite );
int isProvidingStrongPower( EnumFacing opposite );
int isProvidingWeakPower( ForgeDirection opposite );
int isProvidingWeakPower( EnumFacing opposite );
boolean canConnectRedstone( EnumSet<ForgeDirection> of );
boolean canConnectRedstone( EnumSet<EnumFacing> of );
void onEntityCollision( Entity e );
@@ -51,18 +50,18 @@ public interface ICableBusContainer
void onNeighborChanged();
boolean isSolidOnSide( ForgeDirection side );
boolean isSolidOnSide( EnumFacing side );
boolean isEmpty();
SelectedPart selectPart( Vec3 v3 );
boolean recolourBlock( ForgeDirection side, AEColor colour, EntityPlayer who );
boolean recolourBlock( EnumFacing side, AEColor colour, EntityPlayer who );
boolean isLadder( EntityLivingBase entity );
@SideOnly( Side.CLIENT )
void randomDisplayTick( World world, int x, int y, int z, Random r );
void randomDisplayTick( World world, BlockPos pos, Random r );
int getLightValue();
}
@@ -25,10 +25,10 @@ import java.util.Random;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
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.parts.SelectedPart;
import appeng.api.util.AEColor;
@@ -37,19 +37,19 @@ public class NullCableBusContainer implements ICableBusContainer
{
@Override
public int isProvidingStrongPower( ForgeDirection opposite )
public int isProvidingStrongPower( EnumFacing opposite )
{
return 0;
}
@Override
public int isProvidingWeakPower( ForgeDirection opposite )
public int isProvidingWeakPower( EnumFacing opposite )
{
return 0;
}
@Override
public boolean canConnectRedstone( EnumSet<ForgeDirection> of )
public boolean canConnectRedstone( EnumSet<EnumFacing> of )
{
return false;
}
@@ -73,7 +73,7 @@ public class NullCableBusContainer implements ICableBusContainer
}
@Override
public boolean isSolidOnSide( ForgeDirection side )
public boolean isSolidOnSide( EnumFacing side )
{
return false;
}
@@ -91,7 +91,7 @@ public class NullCableBusContainer implements ICableBusContainer
}
@Override
public boolean recolourBlock( ForgeDirection side, AEColor colour, EntityPlayer who )
public boolean recolourBlock( EnumFacing side, AEColor colour, EntityPlayer who )
{
return false;
}
@@ -103,7 +103,7 @@ public class NullCableBusContainer implements ICableBusContainer
}
@Override
public void randomDisplayTick( World world, int x, int y, int z, Random r )
public void randomDisplayTick( World world, BlockPos pos, Random r )
{
}
+23 -26
View File
@@ -19,25 +19,23 @@
package appeng.parts;
import java.io.IOException;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import java.io.IOException;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.implementations.IPowerChannelState;
import appeng.api.networking.GridFlags;
import appeng.api.networking.events.MENetworkChannelsChanged;
import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.parts.IPartRenderHelper;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.CableBusTextures;
import appeng.me.GridAccessException;
@@ -69,34 +67,33 @@ public abstract class PartBasicState extends AEBasePart implements IPowerChannel
}
@SideOnly( Side.CLIENT )
public void renderLights( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderLights( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
rh.normalRendering();
this.setColors( ( this.clientFlags & ( this.POWERED_FLAG | this.CHANNEL_FLAG ) ) == ( this.POWERED_FLAG | this.CHANNEL_FLAG ), ( this.clientFlags & this.POWERED_FLAG ) == this.POWERED_FLAG );
rh.renderFace( x, y, z, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), ForgeDirection.EAST, renderer );
rh.renderFace( x, y, z, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), ForgeDirection.WEST, renderer );
rh.renderFace( x, y, z, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), ForgeDirection.UP, renderer );
rh.renderFace( x, y, z, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), ForgeDirection.DOWN, renderer );
this.setColors( renderer, ( this.clientFlags & ( this.POWERED_FLAG | this.CHANNEL_FLAG ) ) == ( this.POWERED_FLAG | this.CHANNEL_FLAG ), ( this.clientFlags & this.POWERED_FLAG ) == this.POWERED_FLAG );
rh.renderFace( pos, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), EnumFacing.EAST, renderer );
rh.renderFace( pos, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), EnumFacing.WEST, renderer );
rh.renderFace( pos, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), EnumFacing.UP, renderer );
rh.renderFace( pos, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), EnumFacing.DOWN, renderer );
}
public void setColors( boolean hasChan, boolean hasPower )
public void setColors( IRenderHelper renderer, boolean hasChan, boolean hasPower )
{
if( hasChan )
{
int l = 14;
Tessellator.instance.setBrightness( l << 20 | l << 4 );
Tessellator.instance.setColorOpaque_I( this.getColor().blackVariant );
renderer.setBrightness( l << 20 | l << 4 );
renderer.setColorOpaque_I( this.getColor().blackVariant );
}
else if( hasPower )
{
int l = 9;
Tessellator.instance.setBrightness( l << 20 | l << 4 );
Tessellator.instance.setColorOpaque_I( this.getColor().whiteVariant );
renderer.setBrightness( l << 20 | l << 4 );
renderer.setColorOpaque_I( this.getColor().whiteVariant );
}
else
{
Tessellator.instance.setBrightness( 0 );
Tessellator.instance.setColorOpaque_I( 0x000000 );
renderer.setBrightness( 0 );
renderer.setColorOpaque_I( 0x000000 );
}
}
@@ -147,9 +144,9 @@ public abstract class PartBasicState extends AEBasePart implements IPowerChannel
@Override
@SideOnly( Side.CLIENT )
public IIcon getBreakingTexture()
public TextureAtlasSprite getBreakingTexture( IRenderHelper renderer )
{
return CableBusTextures.PartTransitionPlaneBack.getIcon();
return CableBusTextures.PartTransitionPlaneBack.getIcon().getAtlas();
}
@Override
+68 -67
View File
@@ -22,8 +22,6 @@ package appeng.parts;
import java.util.LinkedList;
import java.util.List;
import com.google.common.base.Optional;
import net.minecraft.block.Block;
import net.minecraft.block.Block.SoundType;
import net.minecraft.client.Minecraft;
@@ -31,18 +29,17 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import appeng.api.AEApi;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IItems;
@@ -51,6 +48,7 @@ import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartItem;
import appeng.api.parts.PartItemStack;
import appeng.api.parts.SelectedPart;
import appeng.api.util.AEPartLocation;
import appeng.api.util.DimensionalCoord;
import appeng.core.CommonHelper;
import appeng.core.sync.network.NetworkHandler;
@@ -61,10 +59,11 @@ import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBC;
import appeng.integration.abstraction.IFMP;
import appeng.integration.abstraction.IImmibisMicroblocks;
import appeng.util.LookDirection;
import appeng.util.Platform;
import com.google.common.base.Optional;
public class PartPlacement
{
@@ -73,24 +72,22 @@ public class PartPlacement
private final ThreadLocal<Object> placing = new ThreadLocal<Object>();
private boolean wasCanceled = false;
public static boolean place( ItemStack held, int x, int y, int z, int face, EntityPlayer player, World world, PlaceType pass, int depth )
public static boolean place( ItemStack held, BlockPos pos, EnumFacing side, EntityPlayer player, World world, PlaceType pass, int depth )
{
if( depth > 3 )
{
return false;
}
ForgeDirection side = ForgeDirection.getOrientation( face );
if( held != null && Platform.isWrench( player, held, x, y, z ) && player.isSneaking() )
if( held != null && Platform.isWrench( player, held, pos ) && player.isSneaking() )
{
if( !Platform.hasPermissions( new DimensionalCoord( world, x, y, z ), player ) )
if( !Platform.hasPermissions( new DimensionalCoord( world, pos ), player ) )
{
return false;
}
Block block = world.getBlock( x, y, z );
TileEntity tile = world.getTileEntity( x, y, z );
Block block = world.getBlockState( pos ).getBlock();
TileEntity tile = world.getTileEntity( pos );
IPartHost host = null;
if( tile instanceof IPartHost )
@@ -103,11 +100,11 @@ public class PartPlacement
if( !world.isRemote )
{
LookDirection dir = Platform.getPlayerRay( player, getEyeOffset( player ) );
MovingObjectPosition mop = block.collisionRayTrace( world, x, y, z, dir.a, dir.b );
MovingObjectPosition mop = block.collisionRayTrace( world, pos, dir.a, dir.b );
if( mop != null )
{
List<ItemStack> is = new LinkedList<ItemStack>();
SelectedPart sp = selectPart( player, host, mop.hitVec.addVector( -mop.blockX, -mop.blockY, -mop.blockZ ) );
SelectedPart sp = selectPart( player, host, mop.hitVec.addVector( -mop.getBlockPos().getX(), -mop.getBlockPos().getY(), -mop.getBlockPos().getZ() ) );
if( sp.part != null )
{
@@ -120,7 +117,7 @@ public class PartPlacement
{
is.add( sp.facade.getItemStack() );
host.getFacadeContainer().removeFacade( host, sp.side );
Platform.notifyBlocksOfNeighbors( world, x, y, z );
Platform.notifyBlocksOfNeighbors( world, pos );
}
if( host.isEmpty() )
@@ -130,14 +127,14 @@ public class PartPlacement
if( !is.isEmpty() )
{
Platform.spawnDrops( world, x, y, z, is );
Platform.spawnDrops( world, pos, is );
}
}
}
else
{
player.swingItem();
NetworkHandler.instance.sendToServer( new PacketPartPlacement( x, y, z, face, getEyeOffset( player ) ) );
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ) ) );
}
return true;
}
@@ -145,7 +142,7 @@ public class PartPlacement
return false;
}
TileEntity tile = world.getTileEntity( x, y, z );
TileEntity tile = world.getTileEntity( pos );
IPartHost host = null;
if( tile instanceof IPartHost )
@@ -155,19 +152,19 @@ public class PartPlacement
if( held != null )
{
IFacadePart fp = isFacade( held, side );
IFacadePart fp = isFacade( held, AEPartLocation.fromFacing( side ) );
if( fp != null )
{
if( host != null )
{
if( !world.isRemote )
{
if( host.getPart( ForgeDirection.UNKNOWN ) == null )
if( host.getPart( AEPartLocation.INTERNAL ) == null )
{
return false;
}
if( host.canAddPart( held, side ) )
if( host.canAddPart( held, AEPartLocation.fromFacing( side ) ) )
{
if( host.getFacadeContainer().addFacade( fp ) )
{
@@ -188,7 +185,7 @@ public class PartPlacement
else
{
player.swingItem();
NetworkHandler.instance.sendToServer( new PacketPartPlacement( x, y, z, face, getEyeOffset( player ) ) );
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ) ) );
return true;
}
}
@@ -196,6 +193,10 @@ public class PartPlacement
}
}
// TODO: IFMP INTEGRATION
// TODO IIMMIBISMICROBLOCKS INTEGRATION
/*
if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) )
{
host = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getOrCreateHost( tile );
@@ -205,17 +206,18 @@ public class PartPlacement
{
host = ( (IImmibisMicroblocks) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.ImmibisMicroblocks ) ).getOrCreateHost( player, face, tile );
}
*/
// if ( held == null )
{
Block block = world.getBlock( x, y, z );
Block block = world.getBlockState( pos ).getBlock();
if( host != null && player.isSneaking() && block != null )
{
LookDirection dir = Platform.getPlayerRay( player, getEyeOffset( player ) );
MovingObjectPosition mop = block.collisionRayTrace( world, x, y, z, dir.a, dir.b );
MovingObjectPosition mop = block.collisionRayTrace( world, pos, dir.a, dir.b );
if( mop != null )
{
mop.hitVec = mop.hitVec.addVector( -mop.blockX, -mop.blockY, -mop.blockZ );
mop.hitVec = mop.hitVec.addVector( -mop.getBlockPos().getX(), -mop.getBlockPos().getY(), -mop.getBlockPos().getZ() );
SelectedPart sPart = selectPart( player, host, mop.hitVec );
if( sPart != null && sPart.part != null )
{
@@ -223,7 +225,7 @@ public class PartPlacement
{
if( world.isRemote )
{
NetworkHandler.instance.sendToServer( new PacketPartPlacement( x, y, z, face, getEyeOffset( player ) ) );
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ) ) );
}
return true;
}
@@ -237,17 +239,15 @@ public class PartPlacement
return false;
}
int te_x = x;
int te_y = y;
int te_z = z;
BlockPos te_pos = pos;
final IBlockDefinition multiPart = AEApi.instance().definitions().blocks().multiPart();
if( host == null && pass == PlaceType.PLACE_ITEM )
{
ForgeDirection offset = ForgeDirection.UNKNOWN;
EnumFacing offset = null;
Block blkID = world.getBlock( x, y, z );
if( blkID != null && !blkID.isReplaceable( world, x, y, z ) )
Block blkID = world.getBlockState( pos ).getBlock();
if( blkID != null && !blkID.isReplaceable( world, pos ) )
{
offset = side;
if( Platform.isServer() )
@@ -256,16 +256,18 @@ public class PartPlacement
}
}
te_x = x + offset.offsetX;
te_y = y + offset.offsetY;
te_z = z + offset.offsetZ;
te_pos = offset == null ? pos : pos.offset( offset );
tile = world.getTileEntity( te_x, te_y, te_z );
tile = world.getTileEntity( te_pos );
if( tile instanceof IPartHost )
{
host = (IPartHost) tile;
}
// TODO: IFMP INTEGRATION
// TODO IIMMIBISMICROBLOCKS INTEGRATION
/*
if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) )
{
host = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getOrCreateHost( tile );
@@ -273,22 +275,23 @@ public class PartPlacement
if( host == null && tile != null && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.ImmibisMicroblocks ) )
{
host = ( (IImmibisMicroblocks) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.ImmibisMicroblocks ) ).getOrCreateHost( player, face, tile );
host = ( (IImmibisMicroblocks) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.ImmibisMicroblocks ) ).getOrCreateHost( player, side, tile );
}
*/
final Optional<ItemStack> maybeMultiPartStack = multiPart.maybeStack( 1 );
final Optional<Block> maybeMultiPartBlock = multiPart.maybeBlock();
final Optional<ItemBlock> maybeMultiPartItemBlock = multiPart.maybeItemBlock();
final boolean hostIsNotPresent = host == null;
final boolean multiPartPresent = maybeMultiPartBlock.isPresent() && maybeMultiPartStack.isPresent() && maybeMultiPartItemBlock.isPresent();
final boolean canMultiPartBePlaced = maybeMultiPartBlock.get().canPlaceBlockAt( world, te_x, te_y, te_z );
final boolean canMultiPartBePlaced = maybeMultiPartBlock.get().canPlaceBlockAt( world, te_pos );
if( hostIsNotPresent && multiPartPresent && canMultiPartBePlaced && maybeMultiPartItemBlock.get().placeBlockAt( maybeMultiPartStack.get(), player, world, te_x, te_y, te_z, side.ordinal(), 0.5f, 0.5f, 0.5f, 0 ) )
if( hostIsNotPresent && multiPartPresent && canMultiPartBePlaced && maybeMultiPartItemBlock.get().placeBlockAt( maybeMultiPartStack.get(), player, world, te_pos, side, 0.5f, 0.5f, 0.5f, maybeMultiPartBlock.get().getDefaultState() ) )
{
if( !world.isRemote )
{
tile = world.getTileEntity( te_x, te_y, te_z );
tile = world.getTileEntity( te_pos );
if( tile instanceof IPartHost )
{
@@ -300,11 +303,11 @@ public class PartPlacement
else
{
player.swingItem();
NetworkHandler.instance.sendToServer( new PacketPartPlacement( x, y, z, face, getEyeOffset( player ) ) );
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ) ) );
return true;
}
}
else if( host != null && !host.canAddPart( held, side ) )
else if( host != null && !host.canAddPart( held, AEPartLocation.fromFacing( side ) ) )
{
return false;
}
@@ -315,25 +318,23 @@ public class PartPlacement
return false;
}
if( !host.canAddPart( held, side ) )
if( !host.canAddPart( held, AEPartLocation.fromFacing( side ) ) )
{
if( pass == PlaceType.INTERACT_FIRST_PASS || pass == PlaceType.PLACE_ITEM )
{
te_x = x + side.offsetX;
te_y = y + side.offsetY;
te_z = z + side.offsetZ;
Block blkID = world.getBlock( te_x, te_y, te_z );
tile = world.getTileEntity( te_x, te_y, te_z );
te_pos = pos.offset( side );
Block blkID = world.getBlockState( te_pos ).getBlock();
tile = world.getTileEntity( te_pos );
if( tile != null && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) )
{
host = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getOrCreateHost( tile );
}
if( ( blkID == null || blkID.isReplaceable( world, te_x, te_y, te_z ) || host != null ) && side != ForgeDirection.UNKNOWN )
if( ( blkID == null || blkID.isReplaceable( world, te_pos ) || host != null ) ) ///&& side != AEPartLocation.INTERNAL )
{
return place( held, te_x, te_y, te_z, side.getOpposite().ordinal(), player, world, pass == PlaceType.INTERACT_FIRST_PASS ? PlaceType.INTERACT_SECOND_PASS : PlaceType.PLACE_ITEM, depth + 1 );
return place( held, te_pos, side.getOpposite(), player, world, pass == PlaceType.INTERACT_FIRST_PASS ? PlaceType.INTERACT_SECOND_PASS : PlaceType.PLACE_ITEM, depth + 1 );
}
}
return false;
@@ -341,12 +342,12 @@ public class PartPlacement
if( !world.isRemote )
{
Block block = world.getBlock( x, y, z );
Block block = world.getBlockState( pos ).getBlock();
LookDirection dir = Platform.getPlayerRay( player, getEyeOffset( player ) );
MovingObjectPosition mop = block.collisionRayTrace( world, x, y, z, dir.a, dir.b );
MovingObjectPosition mop = block.collisionRayTrace( world, pos, dir.a, dir.b );
if( mop != null )
{
SelectedPart sp = selectPart( player, host, mop.hitVec.addVector( -mop.blockX, -mop.blockY, -mop.blockZ ) );
SelectedPart sp = selectPart( player, host, mop.hitVec.addVector( -mop.getBlockPos().getX(), -mop.getBlockPos().getY(), -mop.getBlockPos().getZ() ) );
if( sp.part != null )
{
@@ -363,14 +364,14 @@ public class PartPlacement
return false;
}
ForgeDirection mySide = host.addPart( held, side, player );
AEPartLocation mySide = host.addPart( held, AEPartLocation.fromFacing( side ), player );
if( mySide != null )
{
for( Block multiPartBlock : multiPart.maybeBlock().asSet() )
{
final SoundType ss = multiPartBlock.stepSound;
world.playSoundEffect( 0.5 + x, 0.5 + y, 0.5 + z, ss.func_150496_b(), ( ss.getVolume() + 1.0F ) / 2.0F, ss.getPitch() * 0.8F );
world.playSoundEffect( 0.5 + pos.getX(), 0.5 + pos.getY(), 0.5 + pos.getZ(), ss.getPlaceSound(), ( ss.getVolume() + 1.0F ) / 2.0F, ss.getFrequency() * 0.8F );
}
if( !player.capabilities.isCreativeMode )
@@ -387,7 +388,7 @@ public class PartPlacement
else
{
player.swingItem();
NetworkHandler.instance.sendToServer( new PacketPartPlacement( x, y, z, face, getEyeOffset( player ) ) );
NetworkHandler.instance.sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ) ) );
}
return true;
}
@@ -411,7 +412,7 @@ public class PartPlacement
return sp;
}
public static IFacadePart isFacade( ItemStack held, ForgeDirection side )
public static IFacadePart isFacade( ItemStack held, AEPartLocation side )
{
if( held.getItem() instanceof IFacadeItem )
{
@@ -447,12 +448,12 @@ public class PartPlacement
float f = 1.0F;
double d0 = mc.playerController.getBlockReachDistance();
Vec3 vec3 = mc.renderViewEntity.getPosition( f );
Vec3 vec3 = mc.getRenderViewEntity().getPositionEyes( f );
if( mop != null && mop.hitVec.distanceTo( vec3 ) < d0 )
{
World w = event.entity.worldObj;
TileEntity te = w.getTileEntity( mop.blockX, mop.blockY, mop.blockZ );
TileEntity te = w.getTileEntity( mop.getBlockPos() );
if( te instanceof IPartHost && this.wasCanceled )
{
event.setCanceled( true );
@@ -468,7 +469,7 @@ public class PartPlacement
if( event.entityPlayer.isSneaking() && held != null && supportedItem )
{
NetworkHandler.instance.sendToServer( new PacketClick( event.x, event.y, event.z, event.face, 0, 0, 0 ) );
NetworkHandler.instance.sendToServer( new PacketClick( event.pos, event.face, 0, 0, 0 ) );
}
}
}
@@ -482,7 +483,7 @@ public class PartPlacement
this.placing.set( event );
ItemStack held = event.entityPlayer.getHeldItem();
if( place( held, event.x, event.y, event.z, event.face, event.entityPlayer, event.entityPlayer.worldObj, PlaceType.INTERACT_FIRST_PASS, 0 ) )
if( place( held, event.pos, event.face, event.entityPlayer, event.entityPlayer.worldObj, PlaceType.INTERACT_FIRST_PASS, 0 ) )
{
event.setCanceled( true );
this.wasCanceled = true;
@@ -5,7 +5,6 @@ import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import appeng.api.config.Upgrades;
import appeng.tile.inventory.IAEAppEngInventory;
@@ -2,7 +2,6 @@ package appeng.parts.automation;
import net.minecraft.item.ItemStack;
import appeng.api.config.Upgrades;
import appeng.api.definitions.IItemDefinition;
import appeng.tile.inventory.IAEAppEngInventory;
@@ -22,24 +22,19 @@ package appeng.parts.automation;
import java.util.List;
import java.util.concurrent.Callable;
import com.google.common.collect.Lists;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.util.ForgeDirection;
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.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.networking.IGridNode;
@@ -58,7 +53,10 @@ import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.AEPartLocation;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.CableBusTextures;
import appeng.client.texture.IAESprite;
import appeng.core.settings.TickRates;
import appeng.core.sync.packets.PacketTransitionEffect;
import appeng.hooks.TickHandler;
@@ -68,13 +66,15 @@ import appeng.server.ServerHelper;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import com.google.common.collect.Lists;
public class PartAnnihilationPlane extends PartBasicState implements IGridTickable, Callable<TickRateModulation>
{
private final static IIcon SIDE_ICON = CableBusTextures.PartPlaneSides.getIcon();
private final static IIcon BACK_ICON = CableBusTextures.PartTransitionPlaneBack.getIcon();
private final static IIcon STATUS_ICON = CableBusTextures.PartMonitorSidesStatus.getIcon();
private final static IIcon ACTIVE_ICON = CableBusTextures.BlockAnnihilationPlaneOn.getIcon();
private final static IAESprite SIDE_ICON = CableBusTextures.PartPlaneSides.getIcon();
private final static IAESprite BACK_ICON = CableBusTextures.PartTransitionPlaneBack.getIcon();
private final static IAESprite STATUS_ICON = CableBusTextures.PartMonitorSidesStatus.getIcon();
private final static IAESprite ACTIVE_ICON = CableBusTextures.BlockAnnihilationPlaneOn.getIcon();
private final BaseActionSource mySrc = new MachineSource( this );
private boolean isAccepting = true;
@@ -105,29 +105,27 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
{
final TileEntity te = host.getTile();
final int x = te.xCoord;
final int y = te.yCoord;
final int z = te.zCoord;
BlockPos pos = te.getPos();
final ForgeDirection e = bch.getWorldX();
final ForgeDirection u = bch.getWorldY();
final EnumFacing e = bch.getWorldX();
final EnumFacing u = bch.getWorldY();
if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), this.side ) )
if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e.getOpposite() ) ), this.side ) )
{
minX = 0;
}
if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), this.side ) )
if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e ) ), this.side ) )
{
maxX = 16;
}
if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), this.side ) )
if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( u.getOpposite() ) ), this.side ) )
{
minY = 0;
}
if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) )
if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e ) ), this.side ) )
{
maxY = 16;
}
@@ -139,9 +137,9 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
{
rh.setTexture( SIDE_ICON, SIDE_ICON, BACK_ICON, this.is.getIconIndex(), SIDE_ICON, SIDE_ICON );
rh.setTexture( SIDE_ICON, SIDE_ICON, BACK_ICON, renderer.getIcon( is ), SIDE_ICON, SIDE_ICON );
rh.setBounds( 1, 1, 15, 15, 15, 16 );
rh.renderInventoryBox( renderer );
@@ -152,57 +150,57 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
this.renderStaticWithIcon( x, y, z, rh, renderer, ACTIVE_ICON );
this.renderStaticWithIcon( pos, rh, renderer, ACTIVE_ICON );
}
protected void renderStaticWithIcon( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, IIcon activeIcon )
protected void renderStaticWithIcon( BlockPos opos, IPartRenderHelper rh, IRenderHelper renderer, IAESprite activeIcon )
{
int minX = 1;
int minY = 1;
int maxX = 15;
int maxY = 15;
final ForgeDirection e = rh.getWorldX();
final ForgeDirection u = rh.getWorldY();
final EnumFacing e = rh.getWorldX();
final EnumFacing u = rh.getWorldY();
final TileEntity te = this.getHost().getTile();
if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), this.side ) )
BlockPos pos = te.getPos();
if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e.getOpposite() ) ), this.side ) )
{
minX = 0;
}
if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), this.side ) )
if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e ) ), this.side ) )
{
maxX = 16;
}
if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), this.side ) )
if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( u.getOpposite() ) ), this.side ) )
{
minY = 0;
}
if( this.isAnnihilationPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) )
if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e) ), this.side ) )
{
maxY = 16;
}
final boolean isActive = ( this.clientFlags & ( PartBasicState.POWERED_FLAG | PartBasicState.CHANNEL_FLAG ) ) == ( PartBasicState.POWERED_FLAG | PartBasicState.CHANNEL_FLAG );
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
rh.setTexture( SIDE_ICON, SIDE_ICON, BACK_ICON, isActive ? activeIcon : this.is.getIconIndex(), SIDE_ICON, SIDE_ICON );
rh.setTexture( SIDE_ICON, SIDE_ICON, BACK_ICON, isActive ? activeIcon : renderer.getIcon( is ), SIDE_ICON, SIDE_ICON );
rh.setBounds( minX, minY, 15, maxX, maxY, 16 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( opos, renderer );
rh.setTexture( STATUS_ICON, STATUS_ICON, BACK_ICON, isActive ? activeIcon : this.is.getIconIndex(), STATUS_ICON, STATUS_ICON );
rh.setTexture( STATUS_ICON, STATUS_ICON, BACK_ICON, isActive ? activeIcon : renderer.getIcon( is ), STATUS_ICON, STATUS_ICON );
rh.setBounds( 5, 5, 14, 11, 11, 15 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( opos, renderer );
this.renderLights( x, y, z, rh, renderer );
this.renderLights( opos, rh, renderer );
}
@Override
@@ -225,16 +223,17 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
if( this.isAccepting && entity instanceof EntityItem && !entity.isDead && Platform.isServer() && this.proxy.isActive() )
{
boolean capture = false;
BlockPos pos = tile.getPos();
switch( this.side )
{
case DOWN:
case UP:
if( entity.posX > this.tile.xCoord && entity.posX < this.tile.xCoord + 1 )
if( entity.posX > pos.getX() && entity.posX < pos.getX() + 1 )
{
if( entity.posZ > this.tile.zCoord && entity.posZ < this.tile.zCoord + 1 )
if( entity.posZ > pos.getZ() && entity.posZ < pos.getZ() + 1 )
{
if( ( entity.posY > this.tile.yCoord + 0.9 && this.side == ForgeDirection.UP ) || ( entity.posY < this.tile.yCoord + 0.1 && this.side == ForgeDirection.DOWN ) )
if( ( entity.posY > pos.getY() + 0.9 && this.side == AEPartLocation.UP ) || ( entity.posY < pos.getY() + 0.1 && this.side == AEPartLocation.DOWN ) )
{
capture = true;
}
@@ -243,11 +242,11 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
break;
case SOUTH:
case NORTH:
if( entity.posX > this.tile.xCoord && entity.posX < this.tile.xCoord + 1 )
if( entity.posX > pos.getX() && entity.posX < pos.getX() + 1 )
{
if( entity.posY > this.tile.yCoord && entity.posY < this.tile.yCoord + 1 )
if( entity.posY > pos.getY() && entity.posY < pos.getY() + 1 )
{
if( ( entity.posZ > this.tile.zCoord + 0.9 && this.side == ForgeDirection.SOUTH ) || ( entity.posZ < this.tile.zCoord + 0.1 && this.side == ForgeDirection.NORTH ) )
if( ( entity.posZ > pos.getZ() + 0.9 && this.side == AEPartLocation.SOUTH ) || ( entity.posZ < pos.getZ() + 0.1 && this.side == AEPartLocation.NORTH ) )
{
capture = true;
}
@@ -256,11 +255,11 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
break;
case EAST:
case WEST:
if( entity.posZ > this.tile.zCoord && entity.posZ < this.tile.zCoord + 1 )
if( entity.posZ > pos.getZ() && entity.posZ < pos.getZ() + 1 )
{
if( entity.posY > this.tile.yCoord && entity.posY < this.tile.yCoord + 1 )
if( entity.posY > pos.getY() && entity.posY < pos.getY() + 1 )
{
if( ( entity.posX > this.tile.xCoord + 0.9 && this.side == ForgeDirection.EAST ) || ( entity.posX < this.tile.xCoord + 0.1 && this.side == ForgeDirection.WEST ) )
if( ( entity.posX > pos.getX() + 0.9 && this.side == AEPartLocation.EAST ) || ( entity.posX < pos.getX() + 0.1 && this.side == AEPartLocation.WEST ) )
{
capture = true;
}
@@ -274,7 +273,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
if( capture )
{
ServerHelper.proxy.sendToAllNearExcept( null, this.tile.xCoord, this.tile.yCoord, this.tile.zCoord, 64, this.tile.getWorldObj(), new PacketTransitionEffect( entity.posX, entity.posY, entity.posZ, this.side, false ) );
ServerHelper.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, this.tile.getWorld(), new PacketTransitionEffect( entity.posX, entity.posY, entity.posZ, this.side, false ) );
this.storeEntityItem( (EntityItem) entity );
}
}
@@ -332,16 +331,13 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
}
final TileEntity tileEntity = this.getTile();
final WorldServer world = (WorldServer) tileEntity.getWorldObj();
final WorldServer world = (WorldServer) tileEntity.getWorld();
final int x = tileEntity.xCoord + this.side.offsetX;
final int y = tileEntity.yCoord + this.side.offsetY;
final int z = tileEntity.zCoord + this.side.offsetZ;
Platform.spawnDrops( world, x, y, z, Lists.newArrayList( overflow.getItemStack() ) );
BlockPos pos = tileEntity.getPos().offset( side.getFacing() );
Platform.spawnDrops( world, pos, Lists.newArrayList( overflow.getItemStack() ) );
}
protected boolean isAnnihilationPlane( TileEntity blockTileEntity, ForgeDirection side )
protected boolean isAnnihilationPlane( TileEntity blockTileEntity, AEPartLocation side )
{
if( blockTileEntity instanceof IPartHost )
{
@@ -374,18 +370,16 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
try
{
final TileEntity te = this.getTile();
final WorldServer w = (WorldServer) te.getWorldObj();
final WorldServer w = (WorldServer) te.getWorld();
final int x = te.xCoord + this.side.offsetX;
final int y = te.yCoord + this.side.offsetY;
final int z = te.zCoord + this.side.offsetZ;
BlockPos pos = te.getPos().offset( side.getFacing() );
final IEnergyGrid energy = this.proxy.getEnergy();
if( this.canHandleBlock( w, x, y, z ) )
if( this.canHandleBlock( w, pos ) )
{
final List<ItemStack> items = this.obtainBlockDrops( w, x, y, z );
final float requiredPower = this.calculateEnergyUsage( w, x, y, z, items );
final List<ItemStack> items = this.obtainBlockDrops( w, pos );
final float requiredPower = this.calculateEnergyUsage( w, pos, items );
final boolean hasPower = energy.extractAEPower( requiredPower, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > requiredPower - 0.1;
final boolean canStore = this.canStoreItemStacks( items );
@@ -395,13 +389,13 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
if( modulate )
{
energy.extractAEPower( requiredPower, Actionable.MODULATE, PowerMultiplier.CONFIG );
this.breakBlockAndStoreItems( w, x, y, z, items );
ServerHelper.proxy.sendToAllNearExcept( null, x, y, z, 64, w, new PacketTransitionEffect( x, y, z, this.side, true ) );
this.breakBlockAndStoreItems( w, pos, items );
ServerHelper.proxy.sendToAllNearExcept( null, pos.getX(),pos.getY(),pos.getZ(), 64, w, new PacketTransitionEffect( pos.getX(),pos.getY(),pos.getZ(), this.side, true ) );
}
else
{
this.breaking = true;
TickHandler.INSTANCE.addCallable( this.tile.getWorldObj(), this );
TickHandler.INSTANCE.addCallable( this.tile.getWorld(), this );
}
return TickRateModulation.URGENT;
}
@@ -438,30 +432,30 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
/**
* Checks if this plane can handle the block at the specific coordinates.
*/
protected boolean canHandleBlock( WorldServer w, int x, int y, int z )
protected boolean canHandleBlock( WorldServer w, BlockPos pos )
{
final Block block = w.getBlock( x, y, z );
final Block block = w.getBlockState( pos ).getBlock();
final Material material = block.getMaterial();
final float hardness = block.getBlockHardness( w, x, y, z );
final float hardness = block.getBlockHardness( w, pos );
final boolean ignoreMaterials = material == Material.air || material == Material.lava || material == Material.water || material.isLiquid();
final boolean ignoreBlocks = block == Blocks.bedrock || block == Blocks.end_portal || block == Blocks.end_portal_frame || block == Blocks.command_block;
return !ignoreMaterials && !ignoreBlocks && !w.isAirBlock( x, y, z ) && w.blockExists( x, y, z ) && w.canMineBlock( Platform.getPlayer( w ), x, y, z ) && hardness >= 0f;
return !ignoreMaterials && !ignoreBlocks && !w.isAirBlock( pos ) && w.isBlockLoaded( pos ) && w.canMineBlockBody( Platform.getPlayer( w ), pos ) && hardness >= 0f;
}
protected List<ItemStack> obtainBlockDrops( WorldServer w, int x, int y, int z )
protected List<ItemStack> obtainBlockDrops( WorldServer w, BlockPos pos )
{
final ItemStack[] out = Platform.getBlockDrops( w, x, y, z );
final ItemStack[] out = Platform.getBlockDrops( w, pos );
return Lists.newArrayList( out );
}
/**
* Checks if this plane can handle the block at the specific coordinates.
*/
protected float calculateEnergyUsage( WorldServer w, int x, int y, int z, List<ItemStack> items )
protected float calculateEnergyUsage( WorldServer w, BlockPos pos, List<ItemStack> items )
{
final Block block = w.getBlock( x, y, z );
final float hardness = block.getBlockHardness( w, x, y, z );
final Block block = w.getBlockState( pos ).getBlock();
final float hardness = block.getBlockHardness( w, pos );
float requiredEnergy = 1 + hardness;
for( final ItemStack is : items )
@@ -508,11 +502,11 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
return canStore;
}
protected void breakBlockAndStoreItems( WorldServer w, int x, int y, int z, List<ItemStack> items )
protected void breakBlockAndStoreItems( WorldServer w, BlockPos pos, List<ItemStack> items )
{
w.setBlock( x, y, z, Platform.AIR_BLOCK, 0, 3 );
final AxisAlignedBB box = AxisAlignedBB.getBoundingBox( x - 0.2, y - 0.2, z - 0.2, x + 1.2, y + 1.2, z + 1.2 );
w.setBlockToAir( pos );
final AxisAlignedBB box = AxisAlignedBB.fromBounds( pos.getX() - 0.2, pos.getY() - 0.2, pos.getZ() - 0.2, pos.getX() + 1.2, pos.getY() + 1.2, pos.getZ() + 1.2 );
for( final Object ei : w.getEntitiesWithinAABB( EntityItem.class, box ) )
{
if( ei instanceof EntityItem )
@@ -19,18 +19,13 @@
package appeng.parts.automation;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Vec3;
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.api.config.Actionable;
import appeng.api.config.FuzzyMode;
import appeng.api.config.PowerMultiplier;
@@ -52,6 +47,7 @@ import appeng.api.parts.IPartRenderHelper;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.CableBusTextures;
import appeng.core.AELog;
import appeng.core.settings.TickRates;
@@ -63,6 +59,9 @@ import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
public class PartExportBus extends PartSharedItemBus implements ICraftingRequester
{
@@ -144,7 +143,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
{
if( this.isCraftingEnabled() )
{
this.didSomething = this.cratingTracker.handleCrafting( x, this.itemToSend, ais, d, this.getTile().getWorldObj(), this.proxy.getGrid(), cg, this.mySrc ) || this.didSomething;
this.didSomething = this.cratingTracker.handleCrafting( x, this.itemToSend, ais, d, this.getTile().getWorld(), this.proxy.getGrid(), cg, this.mySrc ) || this.didSomething;
}
continue;
}
@@ -169,7 +168,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
if( this.itemToSend == before && this.isCraftingEnabled() )
{
this.didSomething = this.cratingTracker.handleCrafting( x, this.itemToSend, ais, d, this.getTile().getWorldObj(), this.proxy.getGrid(), cg, this.mySrc ) || this.didSomething;
this.didSomething = this.cratingTracker.handleCrafting( x, this.itemToSend, ais, d, this.getTile().getWorld(), this.proxy.getGrid(), cg, this.mySrc ) || this.didSomething;
}
}
}
@@ -193,10 +192,10 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
{
rh.setTexture( CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon() );
rh.setTexture( CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon() );
rh.setBounds( 4, 4, 12, 12, 12, 14 );
rh.renderInventoryBox( renderer );
@@ -210,26 +209,25 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
rh.setTexture( CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon() );
rh.setTexture( CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon() );
rh.setBounds( 4, 4, 12, 12, 12, 14 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setBounds( 5, 5, 14, 11, 11, 15 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setBounds( 6, 6, 15, 10, 10, 16 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
rh.setBounds( 6, 6, 11, 10, 10, 12 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
this.renderLights( x, y, z, rh, renderer );
this.renderLights( pos, rh, renderer );
}
@Override
@@ -22,7 +22,6 @@ package appeng.parts.automation;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
@@ -35,16 +34,15 @@ import net.minecraft.item.ItemSkull;
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.util.Vec3;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
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.api.AEApi;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
@@ -69,7 +67,9 @@ import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.AEPartLocation;
import appeng.api.util.IConfigManager;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.CableBusTextures;
import appeng.core.AEConfig;
import appeng.core.sync.GuiBridge;
@@ -233,29 +233,27 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
{
TileEntity te = host.getTile();
int x = te.xCoord;
int y = te.yCoord;
int z = te.zCoord;
BlockPos pos = te.getPos();
ForgeDirection e = bch.getWorldX();
ForgeDirection u = bch.getWorldY();
EnumFacing e = bch.getWorldX();
EnumFacing u = bch.getWorldY();
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), this.side ) )
if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( e.getOpposite() ) ), this.side ) )
{
minX = 0;
}
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), this.side ) )
if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( e) ), this.side ) )
{
maxX = 16;
}
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), this.side ) )
if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( u.getOpposite() ) ), this.side ) )
{
minY = 0;
}
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) )
if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( u) ), this.side ) )
{
maxY = 16;
}
@@ -267,9 +265,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
{
rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartTransitionPlaneBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon() );
rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartTransitionPlaneBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon() );
rh.setBounds( 1, 1, 15, 15, 15, 16 );
rh.renderInventoryBox( renderer );
@@ -280,66 +278,64 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos opos, IPartRenderHelper rh, IRenderHelper renderer )
{
int minX = 1;
int minY = 1;
int maxX = 15;
int maxY = 15;
ForgeDirection e = rh.getWorldX();
ForgeDirection u = rh.getWorldY();
EnumFacing e = rh.getWorldX();
EnumFacing u = rh.getWorldY();
TileEntity te = this.getHost().getTile();
BlockPos pos = te.getPos();
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), this.side ) )
if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( e.getOpposite() ) ), this.side ) )
{
minX = 0;
}
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), this.side ) )
if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( e ) ), this.side ) )
{
maxX = 16;
}
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), this.side ) )
if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( u.getOpposite() ) ), this.side ) )
{
minY = 0;
}
if( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) )
if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( u ) ), this.side ) )
{
maxY = 16;
}
boolean isActive = ( this.clientFlags & ( this.POWERED_FLAG | this.CHANNEL_FLAG ) ) == ( this.POWERED_FLAG | this.CHANNEL_FLAG );
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockFormPlaneOn.getIcon() : this.is.getIconIndex(), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon() );
rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockFormPlaneOn.getIcon() : renderer.getIcon( is ), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon() );
rh.setBounds( minX, minY, 15, maxX, maxY, 16 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( opos, renderer );
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockFormPlaneOn.getIcon() : this.is.getIconIndex(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockFormPlaneOn.getIcon() : renderer.getIcon( is ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
rh.setBounds( 5, 5, 14, 11, 11, 15 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( opos, renderer );
this.renderLights( x, y, z, rh, renderer );
this.renderLights( opos, rh, renderer );
}
@Override
public void onNeighborChanged()
{
TileEntity te = this.host.getTile();
World w = te.getWorldObj();
ForgeDirection side = this.side;
World w = te.getWorld();
AEPartLocation side = this.side;
int x = te.xCoord + side.offsetX;
int y = te.yCoord + side.offsetY;
int z = te.zCoord + side.offsetZ;
this.blocked = !w.getBlock( x, y, z ).isReplaceable( w, x, y, z );
BlockPos tePos = te.getPos().offset( side.getFacing() );
this.blocked = !w.getBlockState( tePos ).getBlock().isReplaceable( w, tePos );
}
@Override
@@ -365,7 +361,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
return false;
}
private boolean isTransitionPlane( TileEntity blockTileEntity, ForgeDirection side )
private boolean isTransitionPlane( TileEntity blockTileEntity, AEPartLocation side )
{
if( blockTileEntity instanceof IPartHost )
{
@@ -424,25 +420,25 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
boolean worked = false;
TileEntity te = this.host.getTile();
World w = te.getWorldObj();
ForgeDirection side = this.side;
World w = te.getWorld();
AEPartLocation side = this.side;
int x = te.xCoord + side.offsetX;
int y = te.yCoord + side.offsetY;
int z = te.zCoord + side.offsetZ;
BlockPos tePos = te.getPos().offset( side.getFacing() );
if( w.getBlock( x, y, z ).isReplaceable( w, x, y, z ) )
if( w.getBlockState( tePos ).getBlock().isReplaceable( w, tePos ) )
{
if( placeBlock == YesNo.YES && ( i instanceof ItemBlock || i instanceof IPlantable || i instanceof ItemSkull || i instanceof ItemFirework || i instanceof IPartItem || i instanceof ItemReed ) )
{
EntityPlayer player = Platform.getPlayer( (WorldServer) w );
Platform.configurePlayer( player, side, this.tile );
// TODO: LIMIT FIREWORKS
/*
if( i instanceof ItemFirework )
{
Chunk c = w.getChunkFromBlockCoords( x, z );
Chunk c = w.getChunkFromBlockCoords( tePos );
int sum = 0;
for( List Z : c.entityLists )
for( List Z : c.geten )
{
sum += Z.size();
}
@@ -451,6 +447,8 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
return input;
}
}
*/
maxStorage = is.stackSize;
worked = true;
if( type == Actionable.MODULATE )
@@ -459,31 +457,31 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
{
boolean Worked = false;
if( side.offsetX == 0 && side.offsetZ == 0 )
if( side.xOffset == 0 && side.zOffset == 0 )
{
Worked = i.onItemUse( is, player, w, x + side.offsetX, y + side.offsetY, z + side.offsetZ, side.getOpposite().ordinal(), side.offsetX, side.offsetY, side.offsetZ );
Worked = i.onItemUse( is, player, w, tePos.offset( side.getFacing() ), side.getFacing().getOpposite(), side.xOffset, side.yOffset, side.zOffset );
}
if( !Worked && side.offsetX == 0 && side.offsetZ == 0 )
if( !Worked && side.xOffset == 0 && side.zOffset == 0 )
{
Worked = i.onItemUse( is, player, w, x - side.offsetX, y - side.offsetY, z - side.offsetZ, side.ordinal(), side.offsetX, side.offsetY, side.offsetZ );
Worked = i.onItemUse( is, player, w, tePos.offset( side.getFacing().getOpposite() ), side.getFacing(), side.xOffset, side.yOffset, side.zOffset );
}
if( !Worked && side.offsetY == 0 )
if( !Worked && side.yOffset == 0 )
{
Worked = i.onItemUse( is, player, w, x, y - 1, z, ForgeDirection.UP.ordinal(), side.offsetX, side.offsetY, side.offsetZ );
Worked = i.onItemUse( is, player, w, tePos.offset( EnumFacing.DOWN ), EnumFacing.UP, side.xOffset, side.yOffset, side.zOffset );
}
if( !Worked )
{
i.onItemUse( is, player, w, x, y, z, side.getOpposite().ordinal(), side.offsetX, side.offsetY, side.offsetZ );
i.onItemUse( is, player, w, tePos, side.getFacing().getOpposite(), side.xOffset, side.yOffset, side.zOffset );
}
maxStorage -= is.stackSize;
}
else
{
i.onItemUse( is, player, w, x, y, z, side.getOpposite().ordinal(), side.offsetX, side.offsetY, side.offsetZ );
i.onItemUse( is, player, w, tePos, side.getFacing().getOpposite(), side.xOffset, side.yOffset, side.zOffset );
maxStorage -= is.stackSize;
}
}
@@ -495,13 +493,18 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
else
{
worked = true;
Chunk c = w.getChunkFromBlockCoords( x, z );
Chunk c = w.getChunkFromBlockCoords( tePos );
int sum = 0;
// TODO: LIMIT OTHER THIGNS!
/*
for( List Z : c.entityLists )
{
sum += Z.size();
}
*/
if( sum < AEConfig.instance.formationPlaneEntityLimit )
{
if( type == Actionable.MODULATE )
@@ -509,16 +512,16 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
is.stackSize = (int) maxStorage;
EntityItem ei = new EntityItem( w, // w
( ( side.offsetX != 0 ? 0.0 : 0.7 ) * ( Platform.getRandomFloat() - 0.5f ) ) + 0.5 + side.offsetX * -0.3 + x, // spawn
( ( side.offsetY != 0 ? 0.0 : 0.7 ) * ( Platform.getRandomFloat() - 0.5f ) ) + 0.5 + side.offsetY * -0.3 + y, // spawn
( ( side.offsetZ != 0 ? 0.0 : 0.7 ) * ( Platform.getRandomFloat() - 0.5f ) ) + 0.5 + side.offsetZ * -0.3 + z, // spawn
( ( side.xOffset != 0 ? 0.0 : 0.7 ) * ( Platform.getRandomFloat() - 0.5f ) ) + 0.5 + side.xOffset * -0.3 + tePos.getX(), // spawn
( ( side.yOffset != 0 ? 0.0 : 0.7 ) * ( Platform.getRandomFloat() - 0.5f ) ) + 0.5 + side.yOffset * -0.3 + tePos.getY(), // spawn
( ( side.zOffset != 0 ? 0.0 : 0.7 ) * ( Platform.getRandomFloat() - 0.5f ) ) + 0.5 + side.zOffset * -0.3 + tePos.getZ(), // spawn
is.copy() );
Entity result = ei;
ei.motionX = side.offsetX * 0.2;
ei.motionY = side.offsetY * 0.2;
ei.motionZ = side.offsetZ * 0.2;
ei.motionX = side.xOffset * 0.2;
ei.motionY = side.yOffset * 0.2;
ei.motionZ = side.zOffset * 0.2;
if( is.getItem().hasCustomEntity( is ) )
{
@@ -547,7 +550,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
}
}
this.blocked = !w.getBlock( x, y, z ).isReplaceable( w, x, y, z );
this.blocked = !w.getBlockState( tePos ).getBlock().isReplaceable( w, tePos );
if( worked )
{
@@ -22,29 +22,28 @@ package appeng.parts.automation;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.BlockPos;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraftforge.common.util.ForgeDirection;
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.api.parts.IPart;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.util.AEPartLocation;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.CableBusTextures;
import appeng.client.texture.IAESprite;
public class PartIdentityAnnihilationPlane extends PartAnnihilationPlane
{
private final static IIcon ACTIVE_ICON = CableBusTextures.BlockIdentityAnnihilationPlaneOn.getIcon();
private final static IAESprite ACTIVE_ICON = CableBusTextures.BlockIdentityAnnihilationPlaneOn.getIcon();
private static final float SILK_TOUCH_FACTOR = 16;
@@ -55,13 +54,13 @@ public class PartIdentityAnnihilationPlane extends PartAnnihilationPlane
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
this.renderStaticWithIcon( x, y, z, rh, renderer, ACTIVE_ICON );
this.renderStaticWithIcon( pos, rh, renderer, ACTIVE_ICON );
}
@Override
protected boolean isAnnihilationPlane( TileEntity blockTileEntity, ForgeDirection side )
protected boolean isAnnihilationPlane( TileEntity blockTileEntity, AEPartLocation side )
{
if( blockTileEntity instanceof IPartHost )
{
@@ -72,31 +71,30 @@ public class PartIdentityAnnihilationPlane extends PartAnnihilationPlane
}
@Override
protected float calculateEnergyUsage( WorldServer w, int x, int y, int z, List<ItemStack> items )
protected float calculateEnergyUsage( WorldServer w, BlockPos pos, List<ItemStack> items )
{
final float requiredEnergy = super.calculateEnergyUsage( w, x, y, z, items );
final float requiredEnergy = super.calculateEnergyUsage( w, pos, items );
return requiredEnergy * SILK_TOUCH_FACTOR;
}
@Override
protected List<ItemStack> obtainBlockDrops( WorldServer w, int x, int y, int z )
protected List<ItemStack> obtainBlockDrops( WorldServer w, BlockPos pos )
{
final FakePlayer fakePlayer = FakePlayerFactory.getMinecraft( w );
final Block block = w.getBlock( x, y, z );
final int blockMeta = w.getBlockMetadata( x, y, z );
if( block.canSilkHarvest( w, fakePlayer, x, y, z, blockMeta ) )
final IBlockState state = w.getBlockState( pos );
if( state.getBlock().canSilkHarvest( w, pos, state, fakePlayer ) )
{
final List<ItemStack> out = new ArrayList<ItemStack>( 1 );
final Item item = Item.getItemFromBlock( block );
final Item item = Item.getItemFromBlock( state.getBlock() );
if( item != null )
{
int meta = 0;
if( item.getHasSubtypes() )
{
meta = blockMeta;
meta = state.getBlock().getMetaFromState( state );
}
ItemStack itemstack = new ItemStack( item, 1, meta );
out.add( itemstack );
@@ -105,7 +103,7 @@ public class PartIdentityAnnihilationPlane extends PartAnnihilationPlane
}
else
{
return super.obtainBlockDrops( w, x, y, z );
return super.obtainBlockDrops( w, pos );
}
}
}
@@ -19,14 +19,12 @@
package appeng.parts.automation;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Vec3;
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.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
@@ -46,6 +44,7 @@ import appeng.api.parts.IPartRenderHelper;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.CableBusTextures;
import appeng.core.settings.TickRates;
import appeng.core.sync.GuiBridge;
@@ -100,9 +99,9 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
{
rh.setTexture( CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon() );
rh.setTexture( CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon() );
rh.setBounds( 3, 3, 15, 13, 13, 16 );
rh.renderInventoryBox( renderer );
@@ -116,25 +115,24 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
rh.setTexture( CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon() );
rh.setTexture( CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon() );
rh.setBounds( 4, 4, 14, 12, 12, 16 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setBounds( 5, 5, 13, 11, 11, 14 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setBounds( 6, 6, 12, 10, 10, 13 );
rh.renderBlock( x, y, z, renderer );
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
rh.renderBlock( pos, renderer );
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
rh.setBounds( 6, 6, 11, 10, 10, 12 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
this.renderLights( x, y, z, rh, renderer );
this.renderLights( pos, rh, renderer );
}
@Override
@@ -22,22 +22,20 @@ package appeng.parts.automation;
import java.util.Collection;
import java.util.Random;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.player.EntityPlayer;
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.IIcon;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
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.api.config.FuzzyMode;
import appeng.api.config.LevelType;
import appeng.api.config.RedstoneMode;
@@ -70,8 +68,11 @@ 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.IConfigManager;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.CableBusTextures;
import appeng.client.texture.IAESprite;
import appeng.core.sync.GuiBridge;
import appeng.helpers.Reflected;
import appeng.me.GridAccessException;
@@ -143,8 +144,8 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
this.host.markForUpdate();
TileEntity te = this.host.getTile();
this.prevState = isOn;
Platform.notifyBlocksOfNeighbors( te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord );
Platform.notifyBlocksOfNeighbors( te.getWorldObj(), te.xCoord + this.side.offsetX, te.yCoord + this.side.offsetY, te.zCoord + this.side.offsetZ );
Platform.notifyBlocksOfNeighbors( te.getWorld(), te.getPos() );
Platform.notifyBlocksOfNeighbors( te.getWorld(), te.getPos().offset( side.getFacing() ) );
}
}
@@ -191,9 +192,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
}
@Override
public IIcon getBreakingTexture()
public TextureAtlasSprite getBreakingTexture( IRenderHelper renderer )
{
return this.is.getIconIndex();
return renderer.getIcon( is ).getAtlas();
}
@Override
@@ -398,7 +399,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( AEPartLocation dir )
{
return AECableType.SMART;
}
@@ -411,21 +412,17 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
{
rh.setTexture( this.is.getIconIndex() );
Tessellator.instance.startDrawingQuads();
this.renderTorchAtAngle( 0, -0.5, 0 );
Tessellator.instance.draw();
// rh.setBounds( 7, 7, 10, 9, 9, 15 );
// rh.renderInventoryBox( renderer );
rh.setTexture( renderer.getIcon( is ) );
this.renderTorchAtAngle( 0, -0.5, 0, renderer );
}
public void renderTorchAtAngle( double baseX, double baseY, double baseZ )
public void renderTorchAtAngle( double baseX, double baseY, double baseZ, IRenderHelper renderer )
{
boolean isOn = this.isLevelEmitterOn();
IIcon offTexture = this.is.getIconIndex();
IIcon IIcon = ( isOn ? CableBusTextures.LevelEmitterTorchOn.getIcon() : offTexture );
IAESprite offTexture = renderer.getIcon( is );
IAESprite IIcon = ( isOn ? CableBusTextures.LevelEmitterTorchOn.getIcon() : offTexture );
//
this.centerX = baseX + 0.5;
this.centerY = baseY + 0.5;
@@ -438,12 +435,12 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
double Zero = 0;
/*
* double d5 = (double)IIcon.func_94209_e(); double d6 = (double)IIcon.func_94206_g(); double d7 =
* (double)IIcon.func_94212_f(); double d8 = (double)IIcon.func_94210_h(); double d9 =
* (double)IIcon.func_94214_a(7.0D); double d10 = (double)IIcon.func_94207_b(6.0D); double d11 =
* (double)IIcon.func_94214_a(9.0D); double d12 = (double)IIcon.func_94207_b(8.0D); double d13 =
* (double)IIcon.func_94214_a(7.0D); double d14 = (double)IIcon.func_94207_b(13.0D); double d15 =
* (double)IIcon.func_94214_a(9.0D); double d16 = (double)IIcon.func_94207_b(15.0D);
* double d5 = (double)TextureAtlasSprite.func_94209_e(); double d6 = (double)TextureAtlasSprite.func_94206_g(); double d7 =
* (double)TextureAtlasSprite.func_94212_f(); double d8 = (double)TextureAtlasSprite.func_94210_h(); double d9 =
* (double)TextureAtlasSprite.func_94214_a(7.0D); double d10 = (double)TextureAtlasSprite.func_94207_b(6.0D); double d11 =
* (double)TextureAtlasSprite.func_94214_a(9.0D); double d12 = (double)TextureAtlasSprite.func_94207_b(8.0D); double d13 =
* (double)TextureAtlasSprite.func_94214_a(7.0D); double d14 = (double)TextureAtlasSprite.func_94207_b(13.0D); double d15 =
* (double)TextureAtlasSprite.func_94214_a(9.0D); double d16 = (double)TextureAtlasSprite.func_94207_b(15.0D);
*/
float var16 = IIcon.getMinU();
@@ -486,64 +483,63 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
toff = 1.0d / 16.0d;
}
Tessellator var12 = Tessellator.instance;
if( isOn )
{
var12.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
var12.setBrightness( 11 << 20 | 11 << 4 );
renderer.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
renderer.setBrightness( 11 << 20 | 11 << 4 );
}
this.addVertexWithUV( baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var20, var22 );
this.addVertexWithUV( baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var20, var26 );
this.addVertexWithUV( baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var24, var26 );
this.addVertexWithUV( baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var24, var22 );
EnumFacing t = EnumFacing.UP;
this.addVertexWithUV(t,renderer, baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var20, var22 );
this.addVertexWithUV(t,renderer, baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var20, var26 );
this.addVertexWithUV(t,renderer, baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var24, var26 );
this.addVertexWithUV(t,renderer, baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + TorchLen - toff, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var24, var22 );
this.addVertexWithUV( baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var24b, var22b );
this.addVertexWithUV( baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var24b, var26b );
this.addVertexWithUV( baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var20b, var26b );
this.addVertexWithUV( baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var20b, var22b );
this.addVertexWithUV(t,renderer, baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var24b, var22b );
this.addVertexWithUV(t,renderer, baseX + Zero * ( 1.0D - TorchLen ) + var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var24b, var26b );
this.addVertexWithUV(t,renderer, baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) + var44, var20b, var26b );
this.addVertexWithUV(t,renderer, baseX + Zero * ( 1.0D - TorchLen ) - var44, baseY + var422, baseZ + par10 * ( 1.0D - TorchLen ) - var44, var20b, var22b );
this.addVertexWithUV( baseX + var44 + Zero, baseY, baseZ - var44 + par10, var32, var30 );
this.addVertexWithUV( baseX + var44 + Zero, baseY, baseZ + var44 + par10, var32, var34 );
this.addVertexWithUV( baseX - var44 + Zero, baseY, baseZ + var44 + par10, var28, var34 );
this.addVertexWithUV( baseX - var44 + Zero, baseY, baseZ - var44 + par10, var28, var30 );
this.addVertexWithUV(t,renderer, baseX + var44 + Zero, baseY, baseZ - var44 + par10, var32, var30 );
this.addVertexWithUV(t,renderer, baseX + var44 + Zero, baseY, baseZ + var44 + par10, var32, var34 );
this.addVertexWithUV(t,renderer, baseX - var44 + Zero, baseY, baseZ + var44 + par10, var28, var34 );
this.addVertexWithUV(t,renderer, baseX - var44 + Zero, baseY, baseZ - var44 + par10, var28, var30 );
this.addVertexWithUV( baseX - var44, baseY + 1.0D, var40, var16, var18 );
this.addVertexWithUV( baseX - var44 + Zero, baseY + 0.0D, var40 + par10, var16, var19 );
this.addVertexWithUV( baseX - var44 + Zero, baseY + 0.0D, var42 + par10, var17, var19 );
this.addVertexWithUV( baseX - var44, baseY + 1.0D, var42, var17, var18 );
this.addVertexWithUV(t,renderer, baseX - var44, baseY + 1.0D, var40, var16, var18 );
this.addVertexWithUV(t,renderer, baseX - var44 + Zero, baseY + 0.0D, var40 + par10, var16, var19 );
this.addVertexWithUV(t,renderer, baseX - var44 + Zero, baseY + 0.0D, var42 + par10, var17, var19 );
this.addVertexWithUV(t,renderer, baseX - var44, baseY + 1.0D, var42, var17, var18 );
this.addVertexWithUV( baseX + var44, baseY + 1.0D, var42, var16, var18 );
this.addVertexWithUV( baseX + Zero + var44, baseY + 0.0D, var42 + par10, var16, var19 );
this.addVertexWithUV( baseX + Zero + var44, baseY + 0.0D, var40 + par10, var17, var19 );
this.addVertexWithUV( baseX + var44, baseY + 1.0D, var40, var17, var18 );
this.addVertexWithUV(t,renderer, baseX + var44, baseY + 1.0D, var42, var16, var18 );
this.addVertexWithUV(t,renderer, baseX + Zero + var44, baseY + 0.0D, var42 + par10, var16, var19 );
this.addVertexWithUV(t,renderer, baseX + Zero + var44, baseY + 0.0D, var40 + par10, var17, var19 );
this.addVertexWithUV(t,renderer, baseX + var44, baseY + 1.0D, var40, var17, var18 );
this.addVertexWithUV( var36, baseY + 1.0D, baseZ + var44, var16, var18 );
this.addVertexWithUV( var36 + Zero, baseY + 0.0D, baseZ + var44 + par10, var16, var19 );
this.addVertexWithUV( var38 + Zero, baseY + 0.0D, baseZ + var44 + par10, var17, var19 );
this.addVertexWithUV( var38, baseY + 1.0D, baseZ + var44, var17, var18 );
this.addVertexWithUV(t,renderer, var36, baseY + 1.0D, baseZ + var44, var16, var18 );
this.addVertexWithUV(t,renderer, var36 + Zero, baseY + 0.0D, baseZ + var44 + par10, var16, var19 );
this.addVertexWithUV(t,renderer, var38 + Zero, baseY + 0.0D, baseZ + var44 + par10, var17, var19 );
this.addVertexWithUV(t,renderer, var38, baseY + 1.0D, baseZ + var44, var17, var18 );
this.addVertexWithUV( var38, baseY + 1.0D, baseZ - var44, var16, var18 );
this.addVertexWithUV( var38 + Zero, baseY + 0.0D, baseZ - var44 + par10, var16, var19 );
this.addVertexWithUV( var36 + Zero, baseY + 0.0D, baseZ - var44 + par10, var17, var19 );
this.addVertexWithUV( var36, baseY + 1.0D, baseZ - var44, var17, var18 );
this.addVertexWithUV(t,renderer, var38, baseY + 1.0D, baseZ - var44, var16, var18 );
this.addVertexWithUV(t,renderer, var38 + Zero, baseY + 0.0D, baseZ - var44 + par10, var16, var19 );
this.addVertexWithUV(t,renderer, var36 + Zero, baseY + 0.0D, baseZ - var44 + par10, var17, var19 );
this.addVertexWithUV(t,renderer, var36, baseY + 1.0D, baseZ - var44, var17, var18 );
}
public void addVertexWithUV( double x, double y, double z, double u, double v )
public void addVertexWithUV( EnumFacing face, IRenderHelper renderer, double x, double y, double z, double u, double v )
{
Tessellator var12 = Tessellator.instance;
x -= this.centerX;
y -= this.centerY;
z -= this.centerZ;
if( this.side == ForgeDirection.DOWN )
if( this.side == AEPartLocation.DOWN )
{
y = -y;
z = -z;
}
if( this.side == ForgeDirection.EAST )
if( this.side == AEPartLocation.EAST )
{
double m = x;
x = y;
@@ -551,14 +547,14 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
y = -y;
}
if( this.side == ForgeDirection.WEST )
if( this.side == AEPartLocation.WEST )
{
double m = x;
x = -y;
y = m;
}
if( this.side == ForgeDirection.SOUTH )
if( this.side == AEPartLocation.SOUTH )
{
double m = z;
z = y;
@@ -566,7 +562,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
y = -y;
}
if( this.side == ForgeDirection.NORTH )
if( this.side == AEPartLocation.NORTH )
{
double m = z;
z = -y;
@@ -577,14 +573,14 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
y += this.centerY;// + orientation.offsetY * 0.4;
z += this.centerZ;// + orientation.offsetZ * 0.4;
var12.addVertexWithUV( x, y, z, u, v );
renderer.addVertexWithUV( face, x, y, z, u, v );
}
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
rh.setTexture( this.is.getIconIndex() );
rh.setTexture( renderer.getIcon( is ) );
// rh.setTexture( CableBusTextures.ItemPartLevelEmitterOn.getIcon() );
// rh.setBounds( 2, 2, 14, 14, 14, 16 );
@@ -595,16 +591,15 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
renderer.renderAllFaces = true;
Tessellator tess = Tessellator.instance;
tess.setBrightness( rh.getBlock().getMixedBrightnessForBlock( this.getHost().getTile().getWorldObj(), x, y, z ) );
tess.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
renderer.setBrightness( rh.getBlock().getMixedBrightnessForBlock( this.getHost().getTile().getWorld(), pos ) );
renderer.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
this.renderTorchAtAngle( x, y, z );
this.renderTorchAtAngle( pos.getX(),pos.getY(),pos.getZ(),renderer );
renderer.renderAllFaces = false;
rh.setBounds( 7, 7, 11, 9, 9, 12 );
this.renderLights( x, y, z, rh, renderer );
this.renderLights( pos, rh, renderer );
// super.renderWorldBlock( world, x, y, z, block, modelId, renderer );
}
@@ -622,17 +617,20 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
}
@Override
public void randomDisplayTick( World world, int x, int y, int z, Random r )
public void randomDisplayTick(
World world,
BlockPos pos,
Random r )
{
if( this.isLevelEmitterOn() )
{
ForgeDirection d = this.side;
AEPartLocation d = this.side;
double d0 = d.offsetX * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
double d1 = d.offsetY * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
double d2 = d.offsetZ * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
double d0 = d.xOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
double d1 = d.yOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
double d2 = d.zOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
world.spawnParticle( "reddust", 0.5 + x + d0, 0.5 + y + d1, 0.5 + z + d2, 0.0D, 0.0D, 0.0D );
world.spawnParticle( EnumParticleTypes.REDSTONE, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0.0D, 0.0D, 0.0D, new int[0] );
}
}
@@ -22,8 +22,8 @@ package appeng.parts.automation;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import appeng.api.config.RedstoneMode;
import appeng.api.config.Upgrades;
import appeng.api.networking.ticking.IGridTickable;
@@ -105,7 +105,7 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
InventoryAdaptor getHandler()
{
TileEntity self = this.getHost().getTile();
TileEntity target = this.getTileEntity( self, self.xCoord + this.side.offsetX, self.yCoord + this.side.offsetY, self.zCoord + this.side.offsetZ );
TileEntity target = this.getTileEntity( self, self.getPos().offset( side.getFacing() ) );
int newAdaptorHash = Platform.generateTileHash( target );
@@ -115,18 +115,18 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
}
this.adaptorHash = newAdaptorHash;
this.adaptor = InventoryAdaptor.getAdaptor( target, this.side.getOpposite() );
this.adaptor = InventoryAdaptor.getAdaptor( target, this.side.getFacing().getOpposite() );
return this.adaptor;
}
private TileEntity getTileEntity( TileEntity self, int x, int y, int z )
private TileEntity getTileEntity( TileEntity self, BlockPos pos )
{
World w = self.getWorldObj();
World w = self.getWorld();
if( w.getChunkProvider().chunkExists( x >> 4, z >> 4 ) )
if( w.getChunkProvider().chunkExists( pos.getX() >> 4, pos.getZ() >> 4 ) )
{
return w.getTileEntity( x, y, z );
return w.getTileEntity( pos );
}
return null;
@@ -23,7 +23,6 @@ import java.util.List;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import appeng.api.config.RedstoneMode;
import appeng.api.config.Upgrades;
import appeng.api.util.IConfigManager;
@@ -2,7 +2,6 @@ package appeng.parts.automation;
import net.minecraft.item.ItemStack;
import appeng.api.config.Upgrades;
import appeng.tile.inventory.IAEAppEngInventory;
import appeng.util.Platform;
@@ -18,6 +17,7 @@ public class StackUpgradeInventory extends UpgradeInventory
this.stack = stack;
}
@Override
public int getMaxInstalled( Upgrades upgrades )
{
int max = 0;
@@ -23,7 +23,6 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import appeng.api.config.Upgrades;
import appeng.api.implementations.items.IUpgradeModule;
import appeng.tile.inventory.AppEngInternalInventory;
@@ -24,6 +24,7 @@ import java.util.List;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
public class InvLayerData
@@ -104,7 +105,7 @@ public class InvLayerData
}
}
public boolean canExtractItem( int slot, ItemStack itemstack, int side )
public boolean canExtractItem( int slot, ItemStack itemstack, EnumFacing side )
{
if( this.isSlotValid( slot ) )
{
@@ -114,7 +115,7 @@ public class InvLayerData
return false;
}
public boolean canInsertItem( int slot, ItemStack itemstack, int side )
public boolean canInsertItem( int slot, ItemStack itemstack, EnumFacing side )
{
if( this.isSlotValid( slot ) )
{
@@ -135,12 +136,12 @@ public class InvLayerData
}
}
public int[] getAccessibleSlotsFromSide( int side )
public int[] getSlotsForFace( EnumFacing side )
{
if( this.sides == null || side < 0 || side > 5 )
if( this.sides == null || side == null )
{
return NULL_SIDES;
}
return this.sides[side];
return this.sides[side.ordinal()];
}
}
@@ -21,6 +21,7 @@ package appeng.parts.layers;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
public class InvSot
@@ -55,12 +56,12 @@ public class InvSot
this.partInv.setInventorySlotContents( this.index, itemstack );
}
public boolean canExtractItem( ItemStack itemstack, int side )
public boolean canExtractItem( ItemStack itemstack, EnumFacing side )
{
return this.partInv.canExtractItem( this.index, itemstack, side );
}
public boolean canInsertItem( ItemStack itemstack, int side )
public boolean canInsertItem( ItemStack itemstack, EnumFacing side )
{
return this.partInv.canInsertItem( this.index, itemstack, side );
}
@@ -19,15 +19,13 @@
package appeng.parts.layers;
import net.minecraftforge.common.util.ForgeDirection;
import cofh.api.energy.IEnergyConnection;
import cofh.api.energy.IEnergyHandler;
import cofh.api.energy.IEnergyProvider;
import cofh.api.energy.IEnergyReceiver;
import appeng.api.parts.IPart;
import appeng.api.parts.LayerBase;
import appeng.api.util.ForgeDirection;
public class LayerIEnergyHandler extends LayerBase implements IEnergyHandler
@@ -22,16 +22,14 @@ package appeng.parts.layers;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import ic2.api.energy.tile.IEnergyAcceptor;
import ic2.api.energy.tile.IEnergySink;
import ic2.api.energy.tile.IEnergyTile;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartHost;
import appeng.api.parts.LayerBase;
import appeng.api.parts.LayerFlags;
import appeng.api.util.ForgeDirection;
import appeng.util.Platform;
@@ -51,7 +49,7 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
return null;
}
return this.getEnergySinkTile().getWorldObj();
return this.getEnergySinkTile().getWorld();
}
private boolean isTileValid()
@@ -63,7 +61,7 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
return false;
}
return !te.isInvalid() && te.getWorldObj().blockExists( te.xCoord, te.yCoord, te.zCoord );
return !te.isInvalid() && te.getWorld().blockExists( te.xCoord, te.yCoord, te.zCoord );
}
private void addToENet()
@@ -22,17 +22,15 @@ package appeng.parts.layers;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import ic2.api.energy.tile.IEnergyEmitter;
import ic2.api.energy.tile.IEnergySink;
import ic2.api.energy.tile.IEnergySource;
import ic2.api.energy.tile.IEnergyTile;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartHost;
import appeng.api.parts.LayerBase;
import appeng.api.parts.LayerFlags;
import appeng.api.util.ForgeDirection;
import appeng.util.Platform;
@@ -51,7 +49,7 @@ public class LayerIEnergySource extends LayerBase implements IEnergySource
{
return null;
}
return this.getEnergySourceTile().getWorldObj();
return this.getEnergySourceTile().getWorld();
}
private boolean isTileValid()
@@ -19,13 +19,12 @@
package appeng.parts.layers;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import appeng.api.parts.IPart;
import appeng.api.parts.LayerBase;
import appeng.api.util.ForgeDirection;
public class LayerIFluidHandler extends LayerBase implements IFluidHandler
@@ -19,13 +19,11 @@
package appeng.parts.layers;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.transport.IPipeConnection;
import buildcraft.api.transport.IPipeTile.PipeType;
import appeng.api.parts.IPart;
import appeng.api.parts.LayerBase;
import appeng.api.util.ForgeDirection;
public class LayerIPipeConnection extends LayerBase implements IPipeConnection
@@ -27,11 +27,12 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IChatComponent;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartHost;
import appeng.api.parts.LayerBase;
import appeng.api.util.AEPartLocation;
/**
@@ -66,7 +67,7 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
inventories = new ArrayList<ISidedInventory>();
int slotCount = 0;
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
for( AEPartLocation side : AEPartLocation.SIDE_LOCATIONS )
{
IPart bp = this.getPart( side );
if( bp instanceof ISidedInventory )
@@ -93,8 +94,8 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
offsetForPart = 0;
slotCount = sides.getSizeInventory();
ForgeDirection currentSide = ForgeDirection.UNKNOWN;
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
AEPartLocation currentSide = AEPartLocation.INTERNAL;
for( AEPartLocation side : AEPartLocation.SIDE_LOCATIONS )
{
if( this.getPart( side ) == sides )
{
@@ -178,13 +179,13 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
}
@Override
public String getInventoryName()
public String getName()
{
return "AEMultiPart";
}
@Override
public boolean hasCustomInventoryName()
public boolean hasCustomName()
{
return false;
}
@@ -202,12 +203,12 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
}
@Override
public void openInventory()
public void openInventory(EntityPlayer player)
{
}
@Override
public void closeInventory()
public void closeInventory(EntityPlayer player)
{
}
@@ -234,18 +235,18 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
}
@Override
public int[] getAccessibleSlotsFromSide( int side )
public int[] getSlotsForFace( EnumFacing side )
{
if( this.invLayer != null )
{
return this.invLayer.getAccessibleSlotsFromSide( side );
return this.invLayer.getSlotsForFace( side );
}
return NULL_SIDES;
}
@Override
public boolean canInsertItem( int slot, ItemStack itemstack, int side )
public boolean canInsertItem( int slot, ItemStack itemstack, EnumFacing side )
{
if( this.invLayer == null )
{
@@ -256,7 +257,7 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
}
@Override
public boolean canExtractItem( int slot, ItemStack itemstack, int side )
public boolean canExtractItem( int slot, ItemStack itemstack, EnumFacing side )
{
if( this.invLayer == null )
{
@@ -265,4 +266,37 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
return this.invLayer.canExtractItem( slot, itemstack, side );
}
@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()
{
}
@Override
public IChatComponent getDisplayName()
{
return null;
}
}
@@ -19,8 +19,7 @@
package appeng.parts.layers;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import appeng.api.implementations.tiles.ITileStorageMonitorable;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.parts.IPart;
@@ -32,7 +31,7 @@ public class LayerITileStorageMonitorable extends LayerBase implements ITileStor
{
@Override
public IStorageMonitorable getMonitorable( ForgeDirection side, BaseActionSource src )
public IStorageMonitorable getMonitorable( EnumFacing side, BaseActionSource src )
{
IPart part = this.getPart( side );
if( part instanceof ITileStorageMonitorable )
@@ -20,15 +20,12 @@ package appeng.parts.layers;
import javax.annotation.Nullable;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import li.cil.oc.api.network.Node;
import li.cil.oc.api.network.SidedEnvironment;
import appeng.api.parts.IPart;
import appeng.api.parts.LayerBase;
import appeng.api.util.ForgeDirection;
import appeng.core.Registration;
import appeng.helpers.Reflected;
@@ -19,44 +19,42 @@
package appeng.parts.misc;
import io.netty.buffer.ByteBuf;
import java.io.IOException;
import java.util.List;
import java.util.Random;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
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.api.networking.IGridNode;
import appeng.api.parts.BusSupport;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.parts.ISimplifiedBundle;
import appeng.api.parts.PartItemStack;
import appeng.api.util.AEPartLocation;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.IAESprite;
public class PartCableAnchor implements IPart
{
protected ISimplifiedBundle renderCache = null;
ItemStack is = null;
IPartHost host = null;
ForgeDirection mySide = ForgeDirection.UP;
AEPartLocation mySide = AEPartLocation.UP;
public PartCableAnchor( ItemStack is )
{
@@ -84,9 +82,9 @@ public class PartCableAnchor implements IPart
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper instance, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper instance, IRenderHelper renderer )
{
instance.setTexture( this.is.getIconIndex() );
instance.setTexture( renderer.getIcon( is ) );
instance.setBounds( 7, 7, 4, 9, 9, 14 );
instance.renderInventoryBox( renderer );
instance.setTexture( null );
@@ -94,10 +92,9 @@ public class PartCableAnchor implements IPart
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
IIcon myIcon = this.is.getIconIndex();
IAESprite myIcon = renderer.getIcon( is );
rh.setTexture( myIcon );
if( this.host != null && this.host.getFacadeContainer().getFacade( this.mySide ) != null )
{
@@ -107,19 +104,19 @@ public class PartCableAnchor implements IPart
{
rh.setBounds( 7, 7, 10, 9, 9, 16 );
}
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setTexture( null );
}
@Override
@SideOnly( Side.CLIENT )
public void renderDynamic( double x, double y, double z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderDynamic( double x, double y, double z, IPartRenderHelper rh, IRenderHelper renderer )
{
}
@Override
public IIcon getBreakingTexture()
public TextureAtlasSprite getBreakingTexture( IRenderHelper renderer)
{
return null;
}
@@ -163,7 +160,7 @@ public class PartCableAnchor implements IPart
@Override
public boolean isLadder( EntityLivingBase entity )
{
return this.mySide.offsetY == 0 && ( entity.isCollidedHorizontally || !entity.onGround );
return this.mySide.yOffset == 0 && ( entity.isCollidedHorizontally || !entity.onGround );
}
@Override
@@ -227,7 +224,7 @@ public class PartCableAnchor implements IPart
}
@Override
public void setPartHostInfo( ForgeDirection side, IPartHost host, TileEntity tile )
public void setPartHostInfo( AEPartLocation side, IPartHost host, TileEntity tile )
{
this.host = host;
this.mySide = side;
@@ -258,14 +255,16 @@ public class PartCableAnchor implements IPart
}
@Override
@SideOnly( Side.CLIENT )
public void randomDisplayTick( World world, int x, int y, int z, Random r )
public void randomDisplayTick(
World world,
BlockPos pos,
Random r )
{
}
@Override
public void onPlacement( EntityPlayer player, ItemStack held, ForgeDirection side )
public void onPlacement( EntityPlayer player, ItemStack held, AEPartLocation side )
{
}
@@ -22,9 +22,7 @@ package appeng.parts.misc;
import java.util.EnumSet;
import java.util.List;
import com.google.common.collect.ImmutableSet;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
@@ -32,13 +30,12 @@ import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection;
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.api.config.Actionable;
import appeng.api.config.Upgrades;
import appeng.api.implementations.tiles.ITileStorageMonitorable;
@@ -60,6 +57,7 @@ import appeng.api.storage.IStorageMonitorable;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.IConfigManager;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.CableBusTextures;
import appeng.core.sync.GuiBridge;
import appeng.helpers.DualityInterface;
@@ -72,6 +70,8 @@ import appeng.tile.inventory.InvOperation;
import appeng.util.Platform;
import appeng.util.inv.IInventoryDestination;
import com.google.common.collect.ImmutableSet;
public class PartInterface extends PartBasicState implements IGridTickable, IStorageMonitorable, IInventoryDestination, IInterfaceHost, ISidedInventory, IAEAppEngInventory, ITileStorageMonitorable, IPriorityHost
{
@@ -111,9 +111,9 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
{
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
rh.setBounds( 2, 2, 14, 14, 14, 16 );
rh.renderInventoryBox( renderer );
@@ -133,25 +133,24 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
rh.setBounds( 2, 2, 14, 14, 14, 16 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
rh.setBounds( 5, 5, 12, 11, 11, 13 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
rh.setBounds( 5, 5, 13, 11, 11, 14 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
this.renderLights( x, y, z, rh, renderer );
this.renderLights( pos, rh, renderer );
}
@Override
@@ -216,9 +215,9 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
}
@Override
public IIcon getBreakingTexture()
public TextureAtlasSprite getBreakingTexture(IRenderHelper renderer)
{
return this.is.getIconIndex();
return renderer.getIcon( is ).getAtlas();
}
@Override
@@ -282,15 +281,15 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
}
@Override
public String getInventoryName()
public String getName()
{
return this.duality.getStorage().getInventoryName();
return this.duality.getStorage().getName();
}
@Override
public boolean hasCustomInventoryName()
public boolean hasCustomName()
{
return this.duality.getStorage().hasCustomInventoryName();
return this.duality.getStorage().hasCustomName();
}
@Override
@@ -312,15 +311,15 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
}
@Override
public void openInventory()
public void openInventory( EntityPlayer player )
{
this.duality.getStorage().openInventory();
this.duality.getStorage().openInventory(player);
}
@Override
public void closeInventory()
public void closeInventory( EntityPlayer player )
{
this.duality.getStorage().closeInventory();
this.duality.getStorage().closeInventory(player);
}
@Override
@@ -330,19 +329,19 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
}
@Override
public int[] getAccessibleSlotsFromSide( int s )
public int[] getSlotsForFace( EnumFacing side )
{
return this.duality.getAccessibleSlotsFromSide( s );
return this.duality.getSlotsForFace( side );
}
@Override
public boolean canInsertItem( int i, ItemStack itemstack, int j )
public boolean canInsertItem( int i, ItemStack itemstack, EnumFacing j )
{
return true;
}
@Override
public boolean canExtractItem( int i, ItemStack itemstack, int j )
public boolean canExtractItem( int i, ItemStack itemstack, EnumFacing j )
{
return true;
}
@@ -360,9 +359,9 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
}
@Override
public EnumSet<ForgeDirection> getTargets()
public EnumSet<EnumFacing> getTargets()
{
return EnumSet.of( this.side );
return EnumSet.of( this.side.getFacing() );
}
@Override
@@ -372,7 +371,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
}
@Override
public IStorageMonitorable getMonitorable( ForgeDirection side, BaseActionSource src )
public IStorageMonitorable getMonitorable( EnumFacing side, BaseActionSource src )
{
return this.duality.getMonitorable( side, src, this );
}
@@ -424,4 +423,37 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
{
this.duality.setPriority( newValue );
}
@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()
{
}
@Override
public IChatComponent getDisplayName()
{
return null;
}
}
@@ -20,7 +20,6 @@ package appeng.parts.misc;
import net.minecraft.item.ItemStack;
import appeng.helpers.Reflected;
@@ -23,21 +23,15 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import buildcraft.api.transport.IPipeConnection;
import buildcraft.api.transport.IPipeTile.PipeType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
import appeng.api.config.FuzzyMode;
@@ -69,7 +63,9 @@ import appeng.api.storage.IMEMonitorHandlerReceiver;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.AEPartLocation;
import appeng.api.util.IConfigManager;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.CableBusTextures;
import appeng.core.settings.TickRates;
import appeng.core.stats.Achievements;
@@ -83,15 +79,13 @@ import appeng.me.storage.MEMonitorIInventory;
import appeng.parts.automation.PartUpgradeable;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.tile.inventory.InvOperation;
import appeng.transformer.annotations.Integration.Interface;
import appeng.transformer.annotations.Integration.Method;
import appeng.util.Platform;
import appeng.util.prioitylist.FuzzyPriorityList;
import appeng.util.prioitylist.PrecisePriorityList;
@Interface( iname = "BC", iface = "buildcraft.api.transport.IPipeConnection" )
public class PartStorageBus extends PartUpgradeable implements IGridTickable, ICellContainer, IMEMonitorHandlerReceiver<IAEItemStack>, IPipeConnection, IPriorityHost
// TODO: BC PIPE INTEGRATION
//@Interface( iname = "BC", iface = "buildcraft.api.transport.IPipeConnection" ) - IPipeConnection
public class PartStorageBus extends PartUpgradeable implements IGridTickable, ICellContainer, IMEMonitorHandlerReceiver<IAEItemStack>, IPriorityHost
{
final BaseActionSource mySrc;
final AppEngInternalAEInventory Config = new AppEngInternalAEInventory( this, 63 );
@@ -204,7 +198,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
private void resetCache( boolean fullReset )
{
if( this.host == null || this.host.getTile() == null || this.host.getTile().getWorldObj() == null || this.host.getTile().getWorldObj().isRemote )
if( this.host == null || this.host.getTile() == null || this.host.getTile().getWorld() == null || this.host.getTile().getWorld().isRemote )
{
return;
}
@@ -266,9 +260,9 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
{
rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() );
rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() );
rh.setBounds( 3, 3, 15, 13, 13, 16 );
rh.renderInventoryBox( renderer );
@@ -282,28 +276,27 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() );
rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() );
rh.setBounds( 3, 3, 15, 13, 13, 16 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setBounds( 2, 2, 14, 14, 14, 15 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() );
rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() );
rh.setBounds( 5, 5, 12, 11, 11, 13 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
rh.setBounds( 5, 5, 13, 11, 11, 14 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
this.renderLights( x, y, z, rh, renderer );
this.renderLights( pos, rh, renderer );
}
@Override
@@ -402,7 +395,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
this.cached = true;
TileEntity self = this.getHost().getTile();
TileEntity target = self.getWorldObj().getTileEntity( self.xCoord + this.side.offsetX, self.yCoord + this.side.offsetY, self.zCoord + this.side.offsetZ );
TileEntity target = self.getWorld().getTileEntity( self.getPos().offset( side.getFacing() ) );
int newHandlerHash = Platform.generateTileHash( target );
@@ -426,10 +419,10 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
this.monitor = null;
if( target != null )
{
IExternalStorageHandler esh = AEApi.instance().registries().externalStorage().getHandler( target, this.side.getOpposite(), StorageChannel.ITEMS, this.mySrc );
IExternalStorageHandler esh = AEApi.instance().registries().externalStorage().getHandler( target, this.side.getFacing().getOpposite(), StorageChannel.ITEMS, this.mySrc );
if( esh != null )
{
IMEInventory inv = esh.getInventory( target, this.side.getOpposite(), StorageChannel.ITEMS, this.mySrc );
IMEInventory inv = esh.getInventory( target, this.side.getFacing().getOpposite(), StorageChannel.ITEMS, this.mySrc );
if( inv instanceof MEMonitorIInventory )
{
@@ -506,7 +499,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
return this.handler;
}
private void checkInterfaceVsStorageBus( TileEntity target, ForgeDirection side )
private void checkInterfaceVsStorageBus( TileEntity target, AEPartLocation side )
{
IInterfaceHost achievement = null;
@@ -564,13 +557,15 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
{
}
// TODO: BC PIPE INTEGRATION
/*
@Override
@Method( iname = "BC" )
public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with )
public ConnectOverride overridePipeConnection( PipeType type, AEPartLocation with )
{
return type == PipeType.ITEM && with == this.side ? ConnectOverride.CONNECT : ConnectOverride.DISCONNECT;
}
*/
@Override
public void saveChanges( IMEInventory cellInventory )
{
@@ -23,18 +23,16 @@ import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import appeng.api.AEApi;
import appeng.api.exceptions.FailedConnection;
@@ -44,6 +42,8 @@ import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.CableBusTextures;
import appeng.helpers.Reflected;
import appeng.me.helpers.AENetworkProxy;
@@ -70,10 +70,10 @@ public class PartToggleBus extends PartBasicState
}
@Override
public void setColors( boolean hasChan, boolean hasPower )
public void setColors( IRenderHelper renderer, boolean hasChan, boolean hasPower )
{
this.hasRedstone = ( this.clientFlags & this.REDSTONE_FLAG ) == this.REDSTONE_FLAG;
super.setColors( hasChan && this.hasRedstone, hasPower && this.hasRedstone );
super.setColors( renderer, hasChan && this.hasRedstone, hasPower && this.hasRedstone );
}
@Override
@@ -88,13 +88,13 @@ public class PartToggleBus extends PartBasicState
}
@Override
public IIcon getBreakingTexture()
public TextureAtlasSprite getBreakingTexture( IRenderHelper renderer )
{
return this.is.getIconIndex();
return renderer.getIcon( is ).getAtlas();
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( AEPartLocation dir )
{
return AECableType.GLASS;
}
@@ -107,7 +107,7 @@ public class PartToggleBus extends PartBasicState
List<ItemStack> items = new ArrayList<ItemStack>();
items.add( this.is.copy() );
this.host.removePart( this.side, false );
Platform.spawnDrops( this.tile.getWorldObj(), this.tile.xCoord, this.tile.yCoord, this.tile.zCoord, items );
Platform.spawnDrops( this.tile.getWorld(), this.tile.getPos(), items );
this.is.stackSize = 0;
}
}
@@ -120,11 +120,11 @@ public class PartToggleBus extends PartBasicState
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
{
GL11.glTranslated( -0.2, -0.3, 0.0 );
rh.setTexture( this.is.getIconIndex() );
rh.setTexture( renderer.getIcon( is ) );
rh.setBounds( 6, 6, 14 - 4, 10, 10, 16 - 4 );
rh.renderInventoryBox( renderer );
@@ -145,23 +145,22 @@ public class PartToggleBus extends PartBasicState
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
rh.setTexture( this.is.getIconIndex() );
rh.setTexture( renderer.getIcon( is ) );
rh.setBounds( 6, 6, 14, 10, 10, 16 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setBounds( 6, 6, 11, 10, 10, 13 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
rh.setBounds( 6, 6, 13, 10, 10, 14 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
this.renderLights( x, y, z, rh, renderer );
this.renderLights( pos, rh, renderer );
}
@Override
@@ -208,10 +207,10 @@ public class PartToggleBus extends PartBasicState
}
@Override
public void setPartHostInfo( ForgeDirection side, IPartHost host, TileEntity tile )
public void setPartHostInfo( AEPartLocation side, IPartHost host, TileEntity tile )
{
super.setPartHostInfo( side, host, tile );
this.outerProxy.setValidSides( EnumSet.of( side ) );
this.outerProxy.setValidSides( EnumSet.of( side.getFacing() ) );
}
@Override
@@ -227,7 +226,7 @@ public class PartToggleBus extends PartBasicState
}
@Override
public void onPlacement( EntityPlayer player, ItemStack held, ForgeDirection side )
public void onPlacement( EntityPlayer player, ItemStack held, AEPartLocation side )
{
super.onPlacement( player, held, side );
this.outerProxy.setOwner( player );
@@ -19,24 +19,22 @@
package appeng.parts.networking;
import io.netty.buffer.ByteBuf;
import java.io.IOException;
import java.util.EnumSet;
import org.lwjgl.opengl.GL11;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import appeng.api.AEApi;
import appeng.api.config.SecurityPermissions;
@@ -54,10 +52,13 @@ import appeng.api.parts.IPartRenderHelper;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.api.util.AEColoredItemDefinition;
import appeng.api.util.AEPartLocation;
import appeng.api.util.IReadOnlyCollection;
import appeng.block.AEBaseBlock;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.CableBusTextures;
import appeng.client.texture.FlippableIcon;
import appeng.client.texture.IAESprite;
import appeng.client.texture.TaughtIcon;
import appeng.items.parts.ItemMultiPart;
import appeng.me.GridAccessException;
@@ -71,7 +72,7 @@ public class PartCable extends AEBasePart implements IPartCable
final int[] channelsOnSide = new int[] { 0, 0, 0, 0, 0, 0 };
EnumSet<ForgeDirection> connections = EnumSet.noneOf( ForgeDirection.class );
EnumSet<AEPartLocation> connections = EnumSet.noneOf( AEPartLocation.class );
boolean powered = false;
public PartCable( ItemStack is )
@@ -144,8 +145,8 @@ public class PartCable extends AEBasePart implements IPartCable
return true;
}
this.getHost().removePart( ForgeDirection.UNKNOWN, true );
this.getHost().addPart( newPart, ForgeDirection.UNKNOWN, who );
this.getHost().removePart( AEPartLocation.INTERNAL, true );
this.getHost().addPart( newPart, AEPartLocation.INTERNAL, who );
return true;
}
}
@@ -153,15 +154,16 @@ public class PartCable extends AEBasePart implements IPartCable
}
@Override
public void setValidSides( EnumSet<ForgeDirection> sides )
public void setValidSides(
EnumSet<EnumFacing> sides )
{
this.proxy.setValidSides( sides );
}
@Override
public boolean isConnected( ForgeDirection side )
public boolean isConnected( EnumFacing side )
{
return this.connections.contains( side );
return this.connections.contains( AEPartLocation.fromFacing( side ) );
}
public void markForUpdate()
@@ -190,7 +192,7 @@ public class PartCable extends AEBasePart implements IPartCable
IPartHost ph = this.getHost();
if( ph != null )
{
for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
for( AEPartLocation dir : AEPartLocation.SIDE_LOCATIONS )
{
IPart p = ph.getPart( dir );
if( p instanceof IGridHost )
@@ -228,7 +230,7 @@ public class PartCable extends AEBasePart implements IPartCable
}
}
for( ForgeDirection of : this.connections )
for( AEPartLocation of : this.connections )
{
switch( of )
{
@@ -257,22 +259,22 @@ public class PartCable extends AEBasePart implements IPartCable
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
{
GL11.glTranslated( -0.0, -0.0, 0.3 );
rh.setTexture( this.getTexture( this.getCableColor() ) );
rh.setTexture( this.getTexture( this.getCableColor(),renderer ) );
rh.setBounds( 6.0f, 6.0f, 2.0f, 10.0f, 10.0f, 14.0f );
rh.renderInventoryBox( renderer );
rh.setTexture( null );
}
public IIcon getTexture( AEColor c )
public IAESprite getTexture( AEColor c,IRenderHelper renderer )
{
return this.getGlassTexture( c );
return this.getGlassTexture( c,renderer );
}
public IIcon getGlassTexture( AEColor c )
public IAESprite getGlassTexture( AEColor c,IRenderHelper renderer )
{
switch( c )
{
@@ -314,7 +316,7 @@ public class PartCable extends AEBasePart implements IPartCable
final AEColoredItemDefinition glassCable = AEApi.instance().definitions().parts().cableGlass();
final ItemStack glassCableStack = glassCable.stack( AEColor.Transparent, 1 );
return glassCable.item( AEColor.Transparent ).getIconIndex( glassCableStack );
return renderer.getIcon( glassCableStack );
}
@Override
@@ -325,13 +327,12 @@ public class PartCable extends AEBasePart implements IPartCable
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
boolean useCovered = false;
boolean requireDetailed = false;
for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
for( AEPartLocation dir : AEPartLocation.SIDE_LOCATIONS )
{
IPart p = this.getHost().getPart( dir );
if( p instanceof IGridHost )
@@ -346,7 +347,7 @@ public class PartCable extends AEBasePart implements IPartCable
}
else if( this.connections.contains( dir ) )
{
TileEntity te = this.tile.getWorldObj().getTileEntity( x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ );
TileEntity te = this.tile.getWorld().getTileEntity( pos.offset( dir.getFacing() ) );
IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null;
IGridHost gh = te instanceof IGridHost ? (IGridHost) te : null;
if( partHost == null && gh != null && gh.getCableConnectionType( dir ) != AECableType.GLASS )
@@ -358,15 +359,15 @@ public class PartCable extends AEBasePart implements IPartCable
if( useCovered )
{
rh.setTexture( this.getCoveredTexture( this.getCableColor() ) );
rh.setTexture( this.getCoveredTexture( this.getCableColor(), renderer ) );
}
else
{
rh.setTexture( this.getTexture( this.getCableColor() ) );
rh.setTexture( this.getTexture( this.getCableColor(),renderer ) );
}
IPartHost ph = this.getHost();
for( ForgeDirection of : EnumSet.complementOf( this.connections ) )
for( AEPartLocation of : EnumSet.complementOf( this.connections ) )
{
IPart bp = ph.getPart( of );
if( bp instanceof IGridHost )
@@ -397,7 +398,7 @@ public class PartCable extends AEBasePart implements IPartCable
default:
continue;
}
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
}
}
}
@@ -407,27 +408,27 @@ public class PartCable extends AEBasePart implements IPartCable
if( useCovered )
{
rh.setBounds( 5, 5, 5, 11, 11, 11 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
}
else
{
rh.setBounds( 6, 6, 6, 10, 10, 10 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
}
for( ForgeDirection of : this.connections )
for( AEPartLocation of : this.connections )
{
this.renderGlassConnection( x, y, z, rh, renderer, of );
this.renderGlassConnection( pos, rh, renderer, of );
}
}
else
{
IIcon def = this.getTexture( this.getCableColor() );
IAESprite def = this.getTexture( this.getCableColor(), renderer );
rh.setTexture( def );
for( ForgeDirection of : this.connections )
for( AEPartLocation of : this.connections )
{
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of, of.getOpposite() ) ) );
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of.getFacing(), of.getFacing().getOpposite() ) ) );
switch( of )
{
case DOWN:
@@ -449,10 +450,10 @@ public class PartCable extends AEBasePart implements IPartCable
}
}
rh.renderBlockCurrentBounds( x, y, z, renderer );
rh.renderBlockCurrentBounds( pos, renderer );
}
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
rh.setFacesToRender( EnumSet.allOf( EnumFacing.class ) );
rh.setTexture( null );
}
@@ -487,7 +488,7 @@ public class PartCable extends AEBasePart implements IPartCable
IGridNode n = this.getGridNode();
if( n != null )
{
for( ForgeDirection thisSide : ForgeDirection.VALID_DIRECTIONS )
for( AEPartLocation thisSide : AEPartLocation.SIDE_LOCATIONS )
{
IPart part = this.getHost().getPart( thisSide );
if( part != null )
@@ -512,8 +513,8 @@ public class PartCable extends AEBasePart implements IPartCable
for( IGridConnection gc : n.getConnections() )
{
ForgeDirection side = gc.getDirection( n );
if( side != ForgeDirection.UNKNOWN )
AEPartLocation side = gc.getDirection( n );
if( side != AEPartLocation.INTERNAL )
{
boolean isTier2a = this.proxy.getNode().hasFlag( GridFlags.DENSE_CAPACITY );
boolean isTier2b = gc.getOtherSide( this.proxy.getNode() ).hasFlag( GridFlags.DENSE_CAPACITY );
@@ -535,7 +536,7 @@ public class PartCable extends AEBasePart implements IPartCable
{
if( this.proxy.getEnergy().isNetworkPowered() )
{
cs |= ( 1 << ForgeDirection.UNKNOWN.ordinal() );
cs |= ( 1 << AEPartLocation.INTERNAL.ordinal() );
}
}
catch( GridAccessException e )
@@ -553,14 +554,14 @@ public class PartCable extends AEBasePart implements IPartCable
int cs = data.readByte();
int sideOut = data.readInt();
EnumSet<ForgeDirection> myC = this.connections.clone();
EnumSet<AEPartLocation> myC = this.connections.clone();
boolean wasPowered = this.powered;
this.powered = false;
boolean channelsChanged = false;
for( ForgeDirection d : ForgeDirection.values() )
for( AEPartLocation d : AEPartLocation.values() )
{
if( d != ForgeDirection.UNKNOWN )
if( d != AEPartLocation.INTERNAL )
{
int ch = ( sideOut >> ( d.ordinal() * 4 ) ) & 0xF;
if( ch != this.channelsOnSide[d.ordinal()] )
@@ -570,7 +571,7 @@ public class PartCable extends AEBasePart implements IPartCable
}
}
if( d == ForgeDirection.UNKNOWN )
if( d == AEPartLocation.INTERNAL )
{
int id = 1 << d.ordinal();
if( id == ( cs & id ) )
@@ -597,12 +598,12 @@ public class PartCable extends AEBasePart implements IPartCable
@Override
@SideOnly( Side.CLIENT )
public IIcon getBreakingTexture()
public TextureAtlasSprite getBreakingTexture( IRenderHelper renderer )
{
return this.getTexture( this.getCableColor() );
return this.getTexture( this.getCableColor(), renderer ).getAtlas();
}
public IIcon getCoveredTexture( AEColor c )
public IAESprite getCoveredTexture( AEColor c, IRenderHelper renderer )
{
switch( c )
{
@@ -644,30 +645,30 @@ public class PartCable extends AEBasePart implements IPartCable
final AEColoredItemDefinition coveredCable = AEApi.instance().definitions().parts().cableCovered();
final ItemStack coveredCableStack = coveredCable.stack( AEColor.Transparent, 1 );
return coveredCable.item( AEColor.Transparent ).getIconIndex( coveredCableStack );
return renderer.getIcon( coveredCableStack );
}
protected boolean nonLinear( EnumSet<ForgeDirection> sides )
protected boolean nonLinear( EnumSet<AEPartLocation> sides )
{
return ( sides.contains( ForgeDirection.EAST ) && sides.contains( ForgeDirection.WEST ) ) || ( sides.contains( ForgeDirection.NORTH ) && sides.contains( ForgeDirection.SOUTH ) ) || ( sides.contains( ForgeDirection.UP ) && sides.contains( ForgeDirection.DOWN ) );
return ( sides.contains( AEPartLocation.EAST ) && sides.contains( AEPartLocation.WEST ) ) || ( sides.contains( AEPartLocation.NORTH ) && sides.contains( AEPartLocation.SOUTH ) ) || ( sides.contains( AEPartLocation.UP ) && sides.contains( AEPartLocation.DOWN ) );
}
@SideOnly( Side.CLIENT )
public void renderGlassConnection( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, ForgeDirection of )
public void renderGlassConnection( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer, AEPartLocation of )
{
TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ );
TileEntity te = this.tile.getWorld().getTileEntity( pos.offset( of.getFacing() ) );
IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null;
IGridHost gh = te instanceof IGridHost ? (IGridHost) te : null;
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of ) ) );
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of.getFacing() ) ) );
if( gh != null && partHost != null && gh.getCableConnectionType( of.getOpposite() ) == AECableType.GLASS && partHost.getColor() != AEColor.Transparent && partHost.getPart( of.getOpposite() ) == null )
{
rh.setTexture( this.getTexture( partHost.getColor() ) );
rh.setTexture( this.getTexture( partHost.getColor(), renderer ) );
}
else if( partHost == null && gh != null && gh.getCableConnectionType( of.getOpposite() ) != AECableType.GLASS )
{
rh.setTexture( this.getCoveredTexture( this.getCableColor() ) );
rh.setTexture( this.getCoveredTexture( this.getCableColor(), renderer ) );
switch( of )
{
case DOWN:
@@ -692,12 +693,12 @@ public class PartCable extends AEBasePart implements IPartCable
return;
}
rh.renderBlock( x, y, z, renderer );
rh.setTexture( this.getTexture( this.getCableColor() ) );
rh.renderBlock( pos, renderer );
rh.setTexture( this.getTexture( this.getCableColor(), renderer ) );
}
else
{
rh.setTexture( this.getTexture( this.getCableColor() ) );
rh.setTexture( this.getTexture( this.getCableColor(), renderer ) );
}
switch( of )
@@ -724,25 +725,25 @@ public class PartCable extends AEBasePart implements IPartCable
return;
}
rh.renderBlock( x, y, z, renderer );
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
rh.renderBlock( pos, renderer );
rh.setFacesToRender( EnumSet.allOf( EnumFacing.class ) );
}
@SideOnly( Side.CLIENT )
public void renderCoveredConnection( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, int channels, ForgeDirection of )
public void renderCoveredConnection( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer, int channels, AEPartLocation of )
{
TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ );
TileEntity te = this.tile.getWorld().getTileEntity( pos.offset( of.getFacing() ) );
IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null;
IGridHost ghh = te instanceof IGridHost ? (IGridHost) te : null;
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of ) ) );
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of.getFacing() ) ) );
if( ghh != null && partHost != null && ghh.getCableConnectionType( of.getOpposite() ) == AECableType.GLASS && partHost.getPart( of.getOpposite() ) == null && partHost.getColor() != AEColor.Transparent )
{
rh.setTexture( this.getGlassTexture( partHost.getColor() ) );
rh.setTexture( this.getGlassTexture( partHost.getColor(), renderer ) );
}
else if( partHost == null && ghh != null && ghh.getCableConnectionType( of.getOpposite() ) != AECableType.GLASS )
{
rh.setTexture( this.getCoveredTexture( this.getCableColor() ) );
rh.setTexture( this.getCoveredTexture( this.getCableColor(), renderer ) );
switch( of )
{
case DOWN:
@@ -767,17 +768,17 @@ public class PartCable extends AEBasePart implements IPartCable
return;
}
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setTexture( this.getTexture( this.getCableColor() ) );
rh.setTexture( this.getTexture( this.getCableColor(), renderer ) );
}
else if( ghh != null && partHost != null && ghh.getCableConnectionType( of.getOpposite() ) == AECableType.COVERED && partHost.getColor() != AEColor.Transparent && partHost.getPart( of.getOpposite() ) == null )
{
rh.setTexture( this.getCoveredTexture( partHost.getColor() ) );
rh.setTexture( this.getCoveredTexture( partHost.getColor(), renderer ) );
}
else
{
rh.setTexture( this.getCoveredTexture( this.getCableColor() ) );
rh.setTexture( this.getCoveredTexture( this.getCableColor(), renderer ) );
}
switch( of )
@@ -804,30 +805,30 @@ public class PartCable extends AEBasePart implements IPartCable
return;
}
rh.renderBlock( x, y, z, renderer );
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
rh.renderBlock( pos, renderer );
rh.setFacesToRender( EnumSet.allOf( EnumFacing.class ) );
rh.setFacesToRender( EnumSet.allOf( EnumFacing.class ) );
}
@SideOnly( Side.CLIENT )
public void renderSmartConnection( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, int channels, ForgeDirection of )
public void renderSmartConnection( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer, int channels, AEPartLocation of )
{
TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ );
TileEntity te = this.tile.getWorld().getTileEntity( pos.offset( of.getFacing() ) );
IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null;
IGridHost ghh = te instanceof IGridHost ? (IGridHost) te : null;
boolean isGlass = false;
AEColor myColor = this.getCableColor();
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of ) ) );
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of.getFacing() ) ) );
if( ghh != null && partHost != null && ghh.getCableConnectionType( of.getOpposite() ) == AECableType.GLASS && partHost.getPart( of.getOpposite() ) == null && partHost.getColor() != AEColor.Transparent )
{
isGlass = true;
rh.setTexture( this.getGlassTexture( myColor = partHost.getColor() ) );
rh.setTexture( this.getGlassTexture( myColor = partHost.getColor(), renderer ) );
}
else if( partHost == null && ghh != null && ghh.getCableConnectionType( of.getOpposite() ) != AECableType.GLASS )
{
rh.setTexture( this.getSmartTexture( myColor ) );
rh.setTexture( this.getSmartTexture( myColor, renderer ) );
switch( of )
{
case DOWN:
@@ -851,40 +852,40 @@ public class PartCable extends AEBasePart implements IPartCable
default:
return;
}
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
this.setSmartConnectionRotations( of, renderer );
IIcon firstIcon = new TaughtIcon( this.getChannelTex( channels, false ).getIcon(), -0.2f );
IIcon secondIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
IAESprite firstIcon = new TaughtIcon( this.getChannelTex( channels, false ).getIcon(), -0.2f );
IAESprite secondIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
if( of == ForgeDirection.EAST || of == ForgeDirection.WEST )
if( of == AEPartLocation.EAST || of == AEPartLocation.WEST )
{
AEBaseBlock blk = (AEBaseBlock) rh.getBlock();
FlippableIcon ico = blk.getRendererInstance().getTexture( ForgeDirection.EAST );
FlippableIcon ico = blk.getRendererInstance().getTexture( AEPartLocation.EAST );
ico.setFlip( false, true );
}
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
Tessellator.instance.setColorOpaque_I( myColor.blackVariant );
renderer.setBrightness( 15 << 20 | 15 << 4 );
renderer.setColorOpaque_I( myColor.blackVariant );
rh.setTexture( firstIcon, firstIcon, firstIcon, firstIcon, firstIcon, firstIcon );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
Tessellator.instance.setColorOpaque_I( myColor.whiteVariant );
renderer.setColorOpaque_I( myColor.whiteVariant );
rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon, secondIcon );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
rh.setTexture( this.getTexture( this.getCableColor() ) );
rh.setTexture( this.getTexture( this.getCableColor(), renderer ) );
}
else if( ghh != null && partHost != null && ghh.getCableConnectionType( of.getOpposite() ) != AECableType.GLASS && partHost.getColor() != AEColor.Transparent && partHost.getPart( of.getOpposite() ) == null )
{
rh.setTexture( this.getSmartTexture( myColor = partHost.getColor() ) );
rh.setTexture( this.getSmartTexture( myColor = partHost.getColor(), renderer ) );
}
else
{
rh.setTexture( this.getSmartTexture( this.getCableColor() ) );
rh.setTexture( this.getSmartTexture( this.getCableColor(), renderer ) );
}
switch( of )
@@ -911,30 +912,30 @@ public class PartCable extends AEBasePart implements IPartCable
return;
}
rh.renderBlock( x, y, z, renderer );
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
rh.renderBlock( pos, renderer );
rh.setFacesToRender( EnumSet.allOf( EnumFacing.class ) );
if( !isGlass )
{
this.setSmartConnectionRotations( of, renderer );
IIcon firstIcon = new TaughtIcon( this.getChannelTex( channels, false ).getIcon(), -0.2f );
IIcon secondIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
IAESprite firstIcon = new TaughtIcon( this.getChannelTex( channels, false ).getIcon(), -0.2f );
IAESprite secondIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
Tessellator.instance.setColorOpaque_I( myColor.blackVariant );
renderer.setBrightness( 15 << 20 | 15 << 4 );
renderer.setColorOpaque_I( myColor.blackVariant );
rh.setTexture( firstIcon, firstIcon, firstIcon, firstIcon, firstIcon, firstIcon );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
Tessellator.instance.setColorOpaque_I( myColor.whiteVariant );
renderer.setColorOpaque_I( myColor.whiteVariant );
rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon, secondIcon );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
}
}
public IIcon getSmartTexture( AEColor c )
public IAESprite getSmartTexture( AEColor c, IRenderHelper renderer )
{
switch( c )
{
@@ -976,11 +977,11 @@ public class PartCable extends AEBasePart implements IPartCable
final IParts parts = AEApi.instance().definitions().parts();
final ItemStack smartCableStack = parts.cableSmart().stack( AEColor.Transparent, 1 );
return parts.cableCovered().item( AEColor.Transparent ).getIconIndex( smartCableStack );
return renderer.getIcon(smartCableStack );
}
@SideOnly( Side.CLIENT )
protected void setSmartConnectionRotations( ForgeDirection of, RenderBlocks renderer )
protected void setSmartConnectionRotations( AEPartLocation of, IRenderHelper renderer )
{
switch( of )
{
@@ -1055,14 +1056,14 @@ public class PartCable extends AEBasePart implements IPartCable
}
@SideOnly( Side.CLIENT )
protected void renderAllFaces( AEBaseBlock blk, int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
protected void renderAllFaces( AEBaseBlock blk, BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
rh.setBounds( (float) renderer.renderMinX * 16.0f, (float) renderer.renderMinY * 16.0f, (float) renderer.renderMinZ * 16.0f, (float) renderer.renderMaxX * 16.0f, (float) renderer.renderMaxY * 16.0f, (float) renderer.renderMaxZ * 16.0f );
rh.renderFace( x, y, z, blk.getRendererInstance().getTexture( ForgeDirection.WEST ), ForgeDirection.WEST, renderer );
rh.renderFace( x, y, z, blk.getRendererInstance().getTexture( ForgeDirection.EAST ), ForgeDirection.EAST, renderer );
rh.renderFace( x, y, z, blk.getRendererInstance().getTexture( ForgeDirection.NORTH ), ForgeDirection.NORTH, renderer );
rh.renderFace( x, y, z, blk.getRendererInstance().getTexture( ForgeDirection.SOUTH ), ForgeDirection.SOUTH, renderer );
rh.renderFace( x, y, z, blk.getRendererInstance().getTexture( ForgeDirection.DOWN ), ForgeDirection.DOWN, renderer );
rh.renderFace( x, y, z, blk.getRendererInstance().getTexture( ForgeDirection.UP ), ForgeDirection.UP, renderer );
rh.renderFace( pos, blk.getRendererInstance().getTexture( AEPartLocation.WEST ), EnumFacing.WEST, renderer );
rh.renderFace( pos, blk.getRendererInstance().getTexture( AEPartLocation.EAST ), EnumFacing.EAST, renderer );
rh.renderFace( pos, blk.getRendererInstance().getTexture( AEPartLocation.NORTH ), EnumFacing.NORTH, renderer );
rh.renderFace( pos, blk.getRendererInstance().getTexture( AEPartLocation.SOUTH ), EnumFacing.SOUTH, renderer );
rh.renderFace( pos, blk.getRendererInstance().getTexture( AEPartLocation.DOWN ), EnumFacing.DOWN, renderer );
rh.renderFace( pos, blk.getRendererInstance().getTexture( AEPartLocation.UP ), EnumFacing.UP, renderer );
}
}
@@ -21,15 +21,13 @@ package appeng.parts.networking;
import java.util.EnumSet;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode;
@@ -42,6 +40,9 @@ import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.IAESprite;
import appeng.client.texture.OffsetIcon;
import appeng.helpers.Reflected;
import appeng.util.Platform;
@@ -91,7 +92,7 @@ public class PartCableCovered extends PartCable
}
}
for( ForgeDirection of : this.connections )
for( AEPartLocation of : this.connections )
{
switch( of )
{
@@ -120,7 +121,7 @@ public class PartCableCovered extends PartCable
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
{
GL11.glTranslated( -0.0, -0.0, 0.3 );
@@ -128,25 +129,25 @@ public class PartCableCovered extends PartCable
float offU = 0;
float offV = 9;
OffsetIcon main = new OffsetIcon( this.getTexture( this.getCableColor() ), offU, offV );
OffsetIcon main = new OffsetIcon( this.getTexture( this.getCableColor(), renderer ), offU, offV );
for( ForgeDirection side : EnumSet.of( ForgeDirection.UP, ForgeDirection.DOWN ) )
for( EnumFacing side : EnumSet.of( EnumFacing.UP, EnumFacing.DOWN ) )
{
rh.renderInventoryFace( main, side, renderer );
}
offU = 9;
offV = 0;
main = new OffsetIcon( this.getTexture( this.getCableColor() ), offU, offV );
main = new OffsetIcon( this.getTexture( this.getCableColor(), renderer ), offU, offV );
for( ForgeDirection side : EnumSet.of( ForgeDirection.EAST, ForgeDirection.WEST ) )
for( EnumFacing side : EnumSet.of( EnumFacing.EAST, EnumFacing.WEST ) )
{
rh.renderInventoryFace( main, side, renderer );
}
main = new OffsetIcon( this.getTexture( this.getCableColor() ), 0, 0 );
main = new OffsetIcon( this.getTexture( this.getCableColor(), renderer ), 0, 0 );
for( ForgeDirection side : EnumSet.of( ForgeDirection.SOUTH, ForgeDirection.NORTH ) )
for( EnumFacing side : EnumSet.of( EnumFacing.SOUTH, EnumFacing.NORTH ) )
{
rh.renderInventoryFace( main, side, renderer );
}
@@ -155,28 +156,27 @@ public class PartCableCovered extends PartCable
}
@Override
public IIcon getTexture( AEColor c )
public IAESprite getTexture( AEColor c, IRenderHelper renderer )
{
return this.getCoveredTexture( c );
return this.getCoveredTexture( c, renderer );
}
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
rh.setTexture( this.getTexture( this.getCableColor() ) );
rh.setTexture( this.getTexture( this.getCableColor(), renderer ) );
EnumSet<ForgeDirection> sides = this.connections.clone();
EnumSet<AEPartLocation> sides = this.connections.clone();
boolean hasBuses = false;
IPartHost ph = this.getHost();
for( ForgeDirection of : EnumSet.complementOf( this.connections ) )
for( AEPartLocation of : EnumSet.complementOf( this.connections ) )
{
IPart bp = ph.getPart( of );
if( bp instanceof IGridHost )
{
if( of != ForgeDirection.UNKNOWN )
if( of != AEPartLocation.INTERNAL )
{
sides.add( of );
hasBuses = true;
@@ -208,27 +208,27 @@ public class PartCableCovered extends PartCable
default:
continue;
}
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
}
}
}
if( sides.size() != 2 || !this.nonLinear( sides ) || hasBuses )
{
for( ForgeDirection of : this.connections )
for( AEPartLocation of : this.connections )
{
this.renderCoveredConnection( x, y, z, rh, renderer, this.channelsOnSide[of.ordinal()], of );
this.renderCoveredConnection( pos, rh, renderer, this.channelsOnSide[of.ordinal()], of );
}
rh.setTexture( this.getTexture( this.getCableColor() ) );
rh.setTexture( this.getTexture( this.getCableColor(), renderer ) );
rh.setBounds( 5, 5, 5, 11, 11, 11 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
}
else
{
IIcon def = this.getTexture( this.getCableColor() );
IIcon off = new OffsetIcon( def, 0, -12 );
for( ForgeDirection of : this.connections )
IAESprite def = this.getTexture( this.getCableColor(), renderer );
IAESprite off = new OffsetIcon( def, 0, -12 );
for( AEPartLocation of : this.connections )
{
switch( of )
{
@@ -254,7 +254,7 @@ public class PartCableCovered extends PartCable
}
}
rh.renderBlockCurrentBounds( x, y, z, renderer );
rh.renderBlockCurrentBounds( pos, renderer );
}
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
@@ -20,7 +20,6 @@ package appeng.parts.networking;
import net.minecraft.item.ItemStack;
import appeng.helpers.Reflected;
@@ -21,16 +21,13 @@ package appeng.parts.networking;
import java.util.EnumSet;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode;
@@ -43,8 +40,11 @@ import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseBlock;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.FlippableIcon;
import appeng.client.texture.IAESprite;
import appeng.client.texture.OffsetIcon;
import appeng.client.texture.TaughtIcon;
import appeng.helpers.Reflected;
@@ -95,7 +95,7 @@ public class PartCableSmart extends PartCable
}
}
for( ForgeDirection of : this.connections )
for( AEPartLocation of : this.connections )
{
switch( of )
{
@@ -124,18 +124,18 @@ public class PartCableSmart extends PartCable
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
{
GL11.glTranslated( -0.0, -0.0, 0.3 );
float offU = 0;
float offV = 9;
OffsetIcon main = new OffsetIcon( this.getTexture( this.getCableColor() ), offU, offV );
OffsetIcon main = new OffsetIcon( this.getTexture( this.getCableColor(), renderer ), offU, offV );
OffsetIcon ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), offU, offV );
OffsetIcon ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), offU, offV );
for( ForgeDirection side : EnumSet.of( ForgeDirection.UP, ForgeDirection.DOWN ) )
for( EnumFacing side : EnumSet.of( EnumFacing.UP, EnumFacing.DOWN ) )
{
rh.setBounds( 5.0f, 5.0f, 2.0f, 11.0f, 11.0f, 14.0f );
rh.renderInventoryFace( main, side, renderer );
@@ -145,11 +145,11 @@ public class PartCableSmart extends PartCable
offU = 9;
offV = 0;
main = new OffsetIcon( this.getTexture( this.getCableColor() ), offU, offV );
main = new OffsetIcon( this.getTexture( this.getCableColor(), renderer ), offU, offV );
ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), offU, offV );
ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), offU, offV );
for( ForgeDirection side : EnumSet.of( ForgeDirection.EAST, ForgeDirection.WEST ) )
for( EnumFacing side : EnumSet.of( EnumFacing.EAST, EnumFacing.WEST ) )
{
rh.setBounds( 5.0f, 5.0f, 2.0f, 11.0f, 11.0f, 14.0f );
rh.renderInventoryFace( main, side, renderer );
@@ -157,11 +157,11 @@ public class PartCableSmart extends PartCable
rh.renderInventoryFace( ch2, side, renderer );
}
main = new OffsetIcon( this.getTexture( this.getCableColor() ), 0, 0 );
main = new OffsetIcon( this.getTexture( this.getCableColor(), renderer ), 0, 0 );
ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), 0, 0 );
ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), 0, 0 );
for( ForgeDirection side : EnumSet.of( ForgeDirection.SOUTH, ForgeDirection.NORTH ) )
for( EnumFacing side : EnumSet.of( EnumFacing.SOUTH, EnumFacing.NORTH ) )
{
rh.setBounds( 5.0f, 5.0f, 2.0f, 11.0f, 11.0f, 14.0f );
rh.renderInventoryFace( main, side, renderer );
@@ -173,28 +173,27 @@ public class PartCableSmart extends PartCable
}
@Override
public IIcon getTexture( AEColor c )
public IAESprite getTexture( AEColor c, IRenderHelper renderer )
{
return this.getSmartTexture( c );
return this.getSmartTexture( c, renderer );
}
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
rh.setTexture( this.getTexture( this.getCableColor() ) );
rh.setTexture( this.getTexture( this.getCableColor(), renderer ) );
EnumSet<ForgeDirection> sides = this.connections.clone();
EnumSet<AEPartLocation> sides = this.connections.clone();
boolean hasBuses = false;
IPartHost ph = this.getHost();
for( ForgeDirection of : EnumSet.complementOf( this.connections ) )
for( AEPartLocation of : EnumSet.complementOf( this.connections ) )
{
IPart bp = ph.getPart( of );
if( bp instanceof IGridHost )
{
if( of != ForgeDirection.UNKNOWN )
if( of != AEPartLocation.INTERNAL )
{
sides.add( of );
hasBuses = true;
@@ -226,65 +225,65 @@ public class PartCableSmart extends PartCable
default:
continue;
}
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
this.setSmartConnectionRotations( of, renderer );
IIcon firstIcon = new TaughtIcon( this.getChannelTex( this.channelsOnSide[of.ordinal()], false ).getIcon(), -0.2f );
IIcon secondIcon = new TaughtIcon( this.getChannelTex( this.channelsOnSide[of.ordinal()], true ).getIcon(), -0.2f );
IAESprite firstIcon = new TaughtIcon( this.getChannelTex( this.channelsOnSide[of.ordinal()], false ).getIcon(), -0.2f );
IAESprite secondIcon = new TaughtIcon( this.getChannelTex( this.channelsOnSide[of.ordinal()], true ).getIcon(), -0.2f );
if( of == ForgeDirection.EAST || of == ForgeDirection.WEST )
if( of == AEPartLocation.EAST || of == AEPartLocation.WEST )
{
AEBaseBlock blk = (AEBaseBlock) rh.getBlock();
FlippableIcon ico = blk.getRendererInstance().getTexture( ForgeDirection.EAST );
FlippableIcon ico = blk.getRendererInstance().getTexture( AEPartLocation.EAST );
ico.setFlip( false, true );
}
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
Tessellator.instance.setColorOpaque_I( this.getCableColor().blackVariant );
renderer.setBrightness( 15 << 20 | 15 << 4 );
renderer.setColorOpaque_I( this.getCableColor().blackVariant );
rh.setTexture( firstIcon, firstIcon, firstIcon, firstIcon, firstIcon, firstIcon );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
Tessellator.instance.setColorOpaque_I( this.getCableColor().whiteVariant );
renderer.setColorOpaque_I( this.getCableColor().whiteVariant );
rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon, secondIcon );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
rh.setTexture( this.getTexture( this.getCableColor() ) );
rh.setTexture( this.getTexture( this.getCableColor(), renderer ) );
}
}
}
if( sides.size() != 2 || !this.nonLinear( sides ) || hasBuses )
{
for( ForgeDirection of : this.connections )
for( AEPartLocation of : this.connections )
{
this.renderSmartConnection( x, y, z, rh, renderer, this.channelsOnSide[of.ordinal()], of );
this.renderSmartConnection( pos, rh, renderer, this.channelsOnSide[of.ordinal()], of );
}
rh.setTexture( this.getCoveredTexture( this.getCableColor() ) );
rh.setTexture( this.getCoveredTexture( this.getCableColor(), renderer ) );
rh.setBounds( 5, 5, 5, 11, 11, 11 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
}
else
{
ForgeDirection selectedSide = ForgeDirection.UNKNOWN;
AEPartLocation selectedSide = AEPartLocation.INTERNAL;
for( ForgeDirection of : this.connections )
for( AEPartLocation of : this.connections )
{
selectedSide = of;
break;
}
int channels = this.channelsOnSide[selectedSide.ordinal()];
IIcon def = this.getTexture( this.getCableColor() );
IIcon off = new OffsetIcon( def, 0, -12 );
IAESprite def = this.getTexture( this.getCableColor(), renderer );
IAESprite off = new OffsetIcon( def, 0, -12 );
IIcon firstTaughtIcon = new TaughtIcon( this.getChannelTex( channels, false ).getIcon(), -0.2f );
IIcon firstOffsetIcon = new OffsetIcon( firstTaughtIcon, 0, -12 );
IAESprite firstTaughtIcon = new TaughtIcon( this.getChannelTex( channels, false ).getIcon(), -0.2f );
IAESprite firstOffsetIcon = new OffsetIcon( firstTaughtIcon, 0, -12 );
IIcon secondTaughtIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
IIcon secondOffsetIcon = new OffsetIcon( secondTaughtIcon, 0, -12 );
IAESprite secondTaughtIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
IAESprite secondOffsetIcon = new OffsetIcon( secondTaughtIcon, 0, -12 );
switch( selectedSide )
{
@@ -292,22 +291,22 @@ public class PartCableSmart extends PartCable
case UP:
renderer.setRenderBounds( 5 / 16.0, 0, 5 / 16.0, 11 / 16.0, 16 / 16.0, 11 / 16.0 );
rh.setTexture( def, def, off, off, off, off );
rh.renderBlockCurrentBounds( x, y, z, renderer );
rh.renderBlockCurrentBounds( pos, renderer );
renderer.uvRotateTop = 0;
renderer.uvRotateBottom = 0;
renderer.uvRotateSouth = 3;
renderer.uvRotateEast = 3;
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
renderer.setBrightness( 15 << 20 | 15 << 4 );
Tessellator.instance.setColorOpaque_I( this.getCableColor().blackVariant );
renderer.setColorOpaque_I( this.getCableColor().blackVariant );
rh.setTexture( firstTaughtIcon, firstTaughtIcon, firstOffsetIcon, firstOffsetIcon, firstOffsetIcon, firstOffsetIcon );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
Tessellator.instance.setColorOpaque_I( this.getCableColor().whiteVariant );
renderer.setColorOpaque_I( this.getCableColor().whiteVariant );
rh.setTexture( secondTaughtIcon, secondTaughtIcon, secondOffsetIcon, secondOffsetIcon, secondOffsetIcon, secondOffsetIcon );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
break;
case EAST:
case WEST:
@@ -320,13 +319,13 @@ public class PartCableSmart extends PartCable
renderer.uvRotateNorth = 0;
AEBaseBlock blk = (AEBaseBlock) rh.getBlock();
FlippableIcon ico = blk.getRendererInstance().getTexture( ForgeDirection.EAST );
FlippableIcon ico = blk.getRendererInstance().getTexture( AEPartLocation.EAST );
ico.setFlip( false, true );
renderer.setRenderBounds( 0, 5 / 16.0, 5 / 16.0, 16 / 16.0, 11 / 16.0, 11 / 16.0 );
rh.renderBlockCurrentBounds( x, y, z, renderer );
rh.renderBlockCurrentBounds( pos, renderer );
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
renderer.setBrightness( 15 << 20 | 15 << 4 );
FlippableIcon fpA = new FlippableIcon( firstTaughtIcon );
FlippableIcon fpB = new FlippableIcon( secondTaughtIcon );
@@ -337,13 +336,13 @@ public class PartCableSmart extends PartCable
fpA.setFlip( true, false );
fpB.setFlip( true, false );
Tessellator.instance.setColorOpaque_I( this.getCableColor().blackVariant );
renderer.setColorOpaque_I( this.getCableColor().blackVariant );
rh.setTexture( firstOffsetIcon, firstOffsetIcon, firstOffsetIcon, firstOffsetIcon, firstTaughtIcon, fpA );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
Tessellator.instance.setColorOpaque_I( this.getCableColor().whiteVariant );
renderer.setColorOpaque_I( this.getCableColor().whiteVariant );
rh.setTexture( secondOffsetIcon, secondOffsetIcon, secondOffsetIcon, secondOffsetIcon, secondTaughtIcon, fpB );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
break;
case NORTH:
case SOUTH:
@@ -354,17 +353,17 @@ public class PartCableSmart extends PartCable
renderer.uvRotateSouth = 2;
renderer.uvRotateWest = 1;
renderer.setRenderBounds( 5 / 16.0, 5 / 16.0, 0, 11 / 16.0, 11 / 16.0, 16 / 16.0 );
rh.renderBlockCurrentBounds( x, y, z, renderer );
rh.renderBlockCurrentBounds( pos, renderer );
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
renderer.setBrightness( 15 << 20 | 15 << 4 );
Tessellator.instance.setColorOpaque_I( this.getCableColor().blackVariant );
renderer.setColorOpaque_I( this.getCableColor().blackVariant );
rh.setTexture( firstOffsetIcon, firstOffsetIcon, firstTaughtIcon, firstTaughtIcon, firstOffsetIcon, firstOffsetIcon );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
Tessellator.instance.setColorOpaque_I( this.getCableColor().whiteVariant );
renderer.setColorOpaque_I( this.getCableColor().whiteVariant );
rh.setTexture( secondOffsetIcon, secondOffsetIcon, secondTaughtIcon, secondTaughtIcon, secondOffsetIcon, secondOffsetIcon );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
break;
default:
break;
@@ -21,17 +21,14 @@ package appeng.parts.networking;
import java.util.EnumSet;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import appeng.api.AEApi;
import appeng.api.networking.GridFlags;
@@ -46,9 +43,12 @@ import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseBlock;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.CableBusTextures;
import appeng.client.texture.FlippableIcon;
import appeng.client.texture.IAESprite;
import appeng.client.texture.OffsetIcon;
import appeng.client.texture.TaughtIcon;
import appeng.helpers.Reflected;
@@ -99,7 +99,7 @@ public class PartDenseCable extends PartCable
}
}
for( ForgeDirection of : this.connections )
for( AEPartLocation of : this.connections )
{
if( this.isDense( of ) )
{
@@ -156,7 +156,7 @@ public class PartDenseCable extends PartCable
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
{
GL11.glTranslated( -0.0, -0.0, 0.3 );
rh.setBounds( 4.0f, 4.0f, 2.0f, 12.0f, 12.0f, 14.0f );
@@ -164,11 +164,11 @@ public class PartDenseCable extends PartCable
float offU = 0;
float offV = 9;
OffsetIcon main = new OffsetIcon( this.getTexture( this.getCableColor() ), offU, offV );
OffsetIcon main = new OffsetIcon( this.getTexture( this.getCableColor(), renderer ), offU, offV );
OffsetIcon ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), offU, offV );
OffsetIcon ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), offU, offV );
for( ForgeDirection side : EnumSet.of( ForgeDirection.UP, ForgeDirection.DOWN ) )
for( EnumFacing side : EnumSet.of( EnumFacing.UP, EnumFacing.DOWN ) )
{
rh.renderInventoryFace( main, side, renderer );
rh.renderInventoryFace( ch1, side, renderer );
@@ -177,22 +177,22 @@ public class PartDenseCable extends PartCable
offU = 9;
offV = 0;
main = new OffsetIcon( this.getTexture( this.getCableColor() ), offU, offV );
main = new OffsetIcon( this.getTexture( this.getCableColor(), renderer ), offU, offV );
ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), offU, offV );
ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), offU, offV );
for( ForgeDirection side : EnumSet.of( ForgeDirection.EAST, ForgeDirection.WEST ) )
for( EnumFacing side : EnumSet.of( EnumFacing.EAST, EnumFacing.WEST ) )
{
rh.renderInventoryFace( main, side, renderer );
rh.renderInventoryFace( ch1, side, renderer );
rh.renderInventoryFace( ch2, side, renderer );
}
main = new OffsetIcon( this.getTexture( this.getCableColor() ), 0, 0 );
main = new OffsetIcon( this.getTexture( this.getCableColor(), renderer ), 0, 0 );
ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), 0, 0 );
ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), 0, 0 );
for( ForgeDirection side : EnumSet.of( ForgeDirection.SOUTH, ForgeDirection.NORTH ) )
for( EnumFacing side : EnumSet.of( EnumFacing.SOUTH, EnumFacing.NORTH ) )
{
rh.renderInventoryFace( main, side, renderer );
rh.renderInventoryFace( ch1, side, renderer );
@@ -203,27 +203,26 @@ public class PartDenseCable extends PartCable
}
@Override
public IIcon getTexture( AEColor c )
public IAESprite getTexture( AEColor c, IRenderHelper renderer )
{
if( c == AEColor.Transparent )
{
return AEApi.instance().definitions().parts().cableSmart().stack( AEColor.Transparent, 1 ).getIconIndex();
return renderer.getIcon( AEApi.instance().definitions().parts().cableSmart().stack( AEColor.Transparent, 1 ) );
}
return this.getSmartTexture( c );
return this.getSmartTexture( c, renderer );
}
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
rh.setTexture( this.getTexture( this.getCableColor() ) );
rh.setTexture( this.getTexture( this.getCableColor(), renderer ) );
EnumSet<ForgeDirection> sides = this.connections.clone();
EnumSet<AEPartLocation> sides = this.connections.clone();
boolean hasBuses = false;
for( ForgeDirection of : this.connections )
for( AEPartLocation of : this.connections )
{
if( !this.isDense( of ) )
{
@@ -233,45 +232,45 @@ public class PartDenseCable extends PartCable
if( sides.size() != 2 || !this.nonLinear( sides ) || hasBuses )
{
for( ForgeDirection of : this.connections )
for( AEPartLocation of : this.connections )
{
if( this.isDense( of ) )
{
this.renderDenseConnection( x, y, z, rh, renderer, this.channelsOnSide[of.ordinal()], of );
this.renderDenseConnection( pos, rh, renderer, this.channelsOnSide[of.ordinal()], of );
}
else if( this.isSmart( of ) )
{
this.renderSmartConnection( x, y, z, rh, renderer, this.channelsOnSide[of.ordinal()], of );
this.renderSmartConnection( pos, rh, renderer, this.channelsOnSide[of.ordinal()], of );
}
else
{
this.renderCoveredConnection( x, y, z, rh, renderer, this.channelsOnSide[of.ordinal()], of );
this.renderCoveredConnection( pos, rh, renderer, this.channelsOnSide[of.ordinal()], of );
}
}
rh.setTexture( this.getDenseTexture( this.getCableColor() ) );
rh.setTexture( this.getDenseTexture( this.getCableColor(), renderer ) );
rh.setBounds( 3, 3, 3, 13, 13, 13 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
}
else
{
ForgeDirection selectedSide = ForgeDirection.UNKNOWN;
AEPartLocation selectedSide = AEPartLocation.INTERNAL;
for( ForgeDirection of : this.connections )
for( AEPartLocation of : this.connections )
{
selectedSide = of;
break;
}
int channels = this.channelsOnSide[selectedSide.ordinal()];
IIcon def = this.getTexture( this.getCableColor() );
IIcon off = new OffsetIcon( def, 0, -12 );
IAESprite def = this.getTexture( this.getCableColor(), renderer );
IAESprite off = new OffsetIcon( def, 0, -12 );
IIcon firstIcon = new TaughtIcon( this.getChannelTex( channels, false ).getIcon(), -0.2f );
IIcon firstOffset = new OffsetIcon( firstIcon, 0, -12 );
IAESprite firstIcon = new TaughtIcon( this.getChannelTex( channels, false ).getIcon(), -0.2f );
IAESprite firstOffset = new OffsetIcon( firstIcon, 0, -12 );
IIcon secondIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
IIcon secondOffset = new OffsetIcon( secondIcon, 0, -12 );
IAESprite secondIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
IAESprite secondOffset = new OffsetIcon( secondIcon, 0, -12 );
switch( selectedSide )
{
@@ -279,22 +278,22 @@ public class PartDenseCable extends PartCable
case UP:
renderer.setRenderBounds( 3 / 16.0, 0, 3 / 16.0, 13 / 16.0, 16 / 16.0, 13 / 16.0 );
rh.setTexture( def, def, off, off, off, off );
rh.renderBlockCurrentBounds( x, y, z, renderer );
rh.renderBlockCurrentBounds( pos, renderer );
renderer.uvRotateTop = 0;
renderer.uvRotateBottom = 0;
renderer.uvRotateSouth = 3;
renderer.uvRotateEast = 3;
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
renderer.setBrightness( 15 << 20 | 15 << 4 );
Tessellator.instance.setColorOpaque_I( this.getCableColor().blackVariant );
renderer.setColorOpaque_I( this.getCableColor().blackVariant );
rh.setTexture( firstIcon, firstIcon, firstOffset, firstOffset, firstOffset, firstOffset );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
Tessellator.instance.setColorOpaque_I( this.getCableColor().whiteVariant );
renderer.setColorOpaque_I( this.getCableColor().whiteVariant );
rh.setTexture( secondIcon, secondIcon, secondOffset, secondOffset, secondOffset, secondOffset );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
break;
case EAST:
case WEST:
@@ -307,13 +306,13 @@ public class PartDenseCable extends PartCable
renderer.uvRotateNorth = 0;
AEBaseBlock blk = (AEBaseBlock) rh.getBlock();
FlippableIcon ico = blk.getRendererInstance().getTexture( ForgeDirection.EAST );
FlippableIcon ico = blk.getRendererInstance().getTexture( AEPartLocation.EAST );
ico.setFlip( false, true );
renderer.setRenderBounds( 0, 3 / 16.0, 3 / 16.0, 16 / 16.0, 13 / 16.0, 13 / 16.0 );
rh.renderBlockCurrentBounds( x, y, z, renderer );
rh.renderBlockCurrentBounds( pos, renderer );
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
renderer.setBrightness( 15 << 20 | 15 << 4 );
FlippableIcon fpA = new FlippableIcon( firstIcon );
FlippableIcon fpB = new FlippableIcon( secondIcon );
@@ -321,13 +320,13 @@ public class PartDenseCable extends PartCable
fpA.setFlip( true, false );
fpB.setFlip( true, false );
Tessellator.instance.setColorOpaque_I( this.getCableColor().blackVariant );
renderer.setColorOpaque_I( this.getCableColor().blackVariant );
rh.setTexture( firstOffset, firstOffset, firstOffset, firstOffset, firstIcon, fpA );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
Tessellator.instance.setColorOpaque_I( this.getCableColor().whiteVariant );
renderer.setColorOpaque_I( this.getCableColor().whiteVariant );
rh.setTexture( secondOffset, secondOffset, secondOffset, secondOffset, secondIcon, fpB );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
break;
case NORTH:
case SOUTH:
@@ -338,17 +337,17 @@ public class PartDenseCable extends PartCable
renderer.uvRotateSouth = 2;
renderer.uvRotateWest = 1;
renderer.setRenderBounds( 3 / 16.0, 3 / 16.0, 0, 13 / 16.0, 13 / 16.0, 16 / 16.0 );
rh.renderBlockCurrentBounds( x, y, z, renderer );
rh.renderBlockCurrentBounds( pos, renderer );
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
renderer.setBrightness( 15 << 20 | 15 << 4 );
Tessellator.instance.setColorOpaque_I( this.getCableColor().blackVariant );
renderer.setColorOpaque_I( this.getCableColor().blackVariant );
rh.setTexture( firstOffset, firstOffset, firstIcon, firstIcon, firstOffset, firstOffset );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
Tessellator.instance.setColorOpaque_I( this.getCableColor().whiteVariant );
renderer.setColorOpaque_I( this.getCableColor().whiteVariant );
rh.setTexture( secondOffset, secondOffset, secondIcon, secondIcon, secondOffset, secondOffset );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
break;
default:
break;
@@ -360,9 +359,9 @@ public class PartDenseCable extends PartCable
}
@SideOnly( Side.CLIENT )
public void renderDenseConnection( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, int channels, ForgeDirection of )
public void renderDenseConnection( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer, int channels, AEPartLocation of )
{
TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ );
TileEntity te = this.tile.getWorld().getTileEntity( pos.offset( of.getFacing() ) );
IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null;
IGridHost ghh = te instanceof IGridHost ? (IGridHost) te : null;
boolean isGlass = false;
@@ -377,12 +376,12 @@ public class PartDenseCable extends PartCable
* 13 ); break; case WEST: rh.setBounds( 0, 3, 3, 4, 13, 13 ); break; default: return; } rh.renderBlock( x, y,
* z, renderer );
*
* if ( true ) { setSmartConnectionRotations( of, renderer ); IIcon firstIcon = new TaughtIcon( getChannelTex(
* channels, false ).getIcon(), -0.2f ); IIcon secondIcon = new TaughtIcon( getChannelTex( channels, true ).getIcon(),
* if ( true ) { setSmartConnectionRotations( of, renderer ); TextureAtlasSprite firstIcon = new TaughtIcon( getChannelTex(
* channels, false ).getIcon(), -0.2f ); TextureAtlasSprite secondIcon = new TaughtIcon( getChannelTex( channels, true ).getIcon(),
* -0.2f );
*
* if ( of == ForgeDirection.EAST || of == ForgeDirection.WEST ) { AEBaseBlock blk = (AEBaseBlock)
* rh.getBlock(); FlippableIcon ico = blk.getRendererInstance().getTexture( ForgeDirection.EAST ); ico.setFlip(
* if ( of == AEPartLocation.EAST || of == AEPartLocation.WEST ) { AEBaseBlock blk = (AEBaseBlock)
* rh.getBlock(); FlippableIcon ico = blk.getRendererInstance().getTexture( AEPartLocation.EAST ); ico.setFlip(
* false, true ); }
*
* Tessellator.INSTANCE.setBrightness( 15 << 20 | 15 << 5 ); Tessellator.INSTANCE.setColorOpaque_I(
@@ -398,14 +397,14 @@ public class PartDenseCable extends PartCable
* rh.setTexture( getTexture( getCableColor() ) ); }
*/
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of, of.getOpposite() ) ) );
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of.getFacing(), of.getFacing().getOpposite() ) ) );
if( ghh != null && partHost != null && ghh.getCableConnectionType( of ) != AECableType.GLASS && partHost.getColor() != AEColor.Transparent && partHost.getPart( of.getOpposite() ) == null )
{
rh.setTexture( this.getTexture( myColor = partHost.getColor() ) );
rh.setTexture( this.getTexture( myColor = partHost.getColor(), renderer ) );
}
else
{
rh.setTexture( this.getTexture( this.getCableColor() ) );
rh.setTexture( this.getTexture( this.getCableColor(), renderer ) );
}
switch( of )
@@ -432,32 +431,32 @@ public class PartDenseCable extends PartCable
return;
}
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
rh.setFacesToRender( EnumSet.allOf( EnumFacing.class ) );
if( !isGlass )
{
this.setSmartConnectionRotations( of, renderer );
IIcon firstIcon = new TaughtIcon( this.getChannelTex( channels, false ).getIcon(), -0.2f );
IIcon secondIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
IAESprite firstIcon = new TaughtIcon( this.getChannelTex( channels, false ).getIcon(), -0.2f );
IAESprite secondIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
Tessellator.instance.setColorOpaque_I( myColor.blackVariant );
renderer.setBrightness( 15 << 20 | 15 << 4 );
renderer.setColorOpaque_I( myColor.blackVariant );
rh.setTexture( firstIcon, firstIcon, firstIcon, firstIcon, firstIcon, firstIcon );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
Tessellator.instance.setColorOpaque_I( myColor.whiteVariant );
renderer.setColorOpaque_I( myColor.whiteVariant );
rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon, secondIcon );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
}
}
private boolean isSmart( ForgeDirection of )
private boolean isSmart( AEPartLocation of )
{
TileEntity te = this.tile.getWorldObj().getTileEntity( this.tile.xCoord + of.offsetX, this.tile.yCoord + of.offsetY, this.tile.zCoord + of.offsetZ );
TileEntity te = this.tile.getWorld().getTileEntity( this.tile.getPos().offset( of.getFacing() ) );
if( te instanceof IGridHost )
{
AECableType t = ( (IGridHost) te ).getCableConnectionType( of.getOpposite() );
@@ -466,7 +465,7 @@ public class PartDenseCable extends PartCable
return false;
}
private IIcon getDenseTexture( AEColor c )
private IAESprite getDenseTexture( AEColor c, IRenderHelper renderer )
{
switch( c )
{
@@ -505,12 +504,12 @@ public class PartDenseCable extends PartCable
default:
}
return this.is.getIconIndex();
return renderer.getIcon( is );
}
private boolean isDense( ForgeDirection of )
private boolean isDense( AEPartLocation of )
{
TileEntity te = this.tile.getWorldObj().getTileEntity( this.tile.xCoord + of.offsetX, this.tile.yCoord + of.offsetY, this.tile.zCoord + of.offsetZ );
TileEntity te = this.tile.getWorld().getTileEntity( this.tile.getPos().offset( of.getFacing() ) );
if( te instanceof IGridHost )
{
AECableType t = ( (IGridHost) te ).getCableConnectionType( of.getOpposite() );
@@ -22,18 +22,15 @@ package appeng.parts.networking;
import java.util.EnumSet;
import java.util.Set;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import appeng.api.config.Actionable;
import appeng.api.networking.GridFlags;
@@ -44,6 +41,9 @@ import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.IAESprite;
import appeng.me.GridAccessException;
import appeng.me.helpers.AENetworkProxy;
import appeng.parts.AEBasePart;
@@ -64,7 +64,7 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( AEPartLocation dir )
{
return AECableType.GLASS;
}
@@ -77,11 +77,11 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
{
GL11.glTranslated( -0.2, -0.3, 0.0 );
rh.setTexture( this.is.getIconIndex() );
rh.setTexture( renderer.getIcon( is ) );
rh.setBounds( 6.0f, 6.0f, 5.0f, 10.0f, 10.0f, 11.0f );
rh.renderInventoryBox( renderer );
rh.setTexture( null );
@@ -89,12 +89,12 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
IIcon myIcon = this.is.getIconIndex();
IAESprite myIcon = renderer.getIcon( is );
rh.setTexture( myIcon );
rh.setBounds( 6, 6, 10, 10, 10, 16 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setTexture( null );
}
@@ -127,10 +127,10 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
}
@Override
public void setPartHostInfo( ForgeDirection side, IPartHost host, TileEntity tile )
public void setPartHostInfo( AEPartLocation side, IPartHost host, TileEntity tile )
{
super.setPartHostInfo( side, host, tile );
this.outerProxy.setValidSides( EnumSet.of( side ) );
this.outerProxy.setValidSides( EnumSet.of( side.getFacing() ) );
}
@Override
@@ -146,7 +146,7 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
}
@Override
public void onPlacement( EntityPlayer player, ItemStack held, ForgeDirection side )
public void onPlacement( EntityPlayer player, ItemStack held, AEPartLocation side )
{
super.onPlacement( player, held, side );
this.outerProxy.setOwner( player );
@@ -21,17 +21,15 @@ package appeng.parts.p2p;
import java.util.LinkedList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
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.api.config.PowerUnits;
import appeng.api.util.ForgeDirection;
import appeng.me.GridAccessException;
import appeng.me.cache.helpers.TunnelCollection;
import appeng.transformer.annotations.Integration.Interface;
@@ -57,7 +55,7 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
@Override
@SideOnly( Side.CLIENT )
public IIcon getTypeTexture()
public TextureAtlasSprite getTypeTexture()
{
return Blocks.diamond_block.getBlockTextureFromSide( 0 );
}
@@ -23,21 +23,13 @@ import java.util.LinkedList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import buildcraft.api.transport.IPipeConnection;
import buildcraft.api.transport.IPipeTile.PipeType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IChatComponent;
import appeng.api.networking.IGridNode;
import appeng.api.networking.events.MENetworkBootingStatusChange;
import appeng.api.networking.events.MENetworkChannelsChanged;
@@ -47,22 +39,17 @@ import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.core.settings.TickRates;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBC;
import appeng.me.GridAccessException;
import appeng.me.cache.helpers.TunnelCollection;
import appeng.tile.inventory.AppEngNullInventory;
import appeng.transformer.annotations.Integration.Interface;
import appeng.transformer.annotations.Integration.Method;
import appeng.util.Platform;
import appeng.util.inv.WrapperBCPipe;
import appeng.util.inv.WrapperChainedInventory;
import appeng.util.inv.WrapperMCISidedInventory;
@Interface( iface = "buildcraft.api.transport.IPipeConnection", iname = "BC" )
public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeConnection, ISidedInventory, IGridTickable
// TODO: BUILD CRAFT INTEGRATION
// @Interface( iface = "buildcraft.api.transport.IPipeConnection", iname = "BC" ) IPipeConnection
public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements ISidedInventory, IGridTickable
{
final LinkedList<IInventory> which = new LinkedList<IInventory>();
@@ -132,7 +119,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
if( this.proxy.isActive() )
{
TileEntity te = this.tile.getWorldObj().getTileEntity( this.tile.xCoord + this.side.offsetX, this.tile.yCoord + this.side.offsetY, this.tile.zCoord + this.side.offsetZ );
TileEntity te = this.tile.getWorld().getTileEntity( this.tile.getPos().offset( side.getFacing() ) );
if( this.which.contains( this ) )
{
@@ -141,6 +128,8 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
this.which.add( this );
/*
// TODO: BUILD CRAFT INTEGRATION
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BC ) )
{
IBC buildcraft = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
@@ -150,7 +139,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
{
try
{
output = new WrapperBCPipe( te, this.side.getOpposite() );
output = new WrapperBCPipe( te, this.side.getFacing().getOpposite() );
}
catch( Throwable ignore )
{
@@ -158,7 +147,8 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
}
}
}
*/
/*
* if ( AppEng.INSTANCE.isIntegrationEnabled( "TE" ) ) { ITE thermal = (ITE) AppEng.INSTANCE.getIntegration(
* "TE" ); if ( thermal != null ) { if ( thermal.isPipe( te, side.getOpposite() ) ) { try { output = new
@@ -173,7 +163,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
}
else if( te instanceof ISidedInventory )
{
output = new WrapperMCISidedInventory( (ISidedInventory) te, this.side.getOpposite() );
output = new WrapperMCISidedInventory( (ISidedInventory) te, this.side.getFacing().getOpposite() );
}
else if( te instanceof IInventory )
{
@@ -252,13 +242,6 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
}
}
@Override
@SideOnly( Side.CLIENT )
public IIcon getTypeTexture()
{
return Blocks.hopper.getBlockTextureFromSide( 0 );
}
@Override
public void onTunnelNetworkChange()
{
@@ -283,7 +266,8 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
}
@Override
public int[] getAccessibleSlotsFromSide( int var1 )
public int[] getSlotsForFace(
EnumFacing side )
{
int[] slots = new int[this.getSizeInventory()];
for( int x = 0; x < this.getSizeInventory(); x++ )
@@ -324,13 +308,13 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
}
@Override
public String getInventoryName()
public String getName()
{
return null;
}
@Override
public boolean hasCustomInventoryName()
public boolean hasCustomName()
{
return false;
}
@@ -354,12 +338,12 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
}
@Override
public void openInventory()
public void openInventory(EntityPlayer p)
{
}
@Override
public void closeInventory()
public void closeInventory(EntityPlayer p)
{
}
@@ -370,13 +354,13 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
}
@Override
public boolean canInsertItem( int i, ItemStack itemstack, int j )
public boolean canInsertItem( int i, ItemStack itemstack, EnumFacing j )
{
return this.getDestination().isItemValidForSlot( i, itemstack );
}
@Override
public boolean canExtractItem( int i, ItemStack itemstack, int j )
public boolean canExtractItem( int i, ItemStack itemstack, EnumFacing j )
{
return false;
}
@@ -386,10 +370,46 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
return 2.0f;
}
@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()
{
// probobly not...
}
@Override
public IChatComponent getDisplayName()
{
return null;
}
/*
// TODO: BUILD CRAFT INTEGRATION
@Override
@Method( iname = "BC" )
public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with )
public ConnectOverride overridePipeConnection( PipeType type, AEPartLocation with )
{
return this.side == with && type == PipeType.ITEM ? ConnectOverride.CONNECT : ConnectOverride.DEFAULT;
}
*/
}
@@ -19,20 +19,14 @@
package appeng.parts.p2p;
import java.io.IOException;
import io.netty.buffer.ByteBuf;
import net.minecraft.init.Blocks;
import java.io.IOException;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.networking.IGridNode;
import appeng.api.networking.events.MENetworkChannelsChanged;
import appeng.api.networking.events.MENetworkPowerStatusChange;
@@ -92,9 +86,9 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
}
TileEntity te = this.getTile();
World w = te.getWorldObj();
World w = te.getWorld();
int newLevel = w.getBlockLightValue( te.xCoord + this.side.offsetX, te.yCoord + this.side.offsetY, te.zCoord + this.side.offsetZ );
int newLevel = w.getLight( te.getPos().offset( side.getFacing() ) );
if( this.lastValue != newLevel && this.proxy.isActive() )
{
@@ -150,19 +144,12 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
if( this.opacity < 0 )
{
TileEntity te = this.getTile();
this.opacity = 255 - te.getWorldObj().getBlockLightOpacity( te.xCoord + this.side.offsetX, te.yCoord + this.side.offsetY, te.zCoord + this.side.offsetZ );
this.opacity = 255 - te.getWorld().getBlockLightOpacity( te.getPos().offset( side.getFacing() ) );
}
return (int) ( emit * ( this.opacity / 255.0f ) );
}
@Override
@SideOnly( Side.CLIENT )
public IIcon getTypeTexture()
{
return Blocks.quartz_block.getBlockTextureFromSide( 0 );
}
@Override
public void readFromNBT( NBTTagCompound tag )
{
@@ -24,19 +24,13 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Stack;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
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 cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.me.GridAccessException;
@@ -59,13 +53,6 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
return 2.0f;
}
@Override
@SideOnly( Side.CLIENT )
public IIcon getTypeTexture()
{
return Blocks.lapis_block.getBlockTextureFromSide( 0 );
}
@Override
public void onTunnelNetworkChange()
{
@@ -87,7 +74,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
}
@Override
public int fill( ForgeDirection from, FluidStack resource, boolean doFill )
public int fill( EnumFacing from, FluidStack resource, boolean doFill )
{
Stack<PartP2PLiquids> stack = this.getDepth();
@@ -111,7 +98,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
IFluidHandler tank = l.getTarget();
if( tank != null )
{
l.tmpUsed = tank.fill( l.side.getOpposite(), resource.copy(), false );
l.tmpUsed = tank.fill( l.side.getFacing().getOpposite(), resource.copy(), false );
}
else
{
@@ -166,7 +153,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
IFluidHandler tank = l.getTarget();
if( tank != null )
{
l.tmpUsed = tank.fill( l.side.getOpposite(), insert.copy(), true );
l.tmpUsed = tank.fill( l.side.getFacing().getOpposite(), insert.copy(), true );
}
else
{
@@ -208,7 +195,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
IFluidHandler handler = l.getTarget();
if( handler != null )
{
if( handler.canFill( l.side.getOpposite(), input ) )
if( handler.canFill( l.side.getFacing().getOpposite(), input ) )
{
outs.add( l );
}
@@ -235,7 +222,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
return this.cachedTank;
}
TileEntity te = this.tile.getWorldObj().getTileEntity( this.tile.xCoord + this.side.offsetX, this.tile.yCoord + this.side.offsetY, this.tile.zCoord + this.side.offsetZ );
TileEntity te = this.tile.getWorld().getTileEntity( this.tile.getPos().offset( side.getFacing() ) );
if( te instanceof IFluidHandler )
{
return this.cachedTank = (IFluidHandler) te;
@@ -245,33 +232,33 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
}
@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 !this.output && from == this.side && !this.getOutputs( fluid ).isEmpty();
return !this.output && from == this.side.getFacing() && !this.getOutputs( fluid ).isEmpty();
}
@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 )
{
if( from == this.side )
if( from == this.side.getFacing() )
{
return this.getTank();
}
@@ -20,16 +20,14 @@ package appeng.parts.p2p;
import java.util.concurrent.Callable;
import javax.annotation.Nullable;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
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 li.cil.oc.api.API;
import li.cil.oc.api.Items;
import li.cil.oc.api.Network;
@@ -38,11 +36,11 @@ import li.cil.oc.api.network.Message;
import li.cil.oc.api.network.Node;
import li.cil.oc.api.network.SidedEnvironment;
import li.cil.oc.api.network.Visibility;
import appeng.api.networking.IGridNode;
import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.util.ForgeDirection;
import appeng.core.AELog;
import appeng.core.settings.TickRates;
import appeng.hooks.TickHandler;
@@ -85,7 +83,7 @@ public final class PartP2POpenComputers extends PartP2PTunnel<PartP2POpenCompute
@Override
@SideOnly(Side.CLIENT)
public IIcon getTypeTexture()
public TextureAtlasSprite getTypeTexture()
{
return Items.get( "adapter" ).block().getBlockTextureFromSide( 2 );
}
@@ -149,7 +147,7 @@ public final class PartP2POpenComputers extends PartP2PTunnel<PartP2POpenCompute
{
if ( this.node() != null ) // Client side doesn't have nodes.
{
TickHandler.INSTANCE.addCallable( this.tile.getWorldObj(), this.updateCallback );
TickHandler.INSTANCE.addCallable( this.tile.getWorld(), this.updateCallback );
}
return TickRateModulation.SLEEP;
@@ -21,18 +21,15 @@ package appeng.parts.p2p;
import java.util.Stack;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
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 cofh.api.energy.IEnergyReceiver;
import appeng.api.config.PowerUnits;
import appeng.api.util.ForgeDirection;
import appeng.integration.modules.helpers.NullRFHandler;
import appeng.me.GridAccessException;
import appeng.transformer.annotations.Integration.Interface;
@@ -58,7 +55,7 @@ public final class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implemen
@Override
@SideOnly( Side.CLIENT )
public IIcon getTypeTexture()
public TextureAtlasSprite getTypeTexture()
{
return Blocks.iron_block.getBlockTextureFromSide( 0 );
}
@@ -169,7 +166,7 @@ public final class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implemen
if( !this.cachedTarget )
{
TileEntity self = this.getTile();
TileEntity te = self.getWorldObj().getTileEntity( self.xCoord + this.side.offsetX, self.yCoord + this.side.offsetY, self.zCoord + this.side.offsetZ );
TileEntity te = self.getWorld().getTileEntity( self.xCoord + this.side.offsetX, self.yCoord + this.side.offsetY, self.zCoord + this.side.offsetZ );
this.outputTarget = te instanceof IEnergyReceiver ? (IEnergyReceiver) te : null;
this.cachedTarget = true;
}
@@ -21,15 +21,12 @@ package appeng.parts.p2p;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRedstoneWire;
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.IIcon;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.networking.events.MENetworkBootingStatusChange;
import appeng.api.networking.events.MENetworkChannelsChanged;
import appeng.api.networking.events.MENetworkEventSubscribe;
@@ -89,21 +86,13 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
public void notifyNeighbors()
{
World worldObj = this.tile.getWorldObj();
World worldObj = this.tile.getWorld();
int xCoord = this.tile.xCoord;
int yCoord = this.tile.yCoord;
int zCoord = this.tile.zCoord;
Platform.notifyBlocksOfNeighbors( worldObj, xCoord, yCoord, zCoord );
Platform.notifyBlocksOfNeighbors( worldObj,tile.getPos());
// and this cause sometimes it can go thought walls.
Platform.notifyBlocksOfNeighbors( worldObj, xCoord - 1, yCoord, zCoord );
Platform.notifyBlocksOfNeighbors( worldObj, xCoord, yCoord - 1, zCoord );
Platform.notifyBlocksOfNeighbors( worldObj, xCoord, yCoord, zCoord - 1 );
Platform.notifyBlocksOfNeighbors( worldObj, xCoord, yCoord, zCoord + 1 );
Platform.notifyBlocksOfNeighbors( worldObj, xCoord, yCoord + 1, zCoord );
Platform.notifyBlocksOfNeighbors( worldObj, xCoord + 1, yCoord, zCoord );
for ( EnumFacing face : EnumFacing.VALUES )
Platform.notifyBlocksOfNeighbors( worldObj,tile.getPos().offset( face ) );
}
@MENetworkEventSubscribe
@@ -118,13 +107,6 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
this.setNetworkReady();
}
@Override
@SideOnly( Side.CLIENT )
public IIcon getTypeTexture()
{
return Blocks.redstone_block.getBlockTextureFromSide( 0 );
}
@Override
public void readFromNBT( NBTTagCompound tag )
{
@@ -155,20 +137,20 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
{
if( !this.output )
{
int x = this.tile.xCoord + this.side.offsetX;
int y = this.tile.yCoord + this.side.offsetY;
int z = this.tile.zCoord + this.side.offsetZ;
BlockPos target = tile.getPos().offset( side.getFacing() );
Block b = this.tile.getWorldObj().getBlock( x, y, z );
IBlockState state = this.tile.getWorld().getBlockState( target );
Block b = state.getBlock();
if( b != null && !this.output )
{
int srcSide = this.side.ordinal();
EnumFacing srcSide = this.side.getFacing();
if( b instanceof BlockRedstoneWire )
{
srcSide = 1;
srcSide = EnumFacing.UP;
}
this.power = b.isProvidingStrongPower( this.tile.getWorldObj(), x, y, z, srcSide );
this.power = Math.max( this.power, b.isProvidingWeakPower( this.tile.getWorldObj(), x, y, z, srcSide ) );
this.power = b.isProvidingStrongPower( this.tile.getWorld(), target,state, srcSide );
this.power = Math.max( this.power, b.isProvidingWeakPower( this.tile.getWorld(), target, state, srcSide ) );
this.sendToOutput( this.power );
}
else
@@ -22,21 +22,16 @@ package appeng.parts.p2p;
import java.util.ArrayList;
import java.util.Collection;
import com.google.common.base.Optional;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection;
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.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
@@ -50,7 +45,10 @@ import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartItem;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.parts.PartItemStack;
import appeng.api.util.AEPartLocation;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.CableBusTextures;
import appeng.client.texture.IAESprite;
import appeng.core.AEConfig;
import appeng.me.GridAccessException;
import appeng.me.cache.P2PCache;
@@ -58,6 +56,8 @@ import appeng.me.cache.helpers.TunnelCollection;
import appeng.parts.PartBasicState;
import appeng.util.Platform;
import com.google.common.base.Optional;
public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
{
@@ -123,62 +123,62 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
{
rh.setTexture( this.getTypeTexture() );
rh.setTexture( this.getTypeTexture(renderer) );
rh.setBounds( 2, 2, 14, 14, 14, 16 );
rh.renderInventoryBox( renderer );
rh.setTexture( CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.BlockP2PTunnel2.getIcon(), this.is.getIconIndex(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon() );
rh.setTexture( CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.BlockP2PTunnel2.getIcon(), renderer.getIcon( is ), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon() );
rh.setBounds( 2, 2, 14, 14, 14, 16 );
rh.renderInventoryBox( renderer );
}
/**
* @param renderer
* @return If enabled it returns the icon of an AE quartz block, else vanilla quartz block icon
*/
protected IIcon getTypeTexture()
protected IAESprite getTypeTexture(IRenderHelper renderer )
{
final Optional<Block> maybeBlock = AEApi.instance().definitions().blocks().quartz().maybeBlock();
if( maybeBlock.isPresent() )
{
return maybeBlock.get().getIcon( 0, 0 );
return renderer.getIcon( new ItemStack(maybeBlock.get()) );
}
else
{
return Blocks.quartz_block.getIcon( 0, 0 );
return renderer.getIcon( new ItemStack(Blocks.quartz_block) );
}
}
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
rh.setTexture( this.getTypeTexture() );
rh.setTexture( this.getTypeTexture(renderer) );
rh.setBounds( 2, 2, 14, 14, 14, 16 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setTexture( CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.BlockP2PTunnel2.getIcon(), this.is.getIconIndex(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon() );
rh.setTexture( CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.BlockP2PTunnel2.getIcon(), renderer.getIcon( is ), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon() );
rh.setBounds( 2, 2, 14, 14, 14, 16 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setBounds( 3, 3, 13, 13, 13, 14 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setTexture( CableBusTextures.BlockP2PTunnel3.getIcon() );
rh.setBounds( 6, 5, 12, 10, 11, 13 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
rh.setBounds( 5, 6, 12, 11, 10, 13 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
this.renderLights( x, y, z, rh, renderer );
this.renderLights( pos, rh, renderer );
}
@Override
@@ -251,7 +251,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
if( testPart instanceof PartP2PTunnel )
{
this.getHost().removePart( this.side, true );
ForgeDirection dir = this.getHost().addPart( newType, this.side, player );
AEPartLocation dir = this.getHost().addPart( newType, this.side, player );
IPart newBus = this.getHost().getPart( dir );
if( newBus instanceof PartP2PTunnel )
@@ -294,27 +294,31 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
}
break;
/*
case RF_POWER:
for( ItemStack stack : parts.p2PTunnelRF().maybeStack( 1 ).asSet() )
{
newType = stack;
}
break;
*/
case FLUID:
for( ItemStack stack : parts.p2PTunnelLiquids().maybeStack( 1 ).asSet() )
{
newType = stack;
}
break;
/*
case IC2_POWER:
for( ItemStack stack : parts.p2PTunnelEU().maybeStack( 1 ).asSet() )
{
newType = stack;
}
break;
*/
case ITEM:
for( ItemStack stack : parts.p2PTunnelItems().maybeStack( 1 ).asSet() )
{
@@ -335,14 +339,16 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
newType = stack;
}
break;
/*
case COMPUTER_MESSAGE:
for( ItemStack stack : parts.p2PTunnelOpenComputers().maybeStack( 1 ).asSet() )
{
newType = stack;
}
break;
*/
default:
break;
}
@@ -353,7 +359,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
long myFreq = this.freq;
this.getHost().removePart( this.side, false );
ForgeDirection dir = this.getHost().addPart( newType, this.side, player );
AEPartLocation dir = this.getHost().addPart( newType, this.side, player );
IPart newBus = this.getHost().getPart( dir );
if( newBus instanceof PartP2PTunnel )
@@ -373,7 +379,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
}
}
Platform.notifyBlocksOfNeighbors( this.tile.getWorldObj(), this.tile.xCoord, this.tile.yCoord, this.tile.zCoord );
Platform.notifyBlocksOfNeighbors( this.tile.getWorld(), this.tile.getPos() );
return true;
}
}
@@ -434,9 +440,9 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
@Override
@SideOnly( Side.CLIENT )
public IIcon getBreakingTexture()
public TextureAtlasSprite getBreakingTexture( IRenderHelper renderer )
{
return CableBusTextures.BlockP2PTunnel2.getIcon();
return CableBusTextures.BlockP2PTunnel2.getIcon().getAtlas();
}
protected void queueTunnelDrain( PowerUnits unit, double f )
@@ -27,8 +27,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.AEApi;
import appeng.api.exceptions.FailedConnection;
import appeng.api.networking.GridFlags;
@@ -38,6 +36,7 @@ import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPartHost;
import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation;
import appeng.core.AELog;
import appeng.core.settings.TickRates;
import appeng.hooks.TickHandler;
@@ -92,7 +91,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
}
@Override
public AECableType getCableConnectionType( ForgeDirection dir )
public AECableType getCableConnectionType( AEPartLocation dir )
{
return AECableType.DENSE;
}
@@ -112,10 +111,10 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
}
@Override
public void setPartHostInfo( ForgeDirection side, IPartHost host, TileEntity tile )
public void setPartHostInfo( AEPartLocation side, IPartHost host, TileEntity tile )
{
super.setPartHostInfo( side, host, tile );
this.outerProxy.setValidSides( EnumSet.of( side ) );
this.outerProxy.setValidSides( EnumSet.of( side.getFacing() ) );
}
@Override
@@ -125,7 +124,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
}
@Override
public void onPlacement( EntityPlayer player, ItemStack held, ForgeDirection side )
public void onPlacement( EntityPlayer player, ItemStack held, AEPartLocation side )
{
super.onPlacement( player, held, side );
this.outerProxy.setOwner( player );
@@ -148,19 +147,19 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
if( !this.proxy.getEnergy().isNetworkPowered() )
{
this.connection.markDestroy();
TickHandler.INSTANCE.addCallable( this.tile.getWorldObj(), this.connection );
TickHandler.INSTANCE.addCallable( this.tile.getWorld(), this.connection );
}
else
{
if( this.proxy.isActive() )
{
this.connection.markCreate();
TickHandler.INSTANCE.addCallable( this.tile.getWorldObj(), this.connection );
TickHandler.INSTANCE.addCallable( this.tile.getWorld(), this.connection );
}
else
{
this.connection.markDestroy();
TickHandler.INSTANCE.addCallable( this.tile.getWorldObj(), this.connection );
TickHandler.INSTANCE.addCallable( this.tile.getWorld(), this.connection );
}
}
@@ -233,7 +232,9 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
{
final TileEntity start = this.getTile();
final TileEntity end = me.getTile();
AELog.warning( "Failed to establish a ME P2P Tunnel between the tunnels at [x=%d, y=%d, z=%d] and [x=%d, y=%d, z=%d]", start.xCoord, start.yCoord, start.zCoord, end.xCoord, end.yCoord, end.zCoord );
AELog.warning( "Failed to establish a ME P2P Tunnel between the tunnels at [x=%d, y=%d, z=%d] and [x=%d, y=%d, z=%d]",
start.getPos().getX(), start.getPos().getY(), start.getPos().getZ(),
end.getPos().getX(), end.getPos().getY(), end.getPos().getZ() );
// :(
}
}
@@ -25,9 +25,8 @@ import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.networking.energy.IEnergySource;
import appeng.api.networking.security.PlayerSource;
import appeng.api.storage.IMEMonitor;
@@ -144,13 +143,13 @@ public class PartConversionMonitor extends PartStorageMonitor
if( retrieved != null )
{
ItemStack newItems = retrieved.getItemStack();
InventoryAdaptor adaptor = InventoryAdaptor.getAdaptor( player, ForgeDirection.UNKNOWN );
InventoryAdaptor adaptor = InventoryAdaptor.getAdaptor( player, EnumFacing.UP );
newItems = adaptor.addItems( newItems );
if( newItems != null )
{
TileEntity te = this.tile;
List<ItemStack> list = Collections.singletonList( newItems );
Platform.spawnDrops( player.worldObj, te.xCoord + this.side.offsetX, te.yCoord + this.side.offsetY, te.zCoord + this.side.offsetZ, list );
Platform.spawnDrops( player.worldObj, te.getPos().offset( side.getFacing() ), list );
}
if( player.openContainer != null )
@@ -25,7 +25,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import appeng.client.texture.CableBusTextures;
import appeng.core.sync.GuiBridge;
import appeng.helpers.Reflected;
@@ -84,9 +83,9 @@ public class PartCraftingTerminal extends PartTerminal
int z = (int) p.posZ;
if( this.getHost().getTile() != null )
{
x = this.tile.xCoord;
y = this.tile.yCoord;
z = this.tile.zCoord;
x = this.tile.getPos().getX();
y = this.tile.getPos().getY();
z = this.tile.getPos().getZ();
}
if( GuiBridge.GUI_CRAFTING_TERMINAL.hasPermissions( this.getHost().getTile(), x, y, z, this.side, p ) )
@@ -19,15 +19,13 @@
package appeng.parts.reporting;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.parts.IPartRenderHelper;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.CableBusTextures;
@@ -41,15 +39,15 @@ public class PartDarkMonitor extends PartMonitor
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
{
rh.setBounds( 2, 2, 14, 14, 14, 16 );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
rh.renderInventoryBox( renderer );
rh.setInvColor( this.getColor().mediumVariant );
rh.renderInventoryFace( this.frontBright.getIcon(), ForgeDirection.SOUTH, renderer );
rh.renderInventoryFace( this.frontBright.getIcon(), EnumFacing.SOUTH, renderer );
rh.setBounds( 4, 4, 13, 12, 12, 14 );
rh.renderInventoryBox( renderer );
@@ -57,23 +55,23 @@ public class PartDarkMonitor extends PartMonitor
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
rh.setBounds( 2, 2, 14, 14, 14, 16 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
if( this.getLightLevel() > 0 )
{
int l = 13;
Tessellator.instance.setBrightness( l << 20 | l << 4 );
renderer.setBrightness( l << 20 | l << 4 );
}
Tessellator.instance.setColorOpaque_I( this.getColor().mediumVariant );
rh.renderFace( x, y, z, this.frontBright.getIcon(), ForgeDirection.SOUTH, renderer );
renderer.setColorOpaque_I( this.getColor().mediumVariant );
rh.renderFace( pos, this.frontBright.getIcon(), EnumFacing.SOUTH, renderer );
rh.setBounds( 4, 4, 13, 12, 12, 14 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
}
}
@@ -22,7 +22,6 @@ package appeng.parts.reporting;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Vec3;
import appeng.client.texture.CableBusTextures;
import appeng.core.sync.GuiBridge;
import appeng.util.Platform;
@@ -19,23 +19,20 @@
package appeng.parts.reporting;
import java.io.IOException;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer;
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.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection;
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.api.implementations.IPowerChannelState;
import appeng.api.implementations.parts.IPartMonitor;
import appeng.api.networking.GridFlags;
@@ -44,6 +41,8 @@ import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.util.AEPartLocation;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.CableBusTextures;
import appeng.me.GridAccessException;
import appeng.parts.AEBasePart;
@@ -109,21 +108,21 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
{
rh.setBounds( 2, 2, 14, 14, 14, 16 );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
rh.renderInventoryBox( renderer );
rh.setInvColor( this.getColor().whiteVariant );
rh.renderInventoryFace( this.frontBright.getIcon(), ForgeDirection.SOUTH, renderer );
rh.renderInventoryFace( this.frontBright.getIcon(), EnumFacing.SOUTH, renderer );
rh.setInvColor( this.getColor().mediumVariant );
rh.renderInventoryFace( this.frontDark.getIcon(), ForgeDirection.SOUTH, renderer );
rh.renderInventoryFace( this.frontDark.getIcon(), EnumFacing.SOUTH, renderer );
rh.setInvColor( this.getColor().blackVariant );
rh.renderInventoryFace( this.frontColored.getIcon(), ForgeDirection.SOUTH, renderer );
rh.renderInventoryFace( this.frontColored.getIcon(), EnumFacing.SOUTH, renderer );
rh.setBounds( 4, 4, 13, 12, 12, 14 );
rh.renderInventoryBox( renderer );
@@ -131,41 +130,39 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
rh.setBounds( 2, 2, 14, 14, 14, 16 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
if( this.getLightLevel() > 0 )
{
int l = 13;
Tessellator.instance.setBrightness( l << 20 | l << 4 );
renderer.setBrightness( l << 20 | l << 4 );
}
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = this.spin;
Tessellator.instance.setColorOpaque_I( this.getColor().whiteVariant );
rh.renderFace( x, y, z, this.frontBright.getIcon(), ForgeDirection.SOUTH, renderer );
renderer.setColorOpaque_I( this.getColor().whiteVariant );
rh.renderFace( pos, this.frontBright.getIcon(), EnumFacing.SOUTH, renderer );
Tessellator.instance.setColorOpaque_I( this.getColor().mediumVariant );
rh.renderFace( x, y, z, this.frontDark.getIcon(), ForgeDirection.SOUTH, renderer );
renderer.setColorOpaque_I( this.getColor().mediumVariant );
rh.renderFace( pos, this.frontDark.getIcon(), EnumFacing.SOUTH, renderer );
Tessellator.instance.setColorOpaque_I( this.getColor().blackVariant );
rh.renderFace( x, y, z, this.frontColored.getIcon(), ForgeDirection.SOUTH, renderer );
renderer.setColorOpaque_I( this.getColor().blackVariant );
rh.renderFace( pos, this.frontColored.getIcon(), EnumFacing.SOUTH, renderer );
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
if( this.notLightSource )
{
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( is ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
}
rh.setBounds( 4, 4, 13, 12, 12, 14 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
if( this.notLightSource )
{
@@ -175,25 +172,25 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann
if( hasChan )
{
int l = 14;
Tessellator.instance.setBrightness( l << 20 | l << 4 );
Tessellator.instance.setColorOpaque_I( this.getColor().blackVariant );
renderer.setBrightness( l << 20 | l << 4 );
renderer.setColorOpaque_I( this.getColor().blackVariant );
}
else if( hasPower )
{
int l = 9;
Tessellator.instance.setBrightness( l << 20 | l << 4 );
Tessellator.instance.setColorOpaque_I( this.getColor().whiteVariant );
renderer.setBrightness( l << 20 | l << 4 );
renderer.setColorOpaque_I( this.getColor().whiteVariant );
}
else
{
Tessellator.instance.setBrightness( 0 );
Tessellator.instance.setColorOpaque_I( 0x000000 );
renderer.setBrightness( 0 );
renderer.setColorOpaque_I( 0x000000 );
}
rh.renderFace( x, y, z, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), ForgeDirection.EAST, renderer );
rh.renderFace( x, y, z, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), ForgeDirection.WEST, renderer );
rh.renderFace( x, y, z, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), ForgeDirection.UP, renderer );
rh.renderFace( x, y, z, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), ForgeDirection.DOWN, renderer );
rh.renderFace( pos, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), EnumFacing.EAST, renderer );
rh.renderFace( pos, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), EnumFacing.WEST, renderer );
rh.renderFace( pos, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), EnumFacing.UP, renderer );
rh.renderFace( pos, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), EnumFacing.DOWN, renderer );
}
}
@@ -279,7 +276,7 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann
{
TileEntity te = this.getTile();
if( !player.isSneaking() && Platform.isWrench( player, player.inventory.getCurrentItem(), te.xCoord, te.yCoord, te.zCoord ) )
if( !player.isSneaking() && Platform.isWrench( player, player.inventory.getCurrentItem(), te.getPos() ) )
{
if( Platform.isServer() )
{
@@ -316,16 +313,16 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann
}
@Override
public void onPlacement( EntityPlayer player, ItemStack held, ForgeDirection side )
public void onPlacement( EntityPlayer player, ItemStack held, AEPartLocation side )
{
super.onPlacement( player, held, side );
byte rotation = (byte) ( MathHelper.floor_double( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 );
if( side == ForgeDirection.UP )
if( side == AEPartLocation.UP )
{
this.spin = rotation;
}
else if( side == ForgeDirection.DOWN )
else if( side == AEPartLocation.DOWN )
{
this.spin = rotation;
}
@@ -336,7 +333,7 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann
if( this.opacity < 0 )
{
TileEntity te = this.getTile();
this.opacity = 255 - te.getWorldObj().getBlockLightOpacity( te.xCoord + this.side.offsetX, te.yCoord + this.side.offsetY, te.zCoord + this.side.offsetZ );
this.opacity = 255 - te.getWorld().getBlockLightOpacity( te.getPos().offset( side.getFacing() ) );
}
return (int) ( emit * ( this.opacity / 255.0f ) );
@@ -25,7 +25,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import appeng.api.implementations.ICraftingPatternItem;
import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.api.storage.data.IAEItemStack;
@@ -94,9 +93,9 @@ public class PartPatternTerminal extends PartTerminal
int z = (int) p.posZ;
if( this.getHost().getTile() != null )
{
x = this.tile.xCoord;
y = this.tile.yCoord;
z = this.tile.zCoord;
x = this.tile.getPos().getX();
y = this.tile.getPos().getY();
z = this.tile.getPos().getZ();
}
if( GuiBridge.GUI_PATTERN_TERMINAL.hasPermissions( this.getHost().getTile(), x, y, z, this.side, p ) )
@@ -115,7 +114,7 @@ public class PartPatternTerminal extends PartTerminal
if( is != null && is.getItem() instanceof ICraftingPatternItem )
{
ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
ICraftingPatternDetails details = pattern.getPatternForItem( is, this.getHost().getTile().getWorldObj() );
ICraftingPatternDetails details = pattern.getPatternForItem( is, this.getHost().getTile().getWorld() );
if( details != null )
{
this.setCraftingRecipe( details.isCraftable() );
@@ -19,15 +19,13 @@
package appeng.parts.reporting;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.parts.IPartRenderHelper;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.CableBusTextures;
@@ -42,17 +40,17 @@ public class PartSemiDarkMonitor extends PartMonitor
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
{
rh.setBounds( 2, 2, 14, 14, 14, 16 );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon(is), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
rh.renderInventoryBox( renderer );
int light = this.getColor().whiteVariant;
int dark = this.getColor().mediumVariant;
rh.setInvColor( ( ( ( ( ( light >> 16 ) & 0xff ) + ( ( dark >> 16 ) & 0xff ) ) / 2 ) << 16 ) | ( ( ( ( ( light >> 8 ) & 0xff ) + ( ( dark >> 8 ) & 0xff ) ) / 2 ) << 8 ) | ( ( ( ( light ) & 0xff ) + ( ( dark ) & 0xff ) ) / 2 ) );
rh.renderInventoryFace( this.frontBright.getIcon(), ForgeDirection.SOUTH, renderer );
rh.renderInventoryFace( this.frontBright.getIcon(), EnumFacing.SOUTH, renderer );
rh.setBounds( 4, 4, 13, 12, 12, 14 );
rh.renderInventoryBox( renderer );
@@ -60,25 +58,25 @@ public class PartSemiDarkMonitor extends PartMonitor
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
{
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon(is), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
rh.setBounds( 2, 2, 14, 14, 14, 16 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
if( this.getLightLevel() > 0 )
{
int l = 13;
Tessellator.instance.setBrightness( l << 20 | l << 4 );
renderer.setBrightness( l << 20 | l << 4 );
}
int light = this.getColor().whiteVariant;
int dark = this.getColor().mediumVariant;
Tessellator.instance.setColorOpaque( ( ( ( light >> 16 ) & 0xff ) + ( ( dark >> 16 ) & 0xff ) ) / 2, ( ( ( light >> 8 ) & 0xff ) + ( ( dark >> 8 ) & 0xff ) ) / 2, ( ( ( light ) & 0xff ) + ( ( dark ) & 0xff ) ) / 2 );
rh.renderFace( x, y, z, this.frontBright.getIcon(), ForgeDirection.SOUTH, renderer );
renderer.setColorOpaque( ( ( ( light >> 16 ) & 0xff ) + ( ( dark >> 16 ) & 0xff ) ) / 2, ( ( ( light >> 8 ) & 0xff ) + ( ( dark >> 8 ) & 0xff ) ) / 2, ( ( ( light ) & 0xff ) + ( ( dark ) & 0xff ) ) / 2 );
rh.renderFace( pos, this.frontBright.getIcon(), EnumFacing.SOUTH, renderer );
rh.setBounds( 4, 4, 13, 12, 12, 14 );
rh.renderBlock( x, y, z, renderer );
rh.renderBlock( pos, renderer );
}
}
@@ -19,29 +19,27 @@
package appeng.parts.reporting;
import java.io.IOException;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import io.netty.buffer.ByteBuf;
import java.io.IOException;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import appeng.api.implementations.parts.IPartStorageMonitor;
import appeng.api.networking.security.BaseActionSource;
@@ -53,7 +51,9 @@ import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.AEPartLocation;
import appeng.client.ClientHelper;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.CableBusTextures;
import appeng.core.AELog;
import appeng.core.localization.PlayerMessages;
@@ -176,7 +176,7 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
TileEntity te = this.tile;
ItemStack eq = player.getCurrentEquippedItem();
if( Platform.isWrench( player, eq, te.xCoord, te.yCoord, te.zCoord ) )
if( Platform.isWrench( player, eq, te.getPos() ) )
{
this.isLocked = !this.isLocked;
player.addChatMessage( ( this.isLocked ? PlayerMessages.isNowLocked : PlayerMessages.isNowUnlocked ).get() );
@@ -256,14 +256,15 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
@Override
@SideOnly( Side.CLIENT )
public void renderDynamic( double x, double y, double z, IPartRenderHelper rh, RenderBlocks renderer )
public void renderDynamic( double x, double y, double z, IPartRenderHelper rh, IRenderHelper renderer )
{
if( this.dspList == null )
{
this.dspList = GLAllocation.generateDisplayLists( 1 );
}
Tessellator tess = Tessellator.instance;
Tessellator tess = Tessellator.getInstance();
WorldRenderer wr = tess.getWorldRenderer();
if( ( this.clientFlags & ( this.POWERED_FLAG | this.CHANNEL_FLAG ) ) != ( this.POWERED_FLAG | this.CHANNEL_FLAG ) )
{
@@ -280,7 +281,9 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
{
this.updateList = false;
GL11.glNewList( this.dspList, GL11.GL_COMPILE_AND_EXECUTE );
this.tesrRenderScreen( tess, ais );
wr.startDrawingQuads();
this.tesrRenderScreen( wr, ais );
tess.draw();
GL11.glEndList();
}
else
@@ -304,44 +307,44 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
return this.configuredItem;
}
private void tesrRenderScreen( Tessellator tess, IAEItemStack ais )
private void tesrRenderScreen( WorldRenderer wr, IAEItemStack ais )
{
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
ForgeDirection d = this.side;
GL11.glTranslated( d.offsetX * 0.77, d.offsetY * 0.77, d.offsetZ * 0.77 );
AEPartLocation d = this.side;
GL11.glTranslated( d.xOffset * 0.77, d.yOffset * 0.77, d.zOffset * 0.77 );
if( d == ForgeDirection.UP )
if( d == AEPartLocation.UP )
{
GL11.glScalef( 1.0f, -1.0f, 1.0f );
GL11.glRotatef( 90.0f, 1.0f, 0.0f, 0.0f );
GL11.glRotatef( this.spin * 90.0F, 0, 0, 1 );
}
if( d == ForgeDirection.DOWN )
if( d == AEPartLocation.DOWN )
{
GL11.glScalef( 1.0f, -1.0f, 1.0f );
GL11.glRotatef( -90.0f, 1.0f, 0.0f, 0.0f );
GL11.glRotatef( this.spin * -90.0F, 0, 0, 1 );
}
if( d == ForgeDirection.EAST )
if( d == AEPartLocation.EAST )
{
GL11.glScalef( -1.0f, -1.0f, -1.0f );
GL11.glRotatef( -90.0f, 0.0f, 1.0f, 0.0f );
}
if( d == ForgeDirection.WEST )
if( d == AEPartLocation.WEST )
{
GL11.glScalef( -1.0f, -1.0f, -1.0f );
GL11.glRotatef( 90.0f, 0.0f, 1.0f, 0.0f );
}
if( d == ForgeDirection.NORTH )
if( d == AEPartLocation.NORTH )
{
GL11.glScalef( -1.0f, -1.0f, -1.0f );
}
if( d == ForgeDirection.SOUTH )
if( d == AEPartLocation.SOUTH )
{
GL11.glScalef( -1.0f, -1.0f, -1.0f );
GL11.glRotatef( 180.0f, 0.0f, 1.0f, 0.0f );
@@ -363,9 +366,9 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
GL11.glDisable( GL11.GL_LIGHTING );
GL11.glDisable( GL12.GL_RESCALE_NORMAL );
// RenderHelper.enableGUIStandardItemLighting();
tess.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
wr.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
ClientHelper.proxy.doRenderItem( sis, this.tile.getWorldObj() );
ClientHelper.proxy.doRenderItem( sis, this.tile.getWorld() );
}
catch( Exception e )
{
@@ -380,7 +383,7 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
final long stackSize = ais.getStackSize();
final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm( stackSize );
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
int width = fr.getStringWidth( renderedStackSize );
GL11.glTranslatef( -0.5f * width, 0.0f, -1.0f );
fr.drawString( renderedStackSize, 0, 0, 0 );
@@ -26,7 +26,6 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Vec3;
import appeng.api.config.Settings;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;