AE2 First Commit, the dawn of 1.7 hast arrived.
This commit is contained in:
commit
e9acdcbee2
|
@ -0,0 +1,3 @@
|
|||
[submodule "api"]
|
||||
path = api
|
||||
url = https://github.com/AlgorithmX2/Applied-Energistics-2-API.git
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 1aa680440944ff48b144201545f62db08ed28261
|
|
@ -0,0 +1,688 @@
|
|||
package appeng.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.client.resources.Resource;
|
||||
import net.minecraft.entity.Entity;
|
||||
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.AxisAlignedBB;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.implementations.IMemoryCard;
|
||||
import appeng.api.implementations.MemoryCardMessages;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BlockRenderInfo;
|
||||
import appeng.client.render.WorldRender;
|
||||
import appeng.client.texture.FlipableIcon;
|
||||
import appeng.core.Configuration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.AEFeatureHandler;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
import appeng.util.LookDirection;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.SettingsFrom;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class AEBaseBlock extends BlockContainer implements IAEFeature
|
||||
{
|
||||
|
||||
private String FeatureFullname;
|
||||
private String FeatureSubname;
|
||||
private AEFeatureHandler feature;
|
||||
|
||||
private Class<? extends TileEntity> tileEntityType = null;
|
||||
protected boolean isOpaque = true;
|
||||
protected boolean isFullSize = true;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon renderIcon;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
BlockRenderInfo renderInfo;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return FeatureFullname;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return BaseBlockRender.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderType()
|
||||
{
|
||||
return WorldRender.instance.getRenderId();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private FlipableIcon optionaIcon(IconRegister ir, String Name, Icon substitute)
|
||||
{
|
||||
// if the input is an flippable icon find the original.
|
||||
while (substitute instanceof FlipableIcon)
|
||||
substitute = ((FlipableIcon) substitute).getOriginal();
|
||||
|
||||
if ( substitute != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
ResourceLocation resLoc = new ResourceLocation( Name );
|
||||
resLoc = new ResourceLocation( resLoc.getResourceDomain(), String.format( "%s/%s%s", new Object[] { "textures/blocks",
|
||||
resLoc.getResourcePath(), ".png" } ) );
|
||||
|
||||
Resource res = Minecraft.getMinecraft().getResourceManager().getResource( resLoc );
|
||||
if ( res != null )
|
||||
return new FlipableIcon( ir.registerIcon( Name ) );
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
return new FlipableIcon( substitute );
|
||||
}
|
||||
}
|
||||
|
||||
return new FlipableIcon( ir.registerIcon( Name ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister iconRegistry)
|
||||
{
|
||||
BlockRenderInfo info = getRendererInstance();
|
||||
FlipableIcon topIcon;
|
||||
FlipableIcon bottomIcon;
|
||||
FlipableIcon sideIcon;
|
||||
FlipableIcon eastIcon;
|
||||
FlipableIcon westIcon;
|
||||
FlipableIcon southIcon;
|
||||
FlipableIcon northIcon;
|
||||
|
||||
this.blockIcon = topIcon = optionaIcon( iconRegistry, this.getTextureName(), null );
|
||||
bottomIcon = optionaIcon( iconRegistry, this.getTextureName() + "Bottom", topIcon );
|
||||
sideIcon = optionaIcon( iconRegistry, this.getTextureName() + "Side", topIcon );
|
||||
eastIcon = optionaIcon( iconRegistry, this.getTextureName() + "East", sideIcon );
|
||||
westIcon = optionaIcon( iconRegistry, this.getTextureName() + "West", sideIcon );
|
||||
southIcon = optionaIcon( iconRegistry, this.getTextureName() + "Front", sideIcon );
|
||||
northIcon = optionaIcon( iconRegistry, this.getTextureName() + "Back", sideIcon );
|
||||
|
||||
info.updateIcons( bottomIcon, topIcon, northIcon, southIcon, eastIcon, westIcon );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIcon(int direction, int metadata)
|
||||
{
|
||||
if ( renderIcon != null )
|
||||
return renderIcon;
|
||||
|
||||
return getRendererInstance().getTexture( ForgeDirection.getOrientation( direction ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getBlockTexture(IBlockAccess w, int x, int y, int z, int s)
|
||||
{
|
||||
return getIcon( mapRotation( w, x, y, z, s ), 0 );
|
||||
}
|
||||
|
||||
protected void setTileEntiy(Class<? extends TileEntity> c)
|
||||
{
|
||||
GameRegistry.registerTileEntity( tileEntityType = c, FeatureFullname );
|
||||
}
|
||||
|
||||
protected void setfeature(EnumSet<AEFeature> f)
|
||||
{
|
||||
feature = new AEFeatureHandler( f, this, FeatureSubname );
|
||||
}
|
||||
|
||||
protected AEBaseBlock(Class<?> c, Material mat) {
|
||||
this( c, mat, null );
|
||||
setLightOpacity( 15 );
|
||||
setLightValue( 0 );
|
||||
setHardness( 1.2F );
|
||||
}
|
||||
|
||||
protected AEBaseBlock(Class<?> c, Material mat, String subname) {
|
||||
super( Configuration.instance.getBlockID( c, subname ), mat );
|
||||
|
||||
if ( mat == Material.glass )
|
||||
setStepSound( Block.soundGlassFootstep );
|
||||
else if ( mat == Material.rock )
|
||||
setStepSound( Block.soundStoneFootstep );
|
||||
else
|
||||
setStepSound( Block.soundMetalFootstep );
|
||||
|
||||
FeatureFullname = AEFeatureHandler.getName( c, subname );
|
||||
FeatureSubname = subname;
|
||||
}
|
||||
|
||||
@Override
|
||||
final public AEFeatureHandler feature()
|
||||
{
|
||||
return feature;
|
||||
}
|
||||
|
||||
public boolean isOpaque()
|
||||
{
|
||||
return isOpaque;
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean isOpaqueCube()
|
||||
{
|
||||
return isOpaque;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return isFullSize && isOpaque;
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean isBlockNormalCube(World world, int x, int y, int z)
|
||||
{
|
||||
return isFullSize;
|
||||
}
|
||||
|
||||
public boolean hasBlockTileEntity()
|
||||
{
|
||||
return tileEntityType != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean hasTileEntity(int metadata)
|
||||
{
|
||||
return hasBlockTileEntity();
|
||||
}
|
||||
|
||||
public Class<? extends TileEntity> getTileEntityClass()
|
||||
{
|
||||
return tileEntityType;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderInfo getRendererInstance()
|
||||
{
|
||||
if ( renderInfo != null )
|
||||
return renderInfo;
|
||||
|
||||
try
|
||||
{
|
||||
return renderInfo = new BlockRenderInfo( getRenderer().newInstance() );
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
final public TileEntity createTileEntity(World world, int metadata)
|
||||
{
|
||||
try
|
||||
{
|
||||
return tileEntityType.newInstance();
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
throw new RuntimeException( e );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
final public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return createTileEntity( world, 0 );
|
||||
}
|
||||
|
||||
final public <T extends TileEntity> T getTileEntity(IBlockAccess w, int x, int y, int z)
|
||||
{
|
||||
if ( !hasBlockTileEntity() )
|
||||
return null;
|
||||
|
||||
TileEntity te = w.getBlockTileEntity( x, y, z );
|
||||
if ( tileEntityType.isInstance( te ) )
|
||||
return (T) te;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean rotateBlock(World w, int x, int y, int z, ForgeDirection axis)
|
||||
{
|
||||
IOrientable rotateable = null;
|
||||
|
||||
if ( hasBlockTileEntity() )
|
||||
{
|
||||
rotateable = (AEBaseTile) getTileEntity( w, x, y, z );
|
||||
}
|
||||
else if ( this instanceof IOrientableBlock )
|
||||
{
|
||||
rotateable = ((IOrientableBlock) this).getOrientable( w, x, y, z );
|
||||
}
|
||||
|
||||
if ( rotateable != null && rotateable.canBeRotated() )
|
||||
{
|
||||
ForgeDirection forward = rotateable.getForward();
|
||||
ForgeDirection up = rotateable.getUp();
|
||||
|
||||
for (int rs = 0; rs < 4; rs++)
|
||||
{
|
||||
forward = Platform.rotateAround( forward, axis );
|
||||
up = Platform.rotateAround( up, axis );
|
||||
|
||||
if ( this.isValidOrientation( w, x, y, z, forward, up ) )
|
||||
{
|
||||
rotateable.setOrientation( forward, up );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public ForgeDirection mapRotation(IOrientable ori, ForgeDirection dir)
|
||||
{
|
||||
// case DOWN: return bottomIcon;
|
||||
// case UP: return blockIcon;
|
||||
// case NORTH: return northIcon;
|
||||
// case SOUTH: return southIcon;
|
||||
// case WEST: return sideIcon;
|
||||
// case EAST: return sideIcon;
|
||||
|
||||
ForgeDirection forward = ori.getForward();
|
||||
ForgeDirection up = ori.getUp();
|
||||
ForgeDirection west = ForgeDirection.UNKNOWN;
|
||||
|
||||
if ( forward == null || up == null )
|
||||
return dir;
|
||||
|
||||
int west_x = forward.offsetY * up.offsetZ - forward.offsetZ * up.offsetY;
|
||||
int west_y = forward.offsetZ * up.offsetX - forward.offsetX * up.offsetZ;
|
||||
int west_z = forward.offsetX * up.offsetY - forward.offsetY * up.offsetX;
|
||||
|
||||
for (ForgeDirection dx : ForgeDirection.VALID_DIRECTIONS)
|
||||
if ( dx.offsetX == west_x && dx.offsetY == west_y && dx.offsetZ == west_z )
|
||||
west = dx;
|
||||
|
||||
if ( dir.equals( forward ) )
|
||||
return ForgeDirection.SOUTH;
|
||||
if ( dir.equals( forward.getOpposite() ) )
|
||||
return ForgeDirection.NORTH;
|
||||
|
||||
if ( dir.equals( up ) )
|
||||
return ForgeDirection.UP;
|
||||
if ( dir.equals( up.getOpposite() ) )
|
||||
return ForgeDirection.DOWN;
|
||||
|
||||
if ( dir.equals( west ) )
|
||||
return ForgeDirection.WEST;
|
||||
if ( dir.equals( west.getOpposite() ) )
|
||||
return ForgeDirection.EAST;
|
||||
|
||||
return ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
int mapRotation(IBlockAccess w, int x, int y, int z, int s)
|
||||
{
|
||||
IOrientable ori = null;
|
||||
|
||||
if ( hasBlockTileEntity() )
|
||||
{
|
||||
ori = (AEBaseTile) getTileEntity( w, x, y, z );
|
||||
}
|
||||
else if ( this instanceof IOrientableBlock )
|
||||
{
|
||||
ori = ((IOrientableBlock) this).getOrientable( w, x, y, z );
|
||||
}
|
||||
|
||||
if ( ori != null && ori.canBeRotated() )
|
||||
{
|
||||
return mapRotation( ori, ForgeDirection.getOrientation( s ) ).ordinal();
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
final public ForgeDirection[] getValidRotations(World w, int x, int y, int z)
|
||||
{
|
||||
if ( hasBlockTileEntity() )
|
||||
{
|
||||
AEBaseTile obj = getTileEntity( w, x, y, z );
|
||||
if ( obj != null && obj.canBeRotated() )
|
||||
{
|
||||
return ForgeDirection.VALID_DIRECTIONS;
|
||||
}
|
||||
}
|
||||
|
||||
return new ForgeDirection[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World w, int x, int y, int z, int a, int b)
|
||||
{
|
||||
AEBaseTile te = getTileEntity( w, x, y, z );
|
||||
if ( te != null )
|
||||
{
|
||||
if ( te.dropItems )
|
||||
{
|
||||
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
te.getDrops( w, x, y, z, drops );
|
||||
|
||||
// Cry ;_; ...
|
||||
Platform.spawnDrops( w, x, y, z, drops );
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock( w, x, y, z, a, b );
|
||||
if ( te != null )
|
||||
w.setBlockTileEntity( x, y, z, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovingObjectPosition collisionRayTrace(World w, int x, int y, int z, Vec3 a, Vec3 b)
|
||||
{
|
||||
ICustomCollision collisionHandler = null;
|
||||
|
||||
if ( this instanceof ICustomCollision )
|
||||
collisionHandler = (ICustomCollision) this;
|
||||
else
|
||||
{
|
||||
AEBaseTile te = getTileEntity( w, x, y, z );
|
||||
if ( te instanceof ICustomCollision )
|
||||
collisionHandler = (ICustomCollision) te;
|
||||
}
|
||||
|
||||
if ( collisionHandler != null )
|
||||
{
|
||||
Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxsFromPool( w, x, y, z );
|
||||
MovingObjectPosition br = null;
|
||||
|
||||
double lastDist = 0;
|
||||
|
||||
for (AxisAlignedBB bb : bbs)
|
||||
{
|
||||
setBlockBounds( (float) bb.minX, (float) bb.minY, (float) bb.minZ, (float) bb.maxX, (float) bb.maxY, (float) bb.maxZ );
|
||||
|
||||
MovingObjectPosition r = super.collisionRayTrace( w, x, y, z, a, b );
|
||||
|
||||
setBlockBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
if ( r != null )
|
||||
{
|
||||
double xLen = (a.xCoord - r.hitVec.xCoord);
|
||||
double yLen = (a.yCoord - r.hitVec.yCoord);
|
||||
double zLen = (a.zCoord - r.hitVec.zCoord);
|
||||
|
||||
double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
|
||||
if ( br == null || lastDist > thisDist )
|
||||
{
|
||||
lastDist = thisDist;
|
||||
br = r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( br != null )
|
||||
{
|
||||
return br;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
setBlockBounds( 0, 0, 0, 1, 1, 1 );
|
||||
return super.collisionRayTrace( w, x, y, z, a, b );
|
||||
}
|
||||
|
||||
@Override
|
||||
final public AxisAlignedBB getSelectedBoundingBoxFromPool(World w, int x, int y, int z)
|
||||
{
|
||||
ICustomCollision collisionHandler = null;
|
||||
AxisAlignedBB b = null;
|
||||
|
||||
if ( this instanceof ICustomCollision )
|
||||
collisionHandler = (ICustomCollision) this;
|
||||
else
|
||||
{
|
||||
AEBaseTile te = getTileEntity( w, x, y, z );
|
||||
if ( te instanceof ICustomCollision )
|
||||
collisionHandler = (ICustomCollision) te;
|
||||
}
|
||||
|
||||
if ( collisionHandler != null )
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
{
|
||||
LookDirection ld = Platform.getPlayerRay( Minecraft.getMinecraft().thePlayer );
|
||||
|
||||
Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxsFromPool( w, x, y, z );
|
||||
AxisAlignedBB br = null;
|
||||
|
||||
double lastDist = 0;
|
||||
|
||||
for (AxisAlignedBB bb : bbs)
|
||||
{
|
||||
setBlockBounds( (float) bb.minX, (float) bb.minY, (float) bb.minZ, (float) bb.maxX, (float) bb.maxY, (float) bb.maxZ );
|
||||
|
||||
MovingObjectPosition r = super.collisionRayTrace( w, x, y, z, ld.a, ld.b );
|
||||
|
||||
setBlockBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
if ( r != null )
|
||||
{
|
||||
double xLen = (ld.a.xCoord - r.hitVec.xCoord);
|
||||
double yLen = (ld.a.yCoord - r.hitVec.yCoord);
|
||||
double zLen = (ld.a.zCoord - r.hitVec.zCoord);
|
||||
|
||||
double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
|
||||
if ( br == null || lastDist > thisDist )
|
||||
{
|
||||
lastDist = thisDist;
|
||||
br = bb;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( br != null )
|
||||
{
|
||||
br.setBounds( br.minX + x, br.minY + y, br.minZ + z, br.maxX + x, br.maxY + y, br.maxZ + z );
|
||||
return br;
|
||||
}
|
||||
}
|
||||
|
||||
for (AxisAlignedBB bx : collisionHandler.getSelectedBoundingBoxsFromPool( w, x, y, z ))
|
||||
{
|
||||
if ( b == null )
|
||||
b = bx;
|
||||
else
|
||||
{
|
||||
double minX = Math.min( b.minX, bx.minX );
|
||||
double minY = Math.min( b.minY, bx.minY );
|
||||
double minZ = Math.min( b.minZ, bx.minZ );
|
||||
double maxX = Math.max( b.maxX, bx.maxX );
|
||||
double maxY = Math.max( b.maxY, bx.maxY );
|
||||
double maxZ = Math.max( b.maxZ, bx.maxZ );
|
||||
b.setBounds( minX, minY, minZ, maxX, maxY, maxZ );
|
||||
}
|
||||
}
|
||||
|
||||
b.setBounds( b.minX + x, b.minY + y, b.minZ + z, b.maxX + x, b.maxY + y, b.maxZ + z );
|
||||
}
|
||||
else
|
||||
b = super.getSelectedBoundingBoxFromPool( w, x, y, z );
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
final public void addCollisionBoxesToList(World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e)
|
||||
{
|
||||
ICustomCollision collisionHandler = null;
|
||||
|
||||
if ( this instanceof ICustomCollision )
|
||||
collisionHandler = (ICustomCollision) this;
|
||||
else
|
||||
{
|
||||
AEBaseTile te = getTileEntity( w, x, y, z );
|
||||
if ( te instanceof ICustomCollision )
|
||||
collisionHandler = (ICustomCollision) te;
|
||||
}
|
||||
|
||||
if ( collisionHandler != null && bb != null )
|
||||
{
|
||||
List<AxisAlignedBB> tmp = new ArrayList<AxisAlignedBB>();
|
||||
collisionHandler.addCollidingBlockToList( w, x, y, z, bb, tmp, e );
|
||||
for (AxisAlignedBB b : tmp)
|
||||
{
|
||||
b.minX += x;
|
||||
b.minY += y;
|
||||
b.minZ += z;
|
||||
b.maxX += x;
|
||||
b.maxY += y;
|
||||
b.maxZ += z;
|
||||
if ( bb.intersectsWith( b ) )
|
||||
out.add( b );
|
||||
}
|
||||
}
|
||||
else
|
||||
super.addCollisionBoxesToList( w, x, y, z, bb, out, e );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
super.onBlockDestroyedByPlayer( par1World, par2, par3, par4, par5 );
|
||||
}
|
||||
|
||||
public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
final public boolean onBlockActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if ( player != null )
|
||||
{
|
||||
ItemStack is = player.inventory.getCurrentItem();
|
||||
if ( is != null )
|
||||
{
|
||||
if ( Platform.isWrench( player, is, x, y, z ) && player.isSneaking() )
|
||||
{
|
||||
int id = w.getBlockId( x, y, z );
|
||||
if ( id != 0 )
|
||||
{
|
||||
AEBaseTile tile = getTileEntity( w, x, y, z );
|
||||
ItemStack[] drops = Platform.getBlockDrops( w, x, y, z );
|
||||
|
||||
if ( tile == null )
|
||||
return false;
|
||||
|
||||
if ( tile instanceof TileCableBus )
|
||||
return false;
|
||||
|
||||
ItemStack op = new ItemStack( this );
|
||||
for (ItemStack ol : drops)
|
||||
{
|
||||
if ( Platform.isSameItemType( ol, op ) )
|
||||
{
|
||||
NBTTagCompound tag = tile.downloadSettings( SettingsFrom.DISMANTLE_ITEM );
|
||||
if ( tag != null )
|
||||
ol.setTagCompound( tag );
|
||||
}
|
||||
}
|
||||
|
||||
if ( Block.blocksList[id].removeBlockByPlayer( w, player, x, y, z ) )
|
||||
{
|
||||
List<ItemStack> l = new ArrayList<ItemStack>();
|
||||
for (ItemStack iss : drops)
|
||||
l.add( iss );
|
||||
Platform.spawnDrops( w, x, y, z, l );
|
||||
w.setBlockToAir( x, y, z );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( is.getItem() instanceof IMemoryCard )
|
||||
{
|
||||
IMemoryCard memc = (IMemoryCard) is.getItem();
|
||||
if ( player.isSneaking() )
|
||||
{
|
||||
AEBaseTile t = getTileEntity( w, x, y, z );
|
||||
if ( t != null )
|
||||
{
|
||||
String name = getUnlocalizedName();
|
||||
NBTTagCompound data = t.downloadSettings( SettingsFrom.MEMORY_CARD );
|
||||
if ( data != null )
|
||||
{
|
||||
memc.setMemoryCardContents( is, name, data );
|
||||
memc.notifyUser( this, player, MemoryCardMessages.SETTINGS_SAVED );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
String name = memc.getSettingsName( is );
|
||||
NBTTagCompound data = memc.getData( is );
|
||||
if ( getUnlocalizedName().equals( name ) )
|
||||
{
|
||||
AEBaseTile t = getTileEntity( w, x, y, z );
|
||||
t.uploadSettings( SettingsFrom.MEMORY_CARD, data );
|
||||
memc.notifyUser( this, player, MemoryCardMessages.SETTINGS_LOADED );
|
||||
}
|
||||
else
|
||||
memc.notifyUser( this, player, MemoryCardMessages.INVALID_MACHINE );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return onActivated( w, x, y, z, player, side, hitX, hitY, hitZ );
|
||||
}
|
||||
|
||||
public boolean isValidOrientation(World w, int x, int y, int z, ForgeDirection forward, ForgeDirection up)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addInformation(ItemStack is, EntityPlayer player, List<?> lines, boolean advancedItemTooltips)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Class<AEBaseItemBlock> getItemBlockClass()
|
||||
{
|
||||
return AEBaseItemBlock.class;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
package appeng.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.client.render.ItemRenderer;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class AEBaseItemBlock extends ItemBlock
|
||||
{
|
||||
|
||||
final AEBaseBlock blockType;
|
||||
|
||||
public AEBaseItemBlock(int id) {
|
||||
super( id );
|
||||
blockType = (AEBaseBlock) Block.blocksList[id + 256];
|
||||
if ( Platform.isClient() )
|
||||
MinecraftForgeClient.registerItemRenderer( blockType.blockID, ItemRenderer.instance );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack is, EntityPlayer player, List lines, boolean advancedItemTooltips)
|
||||
{
|
||||
Block blk = Block.blocksList[getBlockID()];
|
||||
if ( blk instanceof AEBaseBlock )
|
||||
((AEBaseBlock) blk).addInformation( is, player, lines, advancedItemTooltips );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
|
||||
{
|
||||
ForgeDirection up = ForgeDirection.UNKNOWN;
|
||||
ForgeDirection forward = ForgeDirection.UNKNOWN;
|
||||
|
||||
IOrientable ori = null;
|
||||
|
||||
if ( blockType.hasBlockTileEntity() )
|
||||
{
|
||||
up = ForgeDirection.UP;
|
||||
|
||||
byte rotation = (byte) (MathHelper.floor_double( (double) ((player.rotationYaw * 4F) / 360F) + 2.5D ) & 3);
|
||||
|
||||
switch (rotation)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
forward = ForgeDirection.SOUTH;
|
||||
break;
|
||||
case 1:
|
||||
forward = ForgeDirection.WEST;
|
||||
break;
|
||||
case 2:
|
||||
forward = ForgeDirection.NORTH;
|
||||
break;
|
||||
case 3:
|
||||
forward = ForgeDirection.EAST;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( player.rotationPitch > 65 )
|
||||
{
|
||||
up = forward.getOpposite();
|
||||
forward = ForgeDirection.UP;
|
||||
}
|
||||
else if ( player.rotationPitch < -65 )
|
||||
{
|
||||
up = forward.getOpposite();
|
||||
forward = ForgeDirection.DOWN;
|
||||
}
|
||||
}
|
||||
|
||||
if ( blockType instanceof IOrientableBlock )
|
||||
{
|
||||
ori = ((IOrientableBlock) blockType).getOrientable( w, x, y, z );
|
||||
up = ForgeDirection.getOrientation( side );
|
||||
forward = ForgeDirection.SOUTH;
|
||||
if ( up.offsetY == 0 )
|
||||
forward = ForgeDirection.UP;
|
||||
|
||||
ori.setOrientation( forward, up );
|
||||
}
|
||||
|
||||
if ( !blockType.isValidOrientation( w, x, y, z, forward, up ) )
|
||||
return false;
|
||||
|
||||
if ( super.placeBlockAt( stack, player, w, x, y, z, side, hitX, hitY, hitZ, metadata ) )
|
||||
{
|
||||
if ( blockType.hasBlockTileEntity() )
|
||||
{
|
||||
AEBaseTile tile = blockType.getTileEntity( w, x, y, z );
|
||||
ori = tile;
|
||||
|
||||
if ( tile == null )
|
||||
return true;
|
||||
|
||||
if ( ori.canBeRotated() )
|
||||
{
|
||||
if ( ori.getForward() == null || ori.getUp() == null || // null
|
||||
tile.getForward() == ForgeDirection.UNKNOWN || ori.getUp() == ForgeDirection.UNKNOWN )
|
||||
ori.setOrientation( forward, up );
|
||||
}
|
||||
|
||||
tile.onPlacement( stack, player, side );
|
||||
}
|
||||
else if ( blockType instanceof IOrientableBlock )
|
||||
{
|
||||
ori.setOrientation( forward, up );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
package appeng.block;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.implementations.IAEItemPowerStorage;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEItemPowerStorage
|
||||
{
|
||||
|
||||
public AEBaseItemBlockChargeable(int id) {
|
||||
super( id );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack is, EntityPlayer player, List lines, boolean advancedItemTooltips)
|
||||
{
|
||||
NBTTagCompound tag = is.getTagCompound();
|
||||
double internalCurrentPower = 0;
|
||||
double internalMaxPower = getMax( is );
|
||||
|
||||
if ( tag != null )
|
||||
{
|
||||
internalCurrentPower = tag.getDouble( "internalCurrentPower" );
|
||||
}
|
||||
|
||||
double percent = internalCurrentPower / internalMaxPower;
|
||||
|
||||
lines.add( Platform.gui_localize( "Stored Energy" ) + ":" + MessageFormat.format( " {0,number,#} ", internalCurrentPower )
|
||||
+ Platform.gui_localize( PowerUnits.AE.unlocalizedName ) + " - "
|
||||
+ MessageFormat.format( " {0,number,#.##%} ", percent ) );
|
||||
|
||||
}
|
||||
|
||||
private double getMax(ItemStack is)
|
||||
{
|
||||
Block blk = Block.blocksList[getBlockID()];
|
||||
if ( blk == AEApi.instance().blocks().blockEnergyCell.block() )
|
||||
return 200000;
|
||||
else
|
||||
return 8 * 200000;
|
||||
}
|
||||
|
||||
private double getInternal(ItemStack is)
|
||||
{
|
||||
NBTTagCompound nbt = Platform.openNbtData( is );
|
||||
return nbt.getDouble( "internalCurrentPower" );
|
||||
}
|
||||
|
||||
private void setInternal(ItemStack is, double amt)
|
||||
{
|
||||
NBTTagCompound nbt = Platform.openNbtData( is );
|
||||
nbt.setDouble( "internalCurrentPower", amt );
|
||||
}
|
||||
|
||||
@Override
|
||||
public double injectAEPower(ItemStack is, double amt)
|
||||
{
|
||||
double internalCurrentPower = getInternal( is );
|
||||
double internalMaxPower = getMax( is );
|
||||
internalCurrentPower += amt;
|
||||
if ( internalCurrentPower > internalMaxPower )
|
||||
{
|
||||
amt = internalCurrentPower - internalMaxPower;
|
||||
internalCurrentPower = internalMaxPower;
|
||||
setInternal( is, internalCurrentPower );
|
||||
return amt;
|
||||
}
|
||||
|
||||
setInternal( is, internalCurrentPower );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double extractAEPower(ItemStack is, double amt)
|
||||
{
|
||||
double internalCurrentPower = getInternal( is );
|
||||
if ( internalCurrentPower > amt )
|
||||
{
|
||||
internalCurrentPower -= amt;
|
||||
setInternal( is, internalCurrentPower );
|
||||
return amt;
|
||||
}
|
||||
|
||||
amt = internalCurrentPower;
|
||||
setInternal( is, 0 );
|
||||
return amt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAEMaxPower(ItemStack is)
|
||||
{
|
||||
double internalMaxPower = getMax( is );
|
||||
return internalMaxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAECurrentPower(ItemStack is)
|
||||
{
|
||||
double internalCurrentPower = getInternal( is );
|
||||
return internalCurrentPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessRestriction getPowerFlow(ItemStack is)
|
||||
{
|
||||
return AccessRestriction.WRITE;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
package appeng.block.grindstone;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.implementations.ICrankable;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderBlockCrank;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.grindstone.TileCrank;
|
||||
|
||||
public class BlockCrank extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockCrank() {
|
||||
super( BlockCrank.class, Material.wood );
|
||||
setfeature( EnumSet.of( AEFeature.GrindStone ) );
|
||||
setTileEntiy( TileCrank.class );
|
||||
setLightOpacity( 0 );
|
||||
isFullSize = isOpaque = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
AEBaseTile tile = getTileEntity( w, x, y, z );
|
||||
if ( tile instanceof TileCrank )
|
||||
{
|
||||
((TileCrank) tile).power();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RenderBlockCrank.class;
|
||||
}
|
||||
|
||||
private boolean isCrankable(World w, int x, int y, int z, ForgeDirection offset)
|
||||
{
|
||||
TileEntity te = w.getBlockTileEntity( x + offset.offsetX, y + offset.offsetY, z + offset.offsetZ );
|
||||
if ( te instanceof ICrankable )
|
||||
{
|
||||
return ((ICrankable) te).canCrankAttach( offset.getOpposite() );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private ForgeDirection findCrankable(World w, int x, int y, int z)
|
||||
{
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
if ( isCrankable( w, x, y, z, dir ) )
|
||||
return dir;
|
||||
return ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World w, int x, int y, int z)
|
||||
{
|
||||
return findCrankable( w, x, y, z ) != ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidOrientation(World w, int x, int y, int z, ForgeDirection forward, ForgeDirection up)
|
||||
{
|
||||
TileEntity te = w.getBlockTileEntity( x, y, z );
|
||||
return !(te instanceof TileCrank) || isCrankable( w, x, y, z, up.getOpposite() );
|
||||
}
|
||||
|
||||
private void dropCrank(World w, int x, int y, int z)
|
||||
{
|
||||
w.destroyBlock( x, y, z, true );
|
||||
w.markBlockForUpdate( x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World w, int x, int y, int z, EntityLivingBase p, ItemStack is)
|
||||
{
|
||||
AEBaseTile tile = getTileEntity( w, x, y, z );
|
||||
if ( tile != null )
|
||||
{
|
||||
ForgeDirection mnt = findCrankable( w, x, y, z );
|
||||
ForgeDirection forward = ForgeDirection.UP;
|
||||
if ( mnt == ForgeDirection.UP || mnt == ForgeDirection.DOWN )
|
||||
forward = ForgeDirection.SOUTH;
|
||||
tile.setOrientation( forward, mnt.getOpposite() );
|
||||
}
|
||||
else
|
||||
dropCrank( w, x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World w, int x, int y, int z, int id)
|
||||
{
|
||||
AEBaseTile tile = getTileEntity( w, x, y, z );
|
||||
if ( tile != null )
|
||||
{
|
||||
if ( !isCrankable( w, x, y, z, tile.getUp().getOpposite() ) )
|
||||
dropCrank( w, x, y, z );
|
||||
}
|
||||
else
|
||||
dropCrank( w, x, y, z );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package appeng.block.grindstone;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.grindstone.TileGrinder;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class BlockGrinder extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockGrinder() {
|
||||
super( BlockGrinder.class, Material.rock );
|
||||
setfeature( EnumSet.of( AEFeature.GrindStone ) );
|
||||
setTileEntiy( TileGrinder.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileGrinder tg = getTileEntity( w, x, y, z );
|
||||
if ( tg != null && !p.isSneaking() )
|
||||
{
|
||||
Platform.openGUI( p, tg, ForgeDirection.getOrientation(side),GuiBridge.GUI_GRINDER );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package appeng.block.mac;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.mac.TileMolecularAssembler;
|
||||
|
||||
public class BlockContainmentWall extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockContainmentWall() {
|
||||
super( BlockContainmentWall.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.MolecularAssembler ) );
|
||||
setTileEntiy( TileMolecularAssembler.class );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package appeng.block.mac;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.mac.TileMolecularAssembler;
|
||||
|
||||
public class BlockCraftingAccelerator extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockCraftingAccelerator() {
|
||||
super( BlockCraftingAccelerator.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.MolecularAssembler ) );
|
||||
setTileEntiy( TileMolecularAssembler.class );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package appeng.block.mac;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.mac.TileMolecularAssembler;
|
||||
|
||||
public class BlockHeatVent extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockHeatVent() {
|
||||
super( BlockHeatVent.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.MolecularAssembler ) );
|
||||
setTileEntiy( TileMolecularAssembler.class );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package appeng.block.mac;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.mac.TilePatternProvider;
|
||||
|
||||
public class BlockPatternProvider extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockPatternProvider() {
|
||||
super( BlockPatternProvider.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.MolecularAssembler ) );
|
||||
setTileEntiy( TilePatternProvider.class );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,155 @@
|
|||
package appeng.block.misc;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderBlockCharger;
|
||||
import appeng.client.render.effects.LightningEffect;
|
||||
import appeng.core.Configuration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.misc.TileCharger;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class BlockCharger extends AEBaseBlock implements ICustomCollision
|
||||
{
|
||||
|
||||
public BlockCharger() {
|
||||
super( BlockCharger.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.Core ) );
|
||||
setTileEntiy( TileCharger.class );
|
||||
setLightOpacity( 2 );
|
||||
isFullSize = false;
|
||||
isOpaque = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if ( player.isSneaking() )
|
||||
return false;
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
TileCharger tc = getTileEntity( w, x, y, z );
|
||||
if ( tc != null )
|
||||
{
|
||||
tc.activate( player );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RenderBlockCharger.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World w, int x, int y, int z, Random r)
|
||||
{
|
||||
if ( !Configuration.instance.enableEffects )
|
||||
return;
|
||||
|
||||
if ( r.nextFloat() < 0.98 )
|
||||
return;
|
||||
|
||||
AEBaseTile tile = getTileEntity( w, x, y, z );
|
||||
if ( tile instanceof TileCharger )
|
||||
{
|
||||
TileCharger tc = (TileCharger) tile;
|
||||
if ( AEApi.instance().materials().materialCertusQuartzCrystalCharged.sameAs( tc.getStackInSlot( 0 ) ) )
|
||||
{
|
||||
|
||||
double xOff = 0.0;
|
||||
double yOff = 0.0;
|
||||
double zOff = 0.0;
|
||||
|
||||
for (int bolts = 0; bolts < 3; bolts++)
|
||||
{
|
||||
LightningEffect fx = new LightningEffect( w, xOff + 0.5 + x, yOff + 0.5 + y, zOff + 0.5 + z, 0.0D, 0.0D, 0.0D );
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z)
|
||||
{
|
||||
TileCharger tile = getTileEntity( w, x, y, z );
|
||||
if ( tile != null )
|
||||
{
|
||||
double twoPixels = 2.0 / 16.0;
|
||||
ForgeDirection up = tile.getUp();
|
||||
ForgeDirection forward = tile.getForward();
|
||||
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( twoPixels, twoPixels, twoPixels, 1.0 - twoPixels, 1.0 - twoPixels, 1.0 - twoPixels );
|
||||
|
||||
if ( up.offsetX != 0 )
|
||||
{
|
||||
bb.minX = 0;
|
||||
bb.maxX = 1;
|
||||
}
|
||||
if ( up.offsetY != 0 )
|
||||
{
|
||||
bb.minY = 0;
|
||||
bb.maxY = 1;
|
||||
}
|
||||
if ( up.offsetZ != 0 )
|
||||
{
|
||||
bb.minZ = 0;
|
||||
bb.maxZ = 1;
|
||||
}
|
||||
|
||||
switch (forward)
|
||||
{
|
||||
case DOWN:
|
||||
bb.maxY = 1;
|
||||
break;
|
||||
case UP:
|
||||
bb.minY = 0;
|
||||
break;
|
||||
case NORTH:
|
||||
bb.maxZ = 1;
|
||||
break;
|
||||
case SOUTH:
|
||||
bb.minZ = 0;
|
||||
break;
|
||||
case EAST:
|
||||
bb.minX = 0;
|
||||
break;
|
||||
case WEST:
|
||||
bb.maxX = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return Arrays.asList( new AxisAlignedBB[] { bb } );
|
||||
}
|
||||
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) } );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e)
|
||||
{
|
||||
out.add( AxisAlignedBB.getAABBPool().getAABB( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package appeng.block.misc;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.misc.TileCondenser;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class BlockCondenser extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockCondenser() {
|
||||
super( BlockCondenser.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.Core ) );
|
||||
setTileEntiy( TileCondenser.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if ( player.isSneaking() )
|
||||
return false;
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
TileCondenser tc = getTileEntity( w, x, y, z );
|
||||
if ( tc != null && !player.isSneaking() )
|
||||
{
|
||||
Platform.openGUI( player, tc, ForgeDirection.getOrientation(side), GuiBridge.GUI_CONDENSER );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package appeng.block.misc;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.misc.TileInscriber;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class BlockInscriber extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockInscriber() {
|
||||
super( BlockInscriber.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.Inscriber ) );
|
||||
setTileEntiy( TileInscriber.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if ( player.isSneaking() )
|
||||
return false;
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
TileInscriber tc = getTileEntity( w, x, y, z );
|
||||
if ( tc != null )
|
||||
{
|
||||
tc.activate( player );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package appeng.block.misc;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
|
||||
public class BlockInterface extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockInterface() {
|
||||
super( BlockInterface.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.Core ) );
|
||||
setTileEntiy( TileInterface.class );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package appeng.block.misc;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.misc.TileNetworkEmitter;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class BlockNetworkEmitter extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockNetworkEmitter() {
|
||||
super( BlockNetworkEmitter.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.Core ) );
|
||||
setTileEntiy( TileNetworkEmitter.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if ( player.isSneaking() )
|
||||
return false;
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
TileNetworkEmitter tc = getTileEntity( w, x, y, z );
|
||||
if ( tc != null )
|
||||
{
|
||||
tc.activate( player );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package appeng.block.misc;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.misc.TilePartitionerEditor;
|
||||
|
||||
public class BlockPartitionEditor extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockPartitionEditor() {
|
||||
super( BlockPartitionEditor.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.StorageCells ) );
|
||||
setTileEntiy( TilePartitionerEditor.class );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package appeng.block.misc;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.misc.TileQuartzCrystalizer;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class BlockQuartzCrystalizer extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockQuartzCrystalizer() {
|
||||
super( BlockQuartzCrystalizer.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.Core ) );
|
||||
setTileEntiy( TileQuartzCrystalizer.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if ( player.isSneaking() )
|
||||
return false;
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
TileQuartzCrystalizer tc = getTileEntity( w, x, y, z );
|
||||
if ( tc != null )
|
||||
{
|
||||
tc.activate( player );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,128 @@
|
|||
package appeng.block.misc;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderQuartzTorch;
|
||||
import appeng.client.render.effects.LightningEffect;
|
||||
import appeng.core.Configuration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.helpers.MetaRotation;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, ICustomCollision
|
||||
{
|
||||
|
||||
public BlockQuartzTorch() {
|
||||
super( BlockQuartzTorch.class, Material.circuits );
|
||||
setfeature( EnumSet.of( AEFeature.DecorativeLights ) );
|
||||
setLightOpacity( 0 );
|
||||
setLightValue( 0.9375F );
|
||||
isFullSize = isOpaque = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RenderQuartzTorch.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOrientable getOrientable(final IBlockAccess w, final int x, final int y, final int z)
|
||||
{
|
||||
return new MetaRotation( w, x, y, z );
|
||||
}
|
||||
|
||||
private void dropTorch(World w, int x, int y, int z)
|
||||
{
|
||||
w.destroyBlock( x, y, z, true );
|
||||
w.markBlockForUpdate( x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World w, int x, int y, int z)
|
||||
{
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
if ( canPlaceAt( w, x, y, z, dir ) )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean canPlaceAt(World w, int x, int y, int z, ForgeDirection dir)
|
||||
{
|
||||
return w.isBlockSolidOnSide( x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir.getOpposite(), false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidOrientation(World w, int x, int y, int z, ForgeDirection forward, ForgeDirection up)
|
||||
{
|
||||
return canPlaceAt( w, x, y, z, up.getOpposite() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World w, int x, int y, int z, int id)
|
||||
{
|
||||
ForgeDirection up = getOrientable( w, x, y, z ).getUp();
|
||||
if ( !canPlaceAt( w, x, y, z, up.getOpposite() ) )
|
||||
dropTorch( w, x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z)
|
||||
{
|
||||
ForgeDirection up = getOrientable( w, x, y, z ).getUp();
|
||||
double xOff = -0.3 * up.offsetX;
|
||||
double yOff = -0.3 * up.offsetY;
|
||||
double zOff = -0.3 * up.offsetZ;
|
||||
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7 ) } );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e)
|
||||
{/*
|
||||
* double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 * getUp().offsetY; double zOff = -0.15 *
|
||||
* getUp().offsetZ; out.add( AxisAlignedBB.getAABBPool().getAABB( xOff + (double) x + 0.15, yOff + (double) y +
|
||||
* 0.15, zOff + (double) z + 0.15,// ahh xOff + (double) x + 0.85, yOff + (double) y + 0.85, zOff + (double) z +
|
||||
* 0.85 ) );
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World w, int x, int y, int z, Random r)
|
||||
{
|
||||
if ( !Configuration.instance.enableEffects )
|
||||
return;
|
||||
|
||||
if ( r.nextFloat() < 0.98 )
|
||||
return;
|
||||
|
||||
ForgeDirection up = getOrientable( w, x, y, z ).getUp();
|
||||
double xOff = -0.3 * up.offsetX;
|
||||
double yOff = -0.3 * up.offsetY;
|
||||
double zOff = -0.3 * up.offsetZ;
|
||||
for (int bolts = 0; bolts < 3; bolts++)
|
||||
{
|
||||
LightningEffect fx = new LightningEffect( w, xOff + 0.5 + x, yOff + 0.5 + y, zOff + 0.5 + z, 0.0D, 0.0D, 0.0D );
|
||||
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,157 @@
|
|||
package appeng.block.misc;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderTinyTNT;
|
||||
import appeng.client.render.entity.EntityIds;
|
||||
import appeng.client.texture.FullIcon;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.entity.EntityTinyTNTPrimed;
|
||||
import appeng.helpers.DispenserBehaviorTinyTNT;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
|
||||
public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
||||
{
|
||||
|
||||
public BlockTinyTNT() {
|
||||
super( BlockTinyTNT.class, Material.tnt );
|
||||
setfeature( EnumSet.of( AEFeature.TinyTNT ) );
|
||||
setLightOpacity( 3 );
|
||||
setBlockBounds( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
|
||||
isFullSize = isOpaque = false;
|
||||
|
||||
EntityRegistry.registerModEntity( EntityTinyTNTPrimed.class, "EntityTinyTNTPrimed", EntityIds.TINY_TNT, AppEng.instance, 16, 4, true );
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject( Item.itemsList[blockID], new DispenserBehaviorTinyTNT() );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RenderTinyTNT.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegistry)
|
||||
{
|
||||
// no images required.
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(int direction, int metadata)
|
||||
{
|
||||
return new FullIcon( Block.tnt.getIcon( direction, metadata ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World w, int x, int y, int z, Entity entity)
|
||||
{
|
||||
if ( entity instanceof EntityArrow && !w.isRemote )
|
||||
{
|
||||
EntityArrow entityarrow = (EntityArrow) entity;
|
||||
|
||||
if ( entityarrow.isBurning() )
|
||||
{
|
||||
this.startFuse( w, x, y, z, entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase) entityarrow.shootingEntity : null );
|
||||
w.setBlockToAir( x, y, z );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World w, int x, int y, int z)
|
||||
{
|
||||
super.onBlockAdded( w, x, y, z );
|
||||
|
||||
if ( w.isBlockIndirectlyGettingPowered( x, y, z ) )
|
||||
{
|
||||
this.startFuse( w, x, y, z, null );
|
||||
w.setBlockToAir( x, y, z );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World w, int x, int y, int z, int id)
|
||||
{
|
||||
if ( w.isBlockIndirectlyGettingPowered( x, y, z ) )
|
||||
{
|
||||
this.startFuse( w, x, y, z, null );
|
||||
w.setBlockToAir( x, y, z );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if ( player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().itemID == Item.flintAndSteel.itemID )
|
||||
{
|
||||
this.startFuse( w, x, y, z, player );
|
||||
w.setBlockToAir( x, y, z );
|
||||
player.getCurrentEquippedItem().damageItem( 1, player );
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.onActivated( w, x, y, z, player, side, hitX, hitY, hitZ );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByExplosion(World w, int x, int y, int z, Explosion exp)
|
||||
{
|
||||
if ( !w.isRemote )
|
||||
{
|
||||
EntityTinyTNTPrimed entitytntprimed = new EntityTinyTNTPrimed( w, x + 0.5F, y + 0.5F, z + 0.5F, exp.getExplosivePlacedBy() );
|
||||
entitytntprimed.fuse = w.rand.nextInt( entitytntprimed.fuse / 4 ) + entitytntprimed.fuse / 8;
|
||||
w.spawnEntityInWorld( entitytntprimed );
|
||||
}
|
||||
}
|
||||
|
||||
public void startFuse(World w, int x, int y, int z, EntityLivingBase ignitor)
|
||||
{
|
||||
if ( !w.isRemote )
|
||||
{
|
||||
EntityTinyTNTPrimed entitytntprimed = new EntityTinyTNTPrimed( w, x + 0.5F, y + 0.5F, z + 0.5F, ignitor );
|
||||
w.spawnEntityInWorld( entitytntprimed );
|
||||
w.playSoundAtEntity( entitytntprimed, "random.fuse", 1.0F, 1.0F );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDropFromExplosion(Explosion exp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z)
|
||||
{
|
||||
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( 0.25, 0, 0.25, 0.75, 0.5, 0.75 ) } );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e)
|
||||
{
|
||||
out.add( AxisAlignedBB.getAABBPool().getAABB( 0.25, 0, 0.25, 0.75, 0.5, 0.75 ) );
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
package appeng.block.misc;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
import appeng.core.Configuration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.misc.TileVibrationChamber;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class BlockVibrationChamber extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockVibrationChamber() {
|
||||
super( BlockVibrationChamber.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.PowerGen ) );
|
||||
setTileEntiy( TileVibrationChamber.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if ( player.isSneaking() )
|
||||
return false;
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
TileVibrationChamber tc = getTileEntity( w, x, y, z );
|
||||
if ( tc != null && !player.isSneaking() )
|
||||
{
|
||||
Platform.openGUI( player, tc, ForgeDirection.getOrientation(side),GuiBridge.GUI_VIBRATIONCHAMBER );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getBlockTexture(IBlockAccess w, int x, int y, int z, int s)
|
||||
{
|
||||
Icon ico = super.getBlockTexture( w, x, y, z, s );
|
||||
TileVibrationChamber tvc = getTileEntity( w, x, y, z );
|
||||
|
||||
if ( tvc != null && tvc.isOn && ico == getRendererInstance().getTexture( ForgeDirection.SOUTH ) )
|
||||
{
|
||||
return ExtraTextures.BlockVibrationChamberFrontOn.getIcon();
|
||||
}
|
||||
|
||||
return ico;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World w, int x, int y, int z, Random r)
|
||||
{
|
||||
if ( !Configuration.instance.enableEffects )
|
||||
return;
|
||||
|
||||
AEBaseTile tile = getTileEntity( w, x, y, z );
|
||||
if ( tile instanceof TileVibrationChamber )
|
||||
{
|
||||
TileVibrationChamber tc = (TileVibrationChamber) tile;
|
||||
if ( tc.isOn )
|
||||
{
|
||||
float f1 = (float) x + 0.5F;
|
||||
float f2 = (float) y + 0.5F;
|
||||
float f3 = (float) z + 0.5F;
|
||||
|
||||
ForgeDirection forward = tc.getForward();
|
||||
ForgeDirection up = tc.getUp();
|
||||
|
||||
int west_x = forward.offsetY * up.offsetZ - forward.offsetZ * up.offsetY;
|
||||
int west_y = forward.offsetZ * up.offsetX - forward.offsetX * up.offsetZ;
|
||||
int west_z = forward.offsetX * up.offsetY - forward.offsetY * up.offsetX;
|
||||
|
||||
f1 += forward.offsetX * 0.6;
|
||||
f2 += forward.offsetY * 0.6;
|
||||
f3 += forward.offsetZ * 0.6;
|
||||
|
||||
float ox = r.nextFloat();
|
||||
float oy = r.nextFloat() * 0.2f;
|
||||
|
||||
f1 += up.offsetX * (-0.3 + oy);
|
||||
f2 += up.offsetY * (-0.3 + oy);
|
||||
f3 += up.offsetZ * (-0.3 + oy);
|
||||
|
||||
f1 += west_x * (0.3 * ox - 0.15);
|
||||
f2 += west_y * (0.3 * ox - 0.15);
|
||||
f3 += west_z * (0.3 * ox - 0.15);
|
||||
|
||||
w.spawnParticle( "smoke", (double) f1, (double) f2, (double) f3, 0.0D, 0.0D, 0.0D );
|
||||
w.spawnParticle( "flame", (double) f1, (double) f2, (double) f3, 0.0D, 0.0D, 0.0D );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,234 @@
|
|||
package appeng.block.networking;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.parts.SelectedPart;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RendererCableBus;
|
||||
import appeng.client.texture.CableBusTextures;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.integration.abstraction.IFMP;
|
||||
import appeng.parts.CableBusContainer;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
|
||||
public class BlockCableBus extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockCableBus() {
|
||||
super( BlockCableBus.class, Material.glass );
|
||||
setfeature( EnumSet.of( AEFeature.Core ) );
|
||||
setLightOpacity( 0 );
|
||||
isFullSize = isOpaque = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour)
|
||||
{
|
||||
try
|
||||
{
|
||||
return cb( world, x, y, z ).recolourBlock( side, colour );
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random r)
|
||||
{
|
||||
CableBusContainer cb = cb( world, x, y, z );
|
||||
if ( cb != null )
|
||||
cb.randomDisplayTick( world, x, y, z, r );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
CableBusContainer cb = cb( world, x, y, z );
|
||||
if ( cb != null )
|
||||
return cb.getLightValue();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
|
||||
{
|
||||
Vec3 v3 = target.hitVec.addVector( -x, -y, -z );
|
||||
SelectedPart sp = cb( world, x, y, z ).selectPart( v3 );
|
||||
if ( sp != null )
|
||||
{
|
||||
if ( sp.part != null )
|
||||
return sp.part.getItemStack( false );
|
||||
if ( sp.facade != null )
|
||||
return sp.facade.getItemStack();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockReplaceable(World world, int x, int y, int z)
|
||||
{
|
||||
return cb( world, x, y, z ).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeBlockByPlayer(World world, EntityPlayer player, int x, int y, int z)
|
||||
{
|
||||
if ( player.capabilities.isCreativeMode )
|
||||
{
|
||||
AEBaseTile tile = getTileEntity( world, x, y, z );
|
||||
if ( tile != null )
|
||||
tile.dropItems = false;
|
||||
// maybe ray trace?
|
||||
}
|
||||
return super.removeBlockByPlayer( world, player, x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getBlockTexture(IBlockAccess w, int x, int y, int z, int s)
|
||||
{
|
||||
return getIcon( s, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(int direction, int metadata)
|
||||
{
|
||||
Icon i = super.getIcon( direction, metadata );
|
||||
if ( i != null )
|
||||
return i;
|
||||
return CableBusTextures.getMissing();
|
||||
}
|
||||
|
||||
private CableBusContainer cb(IBlockAccess w, int x, int y, int z)
|
||||
{
|
||||
TileEntity te = w.getBlockTileEntity( x, y, z );
|
||||
if ( te instanceof TileCableBus )
|
||||
return ((TileCableBus) te).cb;
|
||||
|
||||
if ( AppEng.instance.isIntegrationEnabled( "FMP" ) )
|
||||
return ((IFMP) AppEng.instance.getIntegration( "FMP" )).getCableContainer( te );
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RendererCableBus.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegistry)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private int rs(int side)
|
||||
{
|
||||
int s = 0;
|
||||
switch (side)
|
||||
{
|
||||
case -1:
|
||||
s = 1;
|
||||
break;
|
||||
case 1:
|
||||
s = 2;
|
||||
break;
|
||||
case 2:
|
||||
s = 5;
|
||||
break;
|
||||
case 3:
|
||||
s = 3;
|
||||
break;
|
||||
case 4:
|
||||
s = 4;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockSolidOnSide(World w, int x, int y, int z, ForgeDirection side)
|
||||
{
|
||||
return cb( w, x, y, z ).isSolidOnSide( side );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World w, int x, int y, int z, int meh)
|
||||
{
|
||||
cb( w, x, y, z ).onNeighborChanged();
|
||||
// kinda works
|
||||
/*
|
||||
* if ( cb( w, x, y, z ).isEmpty() ) { w.setBlockToAir( x, y, z ); }
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
return cb( w, x, y, z ).activate( player, w.getWorldVec3Pool().getVecFromPool( hitX, hitY, hitZ ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World w, int x, int y, int z, Entity e)
|
||||
{
|
||||
cb( w, x, y, z ).onEntityCollision( e );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectRedstone(IBlockAccess w, int x, int y, int z, int side)
|
||||
{
|
||||
return cb( w, x, y, z ).canConnectRedstone( ForgeDirection.getOrientation( rs( side ) ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower(IBlockAccess w, int x, int y, int z, int side)
|
||||
{
|
||||
return cb( w, x, y, z ).isProvidingWeakPower( ForgeDirection.getOrientation( side ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingStrongPower(IBlockAccess w, int x, int y, int z, int side)
|
||||
{
|
||||
return cb( w, x, y, z ).isProvidingStrongPower( ForgeDirection.getOrientation( side ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void setupTile()
|
||||
{
|
||||
setTileEntiy( Api.instance.partHelper.getCombinedInstance( TileCableBus.class.getName() ) );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package appeng.block.networking;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderBlockController;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.networking.TileController;
|
||||
|
||||
public class BlockController extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockController() {
|
||||
super( BlockController.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.Core ) );
|
||||
setTileEntiy( TileController.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World w, int x, int y, int z, int id_junk)
|
||||
{
|
||||
TileController tc = getTileEntity( w, x, y, z );
|
||||
if ( tc != null )
|
||||
tc.onNeighborChange( false );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RenderBlockController.class;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package appeng.block.networking;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.networking.TileCreativeEnergyCell;
|
||||
|
||||
public class BlockCreativeEnergyCell extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockCreativeEnergyCell() {
|
||||
super( BlockCreativeEnergyCell.class, Material.glass );
|
||||
setfeature( EnumSet.of( AEFeature.Creative ) );
|
||||
setTileEntiy( TileCreativeEnergyCell.class );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package appeng.block.networking;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.util.Icon;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.networking.TileDenseEnergyCell;
|
||||
|
||||
public class BlockDenseEnergyCell extends BlockEnergyCell
|
||||
{
|
||||
|
||||
@Override
|
||||
public double getMaxPower()
|
||||
{
|
||||
return 200000.0 * 8.0;
|
||||
}
|
||||
|
||||
public BlockDenseEnergyCell() {
|
||||
super( BlockDenseEnergyCell.class );
|
||||
setfeature( EnumSet.of( AEFeature.DenseEnergyCells ) );
|
||||
setTileEntiy( TileDenseEnergyCell.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(int direction, int metadata)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
case 0:
|
||||
return ExtraTextures.MEDenseEnergyCell0.getIcon();
|
||||
case 1:
|
||||
return ExtraTextures.MEDenseEnergyCell1.getIcon();
|
||||
case 2:
|
||||
return ExtraTextures.MEDenseEnergyCell2.getIcon();
|
||||
case 3:
|
||||
return ExtraTextures.MEDenseEnergyCell3.getIcon();
|
||||
case 4:
|
||||
return ExtraTextures.MEDenseEnergyCell4.getIcon();
|
||||
case 5:
|
||||
return ExtraTextures.MEDenseEnergyCell5.getIcon();
|
||||
case 6:
|
||||
return ExtraTextures.MEDenseEnergyCell6.getIcon();
|
||||
case 7:
|
||||
return ExtraTextures.MEDenseEnergyCell7.getIcon();
|
||||
|
||||
}
|
||||
return super.getIcon( direction, metadata );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package appeng.block.networking;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.networking.TileEnergyAcceptor;
|
||||
|
||||
public class BlockEnergyAcceptor extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockEnergyAcceptor() {
|
||||
super( BlockEnergyAcceptor.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.Core ) );
|
||||
setTileEntiy( TileEnergyAcceptor.class );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
package appeng.block.networking;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Icon;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.block.AEBaseItemBlockChargeable;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderBlockEnergyCube;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.networking.TileEnergyCell;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class BlockEnergyCell extends AEBaseBlock
|
||||
{
|
||||
|
||||
public double getMaxPower()
|
||||
{
|
||||
return 200000.0;
|
||||
}
|
||||
|
||||
public BlockEnergyCell(Class c) {
|
||||
super( c, Material.glass );
|
||||
}
|
||||
|
||||
public BlockEnergyCell() {
|
||||
this( BlockEnergyCell.class );
|
||||
setfeature( EnumSet.of( AEFeature.Core ) );
|
||||
setTileEntiy( TileEnergyCell.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(int id, CreativeTabs tab, List list)
|
||||
{
|
||||
super.getSubBlocks( id, tab, list );
|
||||
|
||||
ItemStack charged = new ItemStack( this, 1 );
|
||||
NBTTagCompound tag = Platform.openNbtData( charged );
|
||||
tag.setDouble( "internalCurrentPower", getMaxPower() );
|
||||
tag.setDouble( "internalMaxPower", getMaxPower() );
|
||||
list.add( charged );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RenderBlockEnergyCube.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(int direction, int metadata)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
case 0:
|
||||
return ExtraTextures.MEEnergyCell0.getIcon();
|
||||
case 1:
|
||||
return ExtraTextures.MEEnergyCell1.getIcon();
|
||||
case 2:
|
||||
return ExtraTextures.MEEnergyCell2.getIcon();
|
||||
case 3:
|
||||
return ExtraTextures.MEEnergyCell3.getIcon();
|
||||
case 4:
|
||||
return ExtraTextures.MEEnergyCell4.getIcon();
|
||||
case 5:
|
||||
return ExtraTextures.MEEnergyCell5.getIcon();
|
||||
case 6:
|
||||
return ExtraTextures.MEEnergyCell6.getIcon();
|
||||
case 7:
|
||||
return ExtraTextures.MEEnergyCell7.getIcon();
|
||||
|
||||
}
|
||||
return super.getIcon( direction, metadata );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getItemBlockClass()
|
||||
{
|
||||
return AEBaseItemBlockChargeable.class;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
package appeng.block.networking;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderBlockWireless;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
|
||||
public class BlockWireless extends AEBaseBlock implements ICustomCollision
|
||||
{
|
||||
|
||||
public BlockWireless() {
|
||||
super( BlockWireless.class, Material.glass );
|
||||
setfeature( EnumSet.of( AEFeature.Core, AEFeature.WirelessAccessTerminal ) );
|
||||
setTileEntiy( TileWireless.class );
|
||||
setLightOpacity( 0 );
|
||||
isFullSize = false;
|
||||
isOpaque = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RenderBlockWireless.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(int direction, int metadata)
|
||||
{
|
||||
return super.getIcon( direction, metadata );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxsFromPool(World w, int x, int y, int z)
|
||||
{
|
||||
TileWireless tile = getTileEntity( w, x, y, z );
|
||||
if ( tile != null )
|
||||
{
|
||||
ForgeDirection forward = tile.getForward();
|
||||
|
||||
double minX = 0;
|
||||
double minY = 0;
|
||||
double minZ = 0;
|
||||
double maxX = 1;
|
||||
double maxY = 1;
|
||||
double maxZ = 1;
|
||||
|
||||
switch (forward)
|
||||
{
|
||||
case DOWN:
|
||||
minZ = minX = 3.0 / 16.0;
|
||||
maxZ = maxX = 13.0 / 16.0;
|
||||
maxY = 1.0;
|
||||
minY = 5.0 / 16.0;
|
||||
break;
|
||||
case EAST:
|
||||
minZ = minY = 3.0 / 16.0;
|
||||
maxZ = maxY = 13.0 / 16.0;
|
||||
maxX = 11.0 / 16.0;
|
||||
minX = 0.0;
|
||||
break;
|
||||
case NORTH:
|
||||
minY = minX = 3.0 / 16.0;
|
||||
maxY = maxX = 13.0 / 16.0;
|
||||
maxZ = 1.0;
|
||||
minZ = 5.0 / 16.0;
|
||||
break;
|
||||
case SOUTH:
|
||||
minY = minX = 3.0 / 16.0;
|
||||
maxY = maxX = 13.0 / 16.0;
|
||||
maxZ = 11.0 / 16.0;
|
||||
minZ = 0.0;
|
||||
break;
|
||||
case UP:
|
||||
minZ = minX = 3.0 / 16.0;
|
||||
maxZ = maxX = 13.0 / 16.0;
|
||||
maxY = 11.0 / 16.0;
|
||||
minY = 0.0;
|
||||
break;
|
||||
case WEST:
|
||||
minZ = minY = 3.0 / 16.0;
|
||||
maxZ = maxY = 13.0 / 16.0;
|
||||
maxX = 1.0;
|
||||
minX = 5.0 / 16.0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( minX, minY, minZ, maxX, maxY, maxZ ) } );
|
||||
}
|
||||
return Arrays.asList( new AxisAlignedBB[] { AxisAlignedBB.getBoundingBox( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) } );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e)
|
||||
{
|
||||
TileWireless tile = getTileEntity( w, x, y, z );
|
||||
if ( tile != null )
|
||||
{
|
||||
ForgeDirection forward = tile.getForward();
|
||||
|
||||
double minX = 0;
|
||||
double minY = 0;
|
||||
double minZ = 0;
|
||||
double maxX = 1;
|
||||
double maxY = 1;
|
||||
double maxZ = 1;
|
||||
|
||||
switch (forward)
|
||||
{
|
||||
case DOWN:
|
||||
minZ = minX = 3.0 / 16.0;
|
||||
maxZ = maxX = 13.0 / 16.0;
|
||||
maxY = 1.0;
|
||||
minY = 5.0 / 16.0;
|
||||
break;
|
||||
case EAST:
|
||||
minZ = minY = 3.0 / 16.0;
|
||||
maxZ = maxY = 13.0 / 16.0;
|
||||
maxX = 11.0 / 16.0;
|
||||
minX = 0.0;
|
||||
break;
|
||||
case NORTH:
|
||||
minY = minX = 3.0 / 16.0;
|
||||
maxY = maxX = 13.0 / 16.0;
|
||||
maxZ = 1.0;
|
||||
minZ = 5.0 / 16.0;
|
||||
break;
|
||||
case SOUTH:
|
||||
minY = minX = 3.0 / 16.0;
|
||||
maxY = maxX = 13.0 / 16.0;
|
||||
maxZ = 11.0 / 16.0;
|
||||
minZ = 0.0;
|
||||
break;
|
||||
case UP:
|
||||
minZ = minX = 3.0 / 16.0;
|
||||
maxZ = maxX = 13.0 / 16.0;
|
||||
maxY = 11.0 / 16.0;
|
||||
minY = 0.0;
|
||||
break;
|
||||
case WEST:
|
||||
minZ = minY = 3.0 / 16.0;
|
||||
maxZ = maxY = 13.0 / 16.0;
|
||||
maxX = 1.0;
|
||||
minX = 5.0 / 16.0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
out.add( AxisAlignedBB.getAABBPool().getAABB( minX, minY, minZ, maxX, maxY, maxZ ) );
|
||||
}
|
||||
else
|
||||
out.add( AxisAlignedBB.getAABBPool().getAABB( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package appeng.block.qnb;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderQNB;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
|
||||
public class BlockQuantumLinkChamber extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockQuantumLinkChamber() {
|
||||
super( BlockQuantumLinkChamber.class, Material.glass );
|
||||
setfeature( EnumSet.of( AEFeature.QuantumNetworkBridge ) );
|
||||
setTileEntiy( TileQuantumBridge.class );
|
||||
float shave = 2.0f / 16.0f;
|
||||
setBlockBounds( shave, shave, shave, 1.0f - shave, 1.0f - shave, 1.0f - shave );
|
||||
setLightOpacity( 0 );
|
||||
isFullSize = isOpaque = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RenderQNB.class;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package appeng.block.qnb;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderQNB;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
|
||||
public class BlockQuantumRing extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockQuantumRing() {
|
||||
super( BlockQuantumRing.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.QuantumNetworkBridge ) );
|
||||
setTileEntiy( TileQuantumBridge.class );
|
||||
float shave = 2.0f / 16.0f;
|
||||
setBlockBounds( shave, shave, shave, 1.0f - shave, 1.0f - shave, 1.0f - shave );
|
||||
setLightOpacity( 1 );
|
||||
isFullSize = isOpaque = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RenderQNB.class;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package appeng.block.solids;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderNull;
|
||||
import appeng.core.features.AEFeature;
|
||||
|
||||
public class BlockMatrixFrame extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockMatrixFrame() {
|
||||
super( BlockMatrixFrame.class, Material.portal );
|
||||
setfeature( EnumSet.of( AEFeature.SpatialIO ) );
|
||||
setResistance( 6000000.0F );
|
||||
setBlockUnbreakable();
|
||||
setLightOpacity( 0 );
|
||||
isOpaque = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RenderNull.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(int id, CreativeTabs tab, List list)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package appeng.block.solids;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
|
||||
public class BlockQuartz extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockQuartz() {
|
||||
super( BlockQuartz.class, Material.rock );
|
||||
setfeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package appeng.block.solids;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
|
||||
public class BlockQuartzChiseled extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockQuartzChiseled() {
|
||||
super( BlockQuartzChiseled.class, Material.rock );
|
||||
setfeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package appeng.block.solids;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderQuartzGlass;
|
||||
import appeng.core.features.AEFeature;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockQuartzGlass extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockQuartzGlass() {
|
||||
this( BlockQuartzGlass.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RenderQuartzGlass.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(IBlockAccess w, int x, int y, int z, int side)
|
||||
{
|
||||
if ( w.getBlockMaterial( x, y, z ) == Material.glass )
|
||||
{
|
||||
if ( Block.blocksList[w.getBlockId( x, y, z )].getRenderType() == this.getRenderType() )
|
||||
return false;
|
||||
}
|
||||
return super.shouldSideBeRendered( w, x, y, z, side );
|
||||
}
|
||||
|
||||
public BlockQuartzGlass(Class c) {
|
||||
super( c, Material.glass );
|
||||
setfeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
|
||||
setLightOpacity( 0 );
|
||||
isOpaque = false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package appeng.block.solids;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.client.render.effects.VibrantEffect;
|
||||
import appeng.core.Configuration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockQuartzLamp extends BlockQuartzGlass
|
||||
{
|
||||
|
||||
public BlockQuartzLamp() {
|
||||
super( BlockQuartzLamp.class );
|
||||
setfeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks, AEFeature.DecorativeLights ) );
|
||||
setLightValue( 1.0f );
|
||||
setTextureName( "BlockQuartzGlass" );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World w, int x, int y, int z, Random r)
|
||||
{
|
||||
if ( !Configuration.instance.enableEffects )
|
||||
return;
|
||||
|
||||
double d0 = (double) (r.nextFloat() - 0.5F) * 0.96D;
|
||||
double d1 = (double) (r.nextFloat() - 0.5F) * 0.96D;
|
||||
double d2 = (double) (r.nextFloat() - 0.5F) * 0.96D;
|
||||
|
||||
VibrantEffect fx = new VibrantEffect( w, 0.5 + x + d0, 0.5 + y + d1, 0.5 + z + d2, 0.0D, 0.0D, 0.0D );
|
||||
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package appeng.block.solids;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.MetaRotation;
|
||||
|
||||
public class BlockQuartzPillar extends AEBaseBlock implements IOrientableBlock
|
||||
{
|
||||
|
||||
public BlockQuartzPillar() {
|
||||
super( BlockQuartzPillar.class, Material.rock );
|
||||
setfeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOrientable getOrientable(final IBlockAccess w, final int x, final int y, final int z)
|
||||
{
|
||||
return new MetaRotation( w, x, y, z );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
package appeng.block.solids;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderQuartzOre;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.LocationRotation;
|
||||
|
||||
public class OreQuartz extends AEBaseBlock implements IOrientableBlock
|
||||
{
|
||||
|
||||
public int boostBrightnessLow;
|
||||
public int boostBrightnessHigh;
|
||||
public boolean enhanceBrightness;
|
||||
|
||||
public OreQuartz(Class self) {
|
||||
super( self, Material.rock );
|
||||
setfeature( EnumSet.of( AEFeature.Core ) );
|
||||
setHardness( 3.0F );
|
||||
setResistance( 5.0F );
|
||||
boostBrightnessLow = 0;
|
||||
boostBrightnessHigh = 1;
|
||||
enhanceBrightness = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RenderQuartzOre.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMixedBrightnessForBlock(IBlockAccess par1iBlockAccess, int par2, int par3, int par4)
|
||||
{
|
||||
int j1 = super.getMixedBrightnessForBlock( par1iBlockAccess, par2, par3, par4 );
|
||||
if ( enhanceBrightness )
|
||||
{
|
||||
j1 = Math.max( j1 >> 20, j1 >> 4 );
|
||||
|
||||
if ( j1 > 4 )
|
||||
j1 += boostBrightnessHigh;
|
||||
else
|
||||
j1 += boostBrightnessLow;
|
||||
|
||||
if ( j1 > 15 )
|
||||
j1 = 15;
|
||||
return j1 << 20 | j1 << 4;
|
||||
}
|
||||
return j1;
|
||||
}
|
||||
|
||||
public OreQuartz() {
|
||||
this( OreQuartz.class );
|
||||
}
|
||||
|
||||
ItemStack getItemDropped()
|
||||
{
|
||||
return AEApi.instance().materials().materialCertusQuartzCrystal.stack( 1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOrientable getOrientable(final IBlockAccess w, final int x, final int y, final int z)
|
||||
{
|
||||
return new LocationRotation( w, x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int idDropped(int id, Random rand, int meta)
|
||||
{
|
||||
return getItemDropped().itemID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int id)
|
||||
{
|
||||
return getItemDropped().getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random rand)
|
||||
{
|
||||
return 1 + rand.nextInt( 2 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDroppedWithBonus(int fortune, Random rand)
|
||||
{
|
||||
if ( fortune > 0 && this.blockID != this.idDropped( 0, rand, fortune ) )
|
||||
{
|
||||
int j = rand.nextInt( fortune + 2 ) - 1;
|
||||
|
||||
if ( j < 0 )
|
||||
{
|
||||
j = 0;
|
||||
}
|
||||
|
||||
return this.quantityDropped( rand ) * (j + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.quantityDropped( rand );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropBlockAsItemWithChance(World w, int x, int y, int z, int blockid, float something, int meta)
|
||||
{
|
||||
super.dropBlockAsItemWithChance( w, x, y, z, blockid, something, meta );
|
||||
|
||||
if ( this.idDropped( blockid, w.rand, meta ) != this.blockID )
|
||||
{
|
||||
int xp = MathHelper.getRandomIntegerInRange( w.rand, 2, 5 );
|
||||
|
||||
this.dropXpOnBlockBreak( w, x, y, z, xp );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package appeng.block.solids;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.client.render.effects.ChargedOreEffect;
|
||||
import appeng.core.Configuration;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class OreQuartzCharged extends OreQuartz
|
||||
{
|
||||
|
||||
public OreQuartzCharged() {
|
||||
super( OreQuartzCharged.class );
|
||||
boostBrightnessLow = 2;
|
||||
boostBrightnessHigh = 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
ItemStack getItemDropped()
|
||||
{
|
||||
return AEApi.instance().materials().materialCertusQuartzCrystalCharged.stack( 1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World w, int x, int y, int z, Random r)
|
||||
{
|
||||
if ( !Configuration.instance.enableEffects )
|
||||
return;
|
||||
|
||||
double xOff = (double) (r.nextFloat());
|
||||
double yOff = (double) (r.nextFloat());
|
||||
double zOff = (double) (r.nextFloat());
|
||||
|
||||
switch (r.nextInt( 6 ))
|
||||
{
|
||||
case 0:
|
||||
xOff = -0.01;
|
||||
break;
|
||||
case 1:
|
||||
yOff = -0.01;
|
||||
break;
|
||||
case 2:
|
||||
xOff = -0.01;
|
||||
break;
|
||||
case 3:
|
||||
zOff = -0.01;
|
||||
break;
|
||||
case 4:
|
||||
xOff = 1.01;
|
||||
break;
|
||||
case 5:
|
||||
yOff = 1.01;
|
||||
break;
|
||||
case 6:
|
||||
zOff = 1.01;
|
||||
break;
|
||||
}
|
||||
|
||||
ChargedOreEffect fx = new ChargedOreEffect( w, x + xOff, y + yOff, z + zOff, 0.0f, 0.0f, 0.0f );
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect( (EntityFX) fx );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package appeng.block.spatial;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.spatial.TileSpatialIOPort;
|
||||
|
||||
public class BlockSpatialIOPort extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockSpatialIOPort() {
|
||||
super( BlockSpatialIOPort.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.SpatialIO ) );
|
||||
setTileEntiy( TileSpatialIOPort.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onNeighborBlockChange(World w, int x, int y, int z, int junk)
|
||||
{
|
||||
TileSpatialIOPort te = getTileEntity( w, x, y, z );
|
||||
if ( te != null )
|
||||
te.updateRedstoneState();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package appeng.block.spatial;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderSpatialPylon;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.spatial.TileSpatialPylon;
|
||||
|
||||
public class BlockSpatialPylon extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockSpatialPylon() {
|
||||
super( BlockSpatialPylon.class, Material.glass );
|
||||
setfeature( EnumSet.of( AEFeature.SpatialIO ) );
|
||||
setTileEntiy( TileSpatialPylon.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World w, int x, int y, int z, int junk)
|
||||
{
|
||||
TileSpatialPylon tsp = getTileEntity( w, x, y, z );
|
||||
if ( tsp != null )
|
||||
tsp.onNeighborBlockChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess w, int x, int y, int z)
|
||||
{
|
||||
TileSpatialPylon tsp = getTileEntity( w, x, y, z );
|
||||
if ( tsp != null )
|
||||
return tsp.getLightValue();
|
||||
return super.getLightValue( w, x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RenderSpatialPylon.class;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package appeng.block.storage;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderMEChest;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.storage.TileChest;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class BlockChest extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockChest() {
|
||||
super( BlockChest.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.StorageCells, AEFeature.MEChest ) );
|
||||
setTileEntiy( TileChest.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RenderMEChest.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileChest tg = getTileEntity( w, x, y, z );
|
||||
if ( tg != null && !p.isSneaking() )
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
return true;
|
||||
|
||||
if ( side != tg.getUp().ordinal() )
|
||||
{
|
||||
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_CHEST );
|
||||
}
|
||||
else if ( tg.isPowered() )
|
||||
{
|
||||
ItemStack cell = tg.getStackInSlot( 1 );
|
||||
if ( cell != null )
|
||||
{
|
||||
ICellHandler ch = AEApi.instance().registries().cell().getHander( cell );
|
||||
|
||||
List<IMEInventoryHandler> ih = tg.getCellArray( StorageChannel.ITEMS );
|
||||
if ( ch != null && ih != null && ih.size() == 1 )
|
||||
{
|
||||
IMEInventoryHandler mine = ih.get( 0 );
|
||||
ch.openChestGui( p, tg, ch, mine, cell, StorageChannel.ITEMS );
|
||||
return true;
|
||||
}
|
||||
|
||||
List<IMEInventoryHandler> fh = tg.getCellArray( StorageChannel.FLUIDS );
|
||||
if ( ch != null && fh != null && ih.size() == 1 )
|
||||
{
|
||||
IMEInventoryHandler mine = fh.get( 0 );
|
||||
ch.openChestGui( p, tg, ch, mine, cell, StorageChannel.FLUIDS );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
p.sendChatToPlayer( PlayerMessages.ChestCannotReadStorageCell.get() );
|
||||
}
|
||||
else
|
||||
p.sendChatToPlayer( PlayerMessages.MachineNotPowered.get() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package appeng.block.storage;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderDrive;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.storage.TileDrive;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class BlockDrive extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockDrive() {
|
||||
super( BlockDrive.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.StorageCells, AEFeature.MEDrive ) );
|
||||
setTileEntiy( TileDrive.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BaseBlockRender> getRenderer()
|
||||
{
|
||||
return RenderDrive.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileDrive tg = getTileEntity( w, x, y, z );
|
||||
if ( tg != null && !p.isSneaking() )
|
||||
{
|
||||
Platform.openGUI( p, tg, ForgeDirection.getOrientation(side),GuiBridge.GUI_DRIVE );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package appeng.block.storage;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.storage.TileIOPort;
|
||||
|
||||
public class BlockIOPort extends AEBaseBlock
|
||||
{
|
||||
|
||||
public BlockIOPort() {
|
||||
super( BlockIOPort.class, Material.iron );
|
||||
setfeature( EnumSet.of( AEFeature.StorageCells, AEFeature.IOPort ) );
|
||||
setTileEntiy( TileIOPort.class );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package appeng.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.TESRWrapper;
|
||||
import appeng.client.render.WorldRender;
|
||||
import appeng.client.render.entity.RenderTinyTNTPrimed;
|
||||
import appeng.client.texture.CableBusTextures;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
import appeng.entity.EntityTinyTNTPrimed;
|
||||
import appeng.server.ServerHelper;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class ClientHelper extends ServerHelper
|
||||
{
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register( this );
|
||||
|
||||
RenderingRegistry.registerBlockHandler( WorldRender.instance );
|
||||
RenderManager.instance.entityRenderMap.put( EntityTinyTNTPrimed.class, new RenderTinyTNTPrimed() );
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
public void updateTextureSheet(TextureStitchEvent.Pre ev)
|
||||
{
|
||||
if ( ev.map.textureType == 0 )
|
||||
{
|
||||
for (ExtraTextures et : ExtraTextures.values())
|
||||
et.registerIcon( ev.map );
|
||||
|
||||
for (CableBusTextures cb : CableBusTextures.values())
|
||||
cb.registerIcon( ev.map );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
return Minecraft.getMinecraft().theWorld;
|
||||
else
|
||||
return super.getWorld();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindTileEntitySpecialRenderer(Class tile, AEBaseBlock blk)
|
||||
{
|
||||
BaseBlockRender bbr = blk.getRendererInstance().rendererInstance;
|
||||
if ( bbr.hasTESR )
|
||||
ClientRegistry.bindTileEntitySpecialRenderer( tile, new TESRWrapper( bbr ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityPlayer> getPlayers()
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
{
|
||||
List<EntityPlayer> o = new ArrayList();
|
||||
o.add( Minecraft.getMinecraft().thePlayer );
|
||||
return o;
|
||||
}
|
||||
else
|
||||
return super.getPlayers();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,292 @@
|
|||
package appeng.client.gui;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.client.gui.widgets.ITooltip;
|
||||
import appeng.client.me.InternalSlotME;
|
||||
import appeng.client.me.SlotME;
|
||||
import appeng.core.sync.packets.PacketInventoryAction;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
public abstract class AEBaseGui extends GuiContainer
|
||||
{
|
||||
|
||||
protected List<InternalSlotME> meSlots = new LinkedList<InternalSlotME>();
|
||||
protected GuiScrollbar myScrollBar = null;
|
||||
|
||||
public AEBaseGui(Container container) {
|
||||
super( container );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
Iterator<Slot> i = inventorySlots.inventorySlots.iterator();
|
||||
while (i.hasNext())
|
||||
if ( i.next() instanceof SlotME )
|
||||
i.remove();
|
||||
|
||||
for (InternalSlotME me : meSlots)
|
||||
inventorySlots.inventorySlots.add( new SlotME( me ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMouseInput()
|
||||
{
|
||||
super.handleMouseInput();
|
||||
|
||||
if ( myScrollBar != null )
|
||||
{
|
||||
int i = Mouse.getEventDWheel();
|
||||
if ( i != 0 )
|
||||
myScrollBar.wheel( i );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleMouseClick(Slot slot, int slotIdx, int ctrlDown, int key)
|
||||
{
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
if ( slot instanceof SlotME )
|
||||
{
|
||||
InventoryAction action = null;
|
||||
IAEItemStack stack = null;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case 0: // pickup / set-down.
|
||||
action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACESINGLE : InventoryAction.PICKUP_OR_SETDOWN;
|
||||
stack = ((SlotME) slot).getAEStack();
|
||||
break;
|
||||
case 1:
|
||||
action = InventoryAction.SHIFT_CLICK;
|
||||
stack = ((SlotME) slot).getAEStack();
|
||||
break;
|
||||
|
||||
case 3: // creative dupe:
|
||||
if ( player.capabilities.isCreativeMode )
|
||||
{
|
||||
IAEItemStack slotItem = ((SlotME) slot).getAEStack();
|
||||
if ( slotItem != null )
|
||||
{
|
||||
action = InventoryAction.CREATIVE_DUPLICATE;
|
||||
stack = slotItem;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
case 4: // drop item:
|
||||
case 6:
|
||||
}
|
||||
|
||||
if ( action != null )
|
||||
{
|
||||
PacketInventoryAction p;
|
||||
try
|
||||
{
|
||||
p = new PacketInventoryAction( action, slotIdx, stack );
|
||||
PacketDispatcher.sendPacketToServer( p.getPacket() );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
super.handleMouseClick( slot, slotIdx, ctrlDown, key );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouse_x, int mouse_y, float btn)
|
||||
{
|
||||
super.drawScreen( mouse_x, mouse_y, btn );
|
||||
|
||||
boolean hasClicked = Mouse.isButtonDown( 0 );
|
||||
if ( hasClicked && myScrollBar != null )
|
||||
myScrollBar.click( this, mouse_x - guiLeft, mouse_y - guiTop );
|
||||
|
||||
for (Object c : buttonList)
|
||||
{
|
||||
if ( c instanceof ITooltip )
|
||||
{
|
||||
ITooltip tooltip = (ITooltip) c;
|
||||
int x = tooltip.xPos(); // ((GuiImgButton) c).xPosition;
|
||||
int y = tooltip.yPos(); // ((GuiImgButton) c).yPosition;
|
||||
|
||||
if ( x < mouse_x && x + tooltip.getWidth() > mouse_x )
|
||||
{
|
||||
if ( y < mouse_y && y + tooltip.getHeight() > mouse_y )
|
||||
{
|
||||
String msg = tooltip.getMsg();
|
||||
if ( msg != null )
|
||||
drawTooltip( x + 8, y + 4, 0, msg );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void drawTooltip(int par2, int par3, int forceWidth, String Msg)
|
||||
{
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
GL11.glDisable( GL12.GL_RESCALE_NORMAL );
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
GL11.glDisable( GL11.GL_DEPTH_TEST );
|
||||
String[] var4 = Msg.split( "\n" );
|
||||
|
||||
if ( var4.length > 0 )
|
||||
{
|
||||
int var5 = 0;
|
||||
int var6;
|
||||
int var7;
|
||||
|
||||
for (var6 = 0; var6 < var4.length; ++var6)
|
||||
{
|
||||
var7 = fontRenderer.getStringWidth( (String) var4[var6] );
|
||||
|
||||
if ( var7 > var5 )
|
||||
{
|
||||
var5 = var7;
|
||||
}
|
||||
}
|
||||
|
||||
var6 = par2 + 12;
|
||||
var7 = par3 - 12;
|
||||
int var9 = 8;
|
||||
|
||||
if ( var4.length > 1 )
|
||||
{
|
||||
var9 += 2 + (var4.length - 1) * 10;
|
||||
}
|
||||
|
||||
if ( this.guiTop + var7 + var9 + 6 > this.height )
|
||||
{
|
||||
var7 = this.height - var9 - this.guiTop - 6;
|
||||
}
|
||||
|
||||
if ( forceWidth > 0 )
|
||||
var5 = forceWidth;
|
||||
|
||||
this.zLevel = 300.0F;
|
||||
itemRenderer.zLevel = 300.0F;
|
||||
int var10 = -267386864;
|
||||
this.drawGradientRect( var6 - 3, var7 - 4, var6 + var5 + 3, var7 - 3, var10, var10 );
|
||||
this.drawGradientRect( var6 - 3, var7 + var9 + 3, var6 + var5 + 3, var7 + var9 + 4, var10, var10 );
|
||||
this.drawGradientRect( var6 - 3, var7 - 3, var6 + var5 + 3, var7 + var9 + 3, var10, var10 );
|
||||
this.drawGradientRect( var6 - 4, var7 - 3, var6 - 3, var7 + var9 + 3, var10, var10 );
|
||||
this.drawGradientRect( var6 + var5 + 3, var7 - 3, var6 + var5 + 4, var7 + var9 + 3, var10, var10 );
|
||||
int var11 = 1347420415;
|
||||
int var12 = (var11 & 16711422) >> 1 | var11 & -16777216;
|
||||
this.drawGradientRect( var6 - 3, var7 - 3 + 1, var6 - 3 + 1, var7 + var9 + 3 - 1, var11, var12 );
|
||||
this.drawGradientRect( var6 + var5 + 2, var7 - 3 + 1, var6 + var5 + 3, var7 + var9 + 3 - 1, var11, var12 );
|
||||
this.drawGradientRect( var6 - 3, var7 - 3, var6 + var5 + 3, var7 - 3 + 1, var11, var11 );
|
||||
this.drawGradientRect( var6 - 3, var7 + var9 + 2, var6 + var5 + 3, var7 + var9 + 3, var12, var12 );
|
||||
|
||||
for (int var13 = 0; var13 < var4.length; ++var13)
|
||||
{
|
||||
String var14 = (String) var4[var13];
|
||||
|
||||
if ( var13 == 0 )
|
||||
{
|
||||
var14 = "\u00a7" + Integer.toHexString( 15 ) + var14;
|
||||
}
|
||||
else
|
||||
{
|
||||
var14 = "\u00a77" + var14;
|
||||
}
|
||||
|
||||
this.fontRenderer.drawStringWithShadow( var14, var6, var7, -1 );
|
||||
|
||||
if ( var13 == 0 )
|
||||
{
|
||||
var7 += 2;
|
||||
}
|
||||
|
||||
var7 += 10;
|
||||
}
|
||||
|
||||
this.zLevel = 0.0F;
|
||||
itemRenderer.zLevel = 0.0F;
|
||||
}
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
public abstract void drawBG(int offsetX, int offsetY, int mouseX, int mouseY);
|
||||
|
||||
public abstract void drawFG(int offsetX, int offsetY, int mouseX, int mouseY);
|
||||
|
||||
public void bindTexture(String base, String file)
|
||||
{
|
||||
ResourceLocation loc = new ResourceLocation( base, "textures/" + file );
|
||||
this.mc.getTextureManager().bindTexture( loc );
|
||||
}
|
||||
|
||||
public void bindTexture(String file)
|
||||
{
|
||||
ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/" + file );
|
||||
this.mc.getTextureManager().bindTexture( loc );
|
||||
}
|
||||
|
||||
protected void drawItem(int x, int y, ItemStack is)
|
||||
{
|
||||
this.zLevel = 100.0F;
|
||||
itemRenderer.zLevel = 100.0F;
|
||||
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
GL11.glEnable( GL12.GL_RESCALE_NORMAL );
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemRenderer.renderItemAndEffectIntoGUI( this.fontRenderer, this.mc.renderEngine, is, x, y );
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
|
||||
itemRenderer.zLevel = 0.0F;
|
||||
this.zLevel = 0.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
final protected void drawGuiContainerBackgroundLayer(float f, int x, int y)
|
||||
{
|
||||
int ox = guiLeft; // (width - xSize) / 2;
|
||||
int oy = guiTop; // (height - ySize) / 2;
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
drawBG( ox, oy, x, y );
|
||||
}
|
||||
|
||||
@Override
|
||||
final protected void drawGuiContainerForegroundLayer(int x, int y)
|
||||
{
|
||||
int ox = guiLeft; // (width - xSize) / 2;
|
||||
int oy = guiTop; // (height - ySize) / 2;
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
drawFG( ox, oy, x, y );
|
||||
if ( myScrollBar != null )
|
||||
myScrollBar.draw( this );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,315 @@
|
|||
package appeng.client.gui;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.me.SlotME;
|
||||
import appeng.client.render.AppEngRenderItem;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.AppEngSlot.hasCalculatedValidness;
|
||||
import appeng.container.slot.SlotDisabled;
|
||||
import appeng.container.slot.SlotInaccessable;
|
||||
import appeng.container.slot.SlotOutput;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.Configuration;
|
||||
|
||||
public abstract class AEBaseMEGui extends AEBaseGui
|
||||
{
|
||||
|
||||
public AEBaseMEGui(Container container) {
|
||||
super( container );
|
||||
}
|
||||
|
||||
// @Override - NEI
|
||||
public List<String> handleItemTooltip(ItemStack stack, int mousex, int mousey, List<String> currenttip)
|
||||
{
|
||||
if ( stack != null )
|
||||
{
|
||||
Slot s = getSlot( mousex, mousey );
|
||||
if ( s instanceof SlotME )
|
||||
{
|
||||
int BigNumber = Configuration.instance.useTerminalUseLargeFont() ? 999 : 9999;
|
||||
|
||||
IAEItemStack myStack = null;
|
||||
|
||||
try
|
||||
{
|
||||
SlotME theSlotField = (SlotME) s;
|
||||
myStack = theSlotField.getAEStack();
|
||||
}
|
||||
catch (Throwable _)
|
||||
{
|
||||
}
|
||||
|
||||
if ( myStack != null )
|
||||
{
|
||||
if ( myStack.getStackSize() > BigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged()) )
|
||||
currenttip.add( "\u00a77Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getStackSize() ) );
|
||||
|
||||
if ( myStack.getCountRequestable() > 0 )
|
||||
currenttip.add( "\u00a77Items Requestable: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getCountRequestable() ) );
|
||||
}
|
||||
else if ( stack.stackSize > BigNumber || (stack.stackSize > 1 && stack.isItemDamaged()) )
|
||||
{
|
||||
currenttip.add( "\u00a77Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( stack.stackSize ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
currenttip.add( StatCollector.translateToLocal( "AppEng.Gui.Whitelisted" ) );
|
||||
}
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
// Vanillia version...
|
||||
@Override
|
||||
protected void drawItemStackTooltip(ItemStack stack, int x, int y)
|
||||
{
|
||||
Slot s = getSlot( x, y );
|
||||
if ( s instanceof SlotME && stack != null )
|
||||
{
|
||||
int BigNumber = Configuration.instance.useTerminalUseLargeFont() ? 999 : 9999;
|
||||
|
||||
IAEItemStack myStack = null;
|
||||
|
||||
try
|
||||
{
|
||||
SlotME theSlotField = (SlotME) s;
|
||||
myStack = theSlotField.getAEStack();
|
||||
}
|
||||
catch (Throwable _)
|
||||
{
|
||||
}
|
||||
|
||||
if ( myStack != null )
|
||||
{
|
||||
List currenttip = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips );
|
||||
|
||||
if ( myStack.getStackSize() > BigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged()) )
|
||||
currenttip.add( "Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getStackSize() ) );
|
||||
|
||||
if ( myStack.getCountRequestable() > 0 )
|
||||
currenttip.add( "Items Requestable: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getCountRequestable() ) );
|
||||
|
||||
drawTooltip( x, y, 0, join( currenttip, "\n" ) );
|
||||
}
|
||||
else if ( stack != null && stack.stackSize > BigNumber )
|
||||
{
|
||||
List var4 = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips );
|
||||
var4.add( "Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( stack.stackSize ) );
|
||||
drawTooltip( x, y, 0, join( var4, "\n" ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
super.drawItemStackTooltip( stack, x, y );
|
||||
}
|
||||
|
||||
static String join(Collection<?> s, String delimiter)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
Iterator iter = s.iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
builder.append( iter.next() );
|
||||
if ( !iter.hasNext() )
|
||||
{
|
||||
break;
|
||||
}
|
||||
builder.append( delimiter );
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private Slot getSlot(int mousex, int mousey)
|
||||
{
|
||||
for (int j1 = 0; j1 < this.inventorySlots.inventorySlots.size(); ++j1)
|
||||
{
|
||||
Slot slot = (Slot) this.inventorySlots.inventorySlots.get( j1 );
|
||||
if ( isPointInRegion( slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, mousex, mousey ) )
|
||||
{
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void safeDrawSlot(Slot s)
|
||||
{
|
||||
try
|
||||
{
|
||||
super.drawSlotInventory( s );
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
if ( tessellator.isDrawing )
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
|
||||
AppEngRenderItem aeri = new AppEngRenderItem();
|
||||
|
||||
@Override
|
||||
protected void drawSlotInventory(Slot s)
|
||||
{
|
||||
if ( s instanceof SlotME )
|
||||
{
|
||||
RenderItem pIR = itemRenderer;
|
||||
itemRenderer = aeri;
|
||||
try
|
||||
{
|
||||
this.zLevel = 100.0F;
|
||||
itemRenderer.zLevel = 100.0F;
|
||||
|
||||
if ( ! isPowered() )
|
||||
{
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
super.drawRect( s.xDisplayPosition, s.yDisplayPosition, 16 + s.xDisplayPosition, 16 + s.yDisplayPosition, 0x66111111 );
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
}
|
||||
|
||||
this.zLevel = 0.0F;
|
||||
itemRenderer.zLevel = 0.0F;
|
||||
|
||||
if ( s instanceof SlotME )
|
||||
aeri.aestack = ((SlotME) s).getAEStack();
|
||||
else
|
||||
aeri.aestack = null;
|
||||
|
||||
safeDrawSlot( s );
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
AELog.warning( "[AppEng] AE prevented crash while drawing slot: " + err.toString() );
|
||||
if ( Tessellator.instance.isDrawing )
|
||||
Tessellator.instance.draw();
|
||||
}
|
||||
itemRenderer = pIR;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
ItemStack is = s.getStack();
|
||||
if ( s instanceof AppEngSlot && (((AppEngSlot) s).renderIconWithItem() || is == null) )
|
||||
{
|
||||
AppEngSlot aes = (AppEngSlot) s;
|
||||
if ( aes.getIcon() >= 0 )
|
||||
{
|
||||
bindTexture( "guis/states.png" );
|
||||
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
try
|
||||
{
|
||||
int uv_y = (int) Math.floor( aes.getIcon() / 16 );
|
||||
int uv_x = aes.getIcon() - uv_y * 16;
|
||||
|
||||
GL11.glEnable( GL11.GL_BLEND );
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
GL11.glEnable( GL11.GL_TEXTURE_2D );
|
||||
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
float par1 = aes.xDisplayPosition;
|
||||
float par2 = aes.yDisplayPosition;
|
||||
float par3 = uv_x * 16;
|
||||
float par4 = uv_y * 16;
|
||||
float par5 = 16;
|
||||
float par6 = 16;
|
||||
|
||||
float f = 0.00390625F;
|
||||
float f1 = 0.00390625F;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA_F( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() );
|
||||
tessellator.addVertexWithUV( (double) (par1 + 0), (double) (par2 + par6), (double) this.zLevel, (double) ((float) (par3 + 0) * f),
|
||||
(double) ((float) (par4 + par6) * f1) );
|
||||
tessellator.addVertexWithUV( (double) (par1 + par5), (double) (par2 + par6), (double) this.zLevel,
|
||||
(double) ((float) (par3 + par5) * f), (double) ((float) (par4 + par6) * f1) );
|
||||
tessellator.addVertexWithUV( (double) (par1 + par5), (double) (par2 + 0), (double) this.zLevel,
|
||||
(double) ((float) (par3 + par5) * f), (double) ((float) (par4 + 0) * f1) );
|
||||
tessellator.addVertexWithUV( (double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) ((float) (par3 + 0) * f),
|
||||
(double) ((float) (par4 + 0) * f1) );
|
||||
tessellator.setColorRGBA_F( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
tessellator.draw();
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
if ( tessellator.isDrawing )
|
||||
tessellator.draw();
|
||||
}
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
|
||||
if ( is != null && s instanceof AppEngSlot )
|
||||
{
|
||||
if ( ((AppEngSlot) s).isValid == hasCalculatedValidness.NotAvailable )
|
||||
{
|
||||
boolean isValid = s.isItemValid( is ) || s instanceof SlotOutput || s instanceof SlotDisabled || s instanceof SlotInaccessable;
|
||||
if ( isValid && s instanceof SlotRestrictedInput )
|
||||
{
|
||||
try
|
||||
{
|
||||
isValid = ((SlotRestrictedInput) s).isValid( is, this.mc.theWorld );
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
err.printStackTrace();
|
||||
}
|
||||
}
|
||||
((AppEngSlot) s).isValid = isValid ? hasCalculatedValidness.Valid : hasCalculatedValidness.Invalid;
|
||||
}
|
||||
|
||||
if ( ((AppEngSlot) s).isValid == hasCalculatedValidness.Invalid )
|
||||
{
|
||||
this.zLevel = 100.0F;
|
||||
itemRenderer.zLevel = 100.0F;
|
||||
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
super.drawRect( s.xDisplayPosition, s.yDisplayPosition, 16 + s.xDisplayPosition, 16 + s.yDisplayPosition, 0x66ff6666 );
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
|
||||
this.zLevel = 0.0F;
|
||||
itemRenderer.zLevel = 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
if ( s instanceof AppEngSlot )
|
||||
{
|
||||
((AppEngSlot) s).isDisplay = true;
|
||||
safeDrawSlot( s );
|
||||
}
|
||||
else
|
||||
safeDrawSlot( s );
|
||||
|
||||
return;
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
AELog.warning( "[AppEng] AE prevented crash while drawing slot: " + err.toString() );
|
||||
}
|
||||
}
|
||||
// do the usual for non-ME Slots.
|
||||
safeDrawSlot( s );
|
||||
}
|
||||
|
||||
private boolean isPowered() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package appeng.client.gui;
|
||||
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
public class GuiNull extends AEBaseGui
|
||||
{
|
||||
|
||||
public GuiNull(Container container) {
|
||||
super( container );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.implementations.ContainerChest;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.tile.storage.TileChest;
|
||||
|
||||
public class GuiChest extends AEBaseGui
|
||||
{
|
||||
|
||||
public GuiChest(InventoryPlayer inventoryPlayer, TileChest te) {
|
||||
super( new ContainerChest( inventoryPlayer, te ) );
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/chest.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRenderer.drawString( GuiText.Chest.getLocal(), 8, 6, 4210752 );
|
||||
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiProgressBar;
|
||||
import appeng.client.gui.widgets.GuiProgressBar.Direction;
|
||||
import appeng.container.implementations.ContainerCondenser;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.packets.PacketConfigButton;
|
||||
import appeng.tile.misc.TileCondenser;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
public class GuiCondenser extends AEBaseGui
|
||||
{
|
||||
|
||||
ContainerCondenser cvc;
|
||||
GuiProgressBar pb;
|
||||
GuiImgButton mode;
|
||||
|
||||
public GuiCondenser(InventoryPlayer inventoryPlayer, TileCondenser te) {
|
||||
super( new ContainerCondenser( inventoryPlayer, te ) );
|
||||
cvc = (ContainerCondenser) inventorySlots;
|
||||
this.ySize = 197;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
super.actionPerformed( btn );
|
||||
|
||||
if ( mode == btn )
|
||||
{
|
||||
try
|
||||
{
|
||||
PacketDispatcher.sendPacketToServer( (new PacketConfigButton( Settings.CONDENSER_OUTPUT )).getPacket() );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
pb = new GuiProgressBar( "guis/condenser.png", 120 + guiLeft, 25 + guiTop, 178, 25, 6, 18, Direction.VERTICAL );
|
||||
pb.TitleName = GuiText.StoredEnergy.getLocal();
|
||||
|
||||
mode = new GuiImgButton( 128 + guiLeft, 52 + guiTop, Settings.CONDENSER_OUTPUT, cvc.output );
|
||||
|
||||
this.buttonList.add( pb );
|
||||
this.buttonList.add( mode );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/condenser.png" );
|
||||
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRenderer.drawString( GuiText.Condenser.getLocal(), 8, 6, 4210752 );
|
||||
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
|
||||
mode.set( cvc.output );
|
||||
pb.max = cvc.requiredEnergy;
|
||||
pb.current = cvc.storedPower;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.implementations.ContainerDrive;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.tile.storage.TileDrive;
|
||||
|
||||
public class GuiDrive extends AEBaseGui
|
||||
{
|
||||
|
||||
public GuiDrive(InventoryPlayer inventoryPlayer, TileDrive te) {
|
||||
super( new ContainerDrive( inventoryPlayer, te ) );
|
||||
this.ySize = 199;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/drive.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRenderer.drawString( GuiText.Drive.getLocal(), 8, 6, 4210752 );
|
||||
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.implementations.ContainerGrinder;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.tile.grindstone.TileGrinder;
|
||||
|
||||
public class GuiGrinder extends AEBaseGui
|
||||
{
|
||||
|
||||
public GuiGrinder(InventoryPlayer inventoryPlayer, TileGrinder te) {
|
||||
super( new ContainerGrinder( inventoryPlayer, te ) );
|
||||
this.ySize = 176;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/grinder.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRenderer.drawString( GuiText.GrindStone.getLocal(), 8, 6, 4210752 );
|
||||
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.implementations.ContainerLevelEmitter;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.parts.automation.PartLevelEmitter;
|
||||
|
||||
public class GuiLevelEmitter extends AEBaseGui
|
||||
{
|
||||
|
||||
public GuiLevelEmitter(InventoryPlayer inventoryPlayer, PartLevelEmitter te) {
|
||||
super( new ContainerLevelEmitter( inventoryPlayer, te ) );
|
||||
this.ySize = 199;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/lvlemitter.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRenderer.drawString( GuiText.LevelEmitter.getLocal(), 8, 6, 4210752 );
|
||||
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,162 @@
|
|||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.implementations.IMEChest;
|
||||
import appeng.api.implementations.IStorageMonitorable;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.AEBaseMEGui;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.client.me.InternalSlotME;
|
||||
import appeng.client.me.ItemRepo;
|
||||
import appeng.container.implementations.ContainerMEMonitorable;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.core.Configuration;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.parts.reporting.PartTerminal;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class GuiMEMonitorable extends AEBaseMEGui
|
||||
{
|
||||
|
||||
GuiTextField searchField;
|
||||
ItemRepo repo;
|
||||
|
||||
GuiText myName;
|
||||
int rows = 0;
|
||||
|
||||
public GuiMEMonitorable(InventoryPlayer inventoryPlayer, IStorageMonitorable te) {
|
||||
super( new ContainerMEMonitorable( inventoryPlayer, null ) );
|
||||
myScrollBar = new GuiScrollbar();
|
||||
repo = new ItemRepo( myScrollBar );
|
||||
xSize = 195;
|
||||
ySize = 204;
|
||||
|
||||
if ( te instanceof IMEChest )
|
||||
myName = GuiText.Chest;
|
||||
else if ( te instanceof PartTerminal )
|
||||
myName = GuiText.Terminal;
|
||||
|
||||
}
|
||||
|
||||
public void postUpdate(List<IAEItemStack> list)
|
||||
{
|
||||
for (IAEItemStack is : list)
|
||||
repo.postUpdate( is );
|
||||
|
||||
repo.updateView();
|
||||
setScrollBar();
|
||||
}
|
||||
|
||||
private void setScrollBar()
|
||||
{
|
||||
myScrollBar.setTop( 18 ).setLeft( 175 ).setHeight( rows * 18 - 2 );
|
||||
myScrollBar.setRange( 0, (repo.size() + 8) / 9 - rows, Math.max( 1, rows / 6 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
int NEI = 0;
|
||||
int top = 4;
|
||||
int extraSpace = height - 114 - NEI - top;
|
||||
rows = (int) Math.floor( extraSpace / 18 );
|
||||
|
||||
meSlots.clear();
|
||||
for (int y = 0; y < rows; y++)
|
||||
{
|
||||
for (int x = 0; x < 9; x++)
|
||||
{
|
||||
meSlots.add( new InternalSlotME( repo, x + y * 9, 9 + x * 18, 18 + y * 18 ) );
|
||||
}
|
||||
}
|
||||
|
||||
super.initGui();
|
||||
// full size : 204
|
||||
// extra slots : 72
|
||||
// slot 18
|
||||
|
||||
this.ySize = 114 + rows * 18;
|
||||
this.guiTop = top;
|
||||
|
||||
buttonList.add( new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.SORT_BY, Configuration.instance.settings.getSetting( Settings.SORT_BY ) ) );
|
||||
buttonList.add( new GuiImgButton( this.guiLeft - 18, guiTop + 28, Settings.SORT_DIRECTION, Configuration.instance.settings
|
||||
.getSetting( Settings.SORT_DIRECTION ) ) );
|
||||
|
||||
searchField = new GuiTextField( this.fontRenderer, this.guiLeft + 82, this.guiTop + 6, 89, this.fontRenderer.FONT_HEIGHT );
|
||||
searchField.setEnableBackgroundDrawing( false );
|
||||
searchField.setMaxStringLength( 25 );
|
||||
searchField.setTextColor( 0xFFFFFF );
|
||||
searchField.setVisible( true );
|
||||
searchField.setFocused( true );
|
||||
|
||||
setScrollBar();
|
||||
|
||||
for (Object s : inventorySlots.inventorySlots)
|
||||
{
|
||||
if ( s instanceof AppEngSlot )
|
||||
{
|
||||
((AppEngSlot) s).yDisplayPosition = ((AppEngSlot) s).defY + ySize - 78 - guiTop;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn)
|
||||
{
|
||||
if ( btn instanceof GuiImgButton )
|
||||
{
|
||||
GuiImgButton iBtn = (GuiImgButton) btn;
|
||||
Enum cv = iBtn.getCurrentValue();
|
||||
|
||||
Enum next = Platform.nextEnum( cv );
|
||||
Configuration.instance.settings.putSetting( iBtn.getSetting(), next );
|
||||
iBtn.set( next );
|
||||
repo.updateView();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char character, int key)
|
||||
{
|
||||
if ( !this.checkHotbarKeys( key ) )
|
||||
{
|
||||
if ( searchField.textboxKeyTyped( character, key ) )
|
||||
{
|
||||
repo.searchString = this.searchField.getText();
|
||||
repo.updateView();
|
||||
}
|
||||
else
|
||||
{
|
||||
super.keyTyped( character, key );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/terminal.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, 18 );
|
||||
|
||||
for (int x = 0; x < rows; x++)
|
||||
this.drawTexturedModalRect( offsetX, offsetY + 18 + x * 18, 0, 18, xSize, 18 );
|
||||
|
||||
this.drawTexturedModalRect( offsetX, offsetY + 16 + rows * 18, 0, 106, xSize, 98 );
|
||||
|
||||
searchField.drawTextBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRenderer.drawString( myName.getLocal(), 8, 6, 4210752 );
|
||||
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.implementations.ContainerNetworkStatus;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiNetworkStatus extends AEBaseGui
|
||||
{
|
||||
|
||||
public GuiNetworkStatus(InventoryPlayer inventoryPlayer, TileEntity te) {
|
||||
super( new ContainerNetworkStatus( inventoryPlayer, (TileEntity) te ) );
|
||||
this.ySize = 199;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/networkstatus.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRenderer.drawString( GuiText.NetworkStatus.getLocal(), 8, 6, 4210752 );
|
||||
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.implementations.ContainerSpatialIOPort;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.tile.spatial.TileSpatialIOPort;
|
||||
|
||||
public class GuiSpatialIOPort extends AEBaseGui
|
||||
{
|
||||
|
||||
public GuiSpatialIOPort(InventoryPlayer inventoryPlayer, TileSpatialIOPort te) {
|
||||
super( new ContainerSpatialIOPort( inventoryPlayer, te ) );
|
||||
this.ySize = 199;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/spatialio.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRenderer.drawString( GuiText.SpatialIOPort.getLocal(), 8, 6, 4210752 );
|
||||
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiProgressBar;
|
||||
import appeng.client.gui.widgets.GuiProgressBar.Direction;
|
||||
import appeng.container.implementations.ContainerVibrationChamber;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.tile.misc.TileVibrationChamber;
|
||||
|
||||
public class GuiVibrationChamber extends AEBaseGui
|
||||
{
|
||||
|
||||
ContainerVibrationChamber cvc;
|
||||
GuiProgressBar pb;
|
||||
|
||||
public GuiVibrationChamber(InventoryPlayer inventoryPlayer, TileVibrationChamber te) {
|
||||
super( new ContainerVibrationChamber( inventoryPlayer, te ) );
|
||||
cvc = (ContainerVibrationChamber) inventorySlots;
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
pb = new GuiProgressBar( "guis/vibchamber.png", 99, 36, 176, 14, 6, 18, Direction.VERTICAL );
|
||||
this.buttonList.add( pb );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/vibchamber.png" );
|
||||
pb.xPosition = 99 + guiLeft;
|
||||
pb.yPosition = 36 + guiTop;
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRenderer.drawString( GuiText.VibrationChamber.getLocal(), 8, 6, 4210752 );
|
||||
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
|
||||
int k = 25;
|
||||
int l = -15;
|
||||
|
||||
pb.max = 200;
|
||||
pb.current = cvc.burnProgress > 0 ? cvc.burnSpeed : 0;
|
||||
pb.FullMsg = (cvc.aePerTick * pb.current / 100) + " ae/t";
|
||||
|
||||
if ( cvc.burnProgress > 0 )
|
||||
{
|
||||
int i1 = cvc.burnProgress;
|
||||
bindTexture( "guis/vibchamber.png" );
|
||||
GL11.glColor3f( 1, 1, 1 );
|
||||
this.drawTexturedModalRect( k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,321 @@
|
|||
package appeng.client.gui.widgets;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.CondenserOuput;
|
||||
import appeng.api.config.FullnessMode;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.IncludeExclude;
|
||||
import appeng.api.config.MatchingMode;
|
||||
import appeng.api.config.OperationMode;
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.RelativeDirection;
|
||||
import appeng.api.config.SearchBoxMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortDir;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
|
||||
public class GuiImgButton extends GuiButton implements ITooltip
|
||||
{
|
||||
|
||||
class EnumPair
|
||||
{
|
||||
|
||||
Enum setting;
|
||||
Enum value;
|
||||
|
||||
EnumPair(Enum a, Enum b) {
|
||||
setting = a;
|
||||
value = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return setting.hashCode() ^ value.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
EnumPair d = (EnumPair) obj;
|
||||
return d.setting.equals( setting ) && d.value.equals( value );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class BtnAppearance
|
||||
{
|
||||
|
||||
public int index;
|
||||
public String DisplayName;
|
||||
public String DisplayValue;
|
||||
};
|
||||
|
||||
public boolean halfSize = false;
|
||||
public String FillVar;
|
||||
|
||||
private final Enum buttonSetting;
|
||||
private Enum currentValue;
|
||||
|
||||
static private Map<EnumPair, BtnAppearance> Appearances;
|
||||
|
||||
private void registerApp(int icon, Settings setting, Enum val, String dn, String dv)
|
||||
{
|
||||
BtnAppearance a = new BtnAppearance();
|
||||
a.DisplayName = dn;
|
||||
a.DisplayValue = dv;
|
||||
a.index = icon;
|
||||
Appearances.put( new EnumPair( setting, val ), a );
|
||||
}
|
||||
|
||||
public GuiImgButton(int x, int y, Enum idx, Enum val) {
|
||||
super( 0, 0, 16, "" );
|
||||
buttonSetting = idx;
|
||||
currentValue = val;
|
||||
xPosition = x;
|
||||
yPosition = y;
|
||||
width = 16;
|
||||
height = 16;
|
||||
|
||||
if ( Appearances == null )
|
||||
{
|
||||
Appearances = new HashMap();
|
||||
registerApp( 16 * 7 + 0, Settings.CONDENSER_OUTPUT, CondenserOuput.TRASH, "AppEng.GuiITooltip.CondenserOutput", "AppEng.GuiITooltip.Trash" );
|
||||
registerApp( 16 * 7 + 1, Settings.CONDENSER_OUTPUT, CondenserOuput.MATTER_BALLS, "AppEng.GuiITooltip.CondenserOutput",
|
||||
"AppEng.GuiITooltip.MatterBalls" );
|
||||
registerApp( 16 * 7 + 2, Settings.CONDENSER_OUTPUT, CondenserOuput.SINGULARITY, "AppEng.GuiITooltip.CondenserOutput",
|
||||
"AppEng.GuiITooltip.Singularity" );
|
||||
|
||||
registerApp( 16 * 9 + 1, Settings.ACCESS, AccessRestriction.READ, "AppEng.GuiITooltip.IOMode", "AppEng.GuiITooltip.Read" );
|
||||
registerApp( 16 * 9 + 0, Settings.ACCESS, AccessRestriction.WRITE, "AppEng.GuiITooltip.IOMode", "AppEng.GuiITooltip.Write" );
|
||||
registerApp( 16 * 9 + 2, Settings.ACCESS, AccessRestriction.READ_WRITE, "AppEng.GuiITooltip.IOMode", "AppEng.GuiITooltip.ReadWrite" );
|
||||
|
||||
registerApp( 16 * 10 + 0, Settings.POWER_UNITS, PowerUnits.AE, "AppEng.GuiITooltip.PowerUnits", "AppEng.GuiITooltip.AEUnits" );
|
||||
registerApp( 16 * 10 + 1, Settings.POWER_UNITS, PowerUnits.EU, "AppEng.GuiITooltip.PowerUnits", "AppEng.GuiITooltip.EUUnits" );
|
||||
registerApp( 16 * 10 + 2, Settings.POWER_UNITS, PowerUnits.MJ, "AppEng.GuiITooltip.PowerUnits", "AppEng.GuiITooltip.MJUnits" );
|
||||
registerApp( 16 * 10 + 3, Settings.POWER_UNITS, PowerUnits.KJ, "AppEng.GuiITooltip.PowerUnits", "AppEng.GuiITooltip.UEUnits" );
|
||||
registerApp( 16 * 10 + 4, Settings.POWER_UNITS, PowerUnits.WA, "AppEng.GuiITooltip.PowerUnits", "AppEng.GuiITooltip.WUnits" );
|
||||
|
||||
registerApp( 3, Settings.REDSTONE_INPUT, RedstoneMode.IGNORE, "AppEng.GuiITooltip.RedstoneMode", "AppEng.GuiITooltip.AlwaysActive" );
|
||||
registerApp( 0, Settings.REDSTONE_INPUT, RedstoneMode.LOW_SIGNAL, "AppEng.GuiITooltip.RedstoneMode", "AppEng.GuiITooltip.ActiveWithoutSignal" );
|
||||
registerApp( 1, Settings.REDSTONE_INPUT, RedstoneMode.HIGH_SIGNAL, "AppEng.GuiITooltip.RedstoneMode", "AppEng.GuiITooltip.ActiveWithSignal" );
|
||||
registerApp( 2, Settings.REDSTONE_INPUT, RedstoneMode.SIGNAL_PULSE, "AppEng.GuiITooltip.RedstoneMode", "AppEng.GuiITooltip.ActiveOnPulse" );
|
||||
|
||||
registerApp( 3, Settings.REDSTONE_INPUT, RedstoneMode.IGNORE, "AppEng.GuiITooltip.RedstoneMode", "AppEng.GuiITooltip.AlwaysActive" );
|
||||
registerApp( 0, Settings.REDSTONE_INPUT, RedstoneMode.LOW_SIGNAL, "AppEng.GuiITooltip.RedstoneMode", "AppEng.GuiITooltip.ActiveWithoutSignal" );
|
||||
registerApp( 1, Settings.REDSTONE_INPUT, RedstoneMode.HIGH_SIGNAL, "AppEng.GuiITooltip.RedstoneMode", "AppEng.GuiITooltip.ActiveWithSignal" );
|
||||
|
||||
registerApp( 0, Settings.REDSTONE_OUTPUT, RedstoneMode.LOW_SIGNAL, "AppEng.GuiITooltip.RedstoneMode", "AppEng.GuiITooltip.EmitLevelsBelow" );
|
||||
registerApp( 1, Settings.REDSTONE_OUTPUT, RedstoneMode.HIGH_SIGNAL, "AppEng.GuiITooltip.RedstoneMode", "AppEng.GuiITooltip.EmitLevelAbove" );
|
||||
|
||||
registerApp( 16 * 8 + 2, Settings.INCLUSION, IncludeExclude.WHITELIST, "AppEng.Gui.Whitelisted", "AppEng.Gui.WhitelistedDesc" );
|
||||
registerApp( 16 * 8 + 3, Settings.INCLUSION, IncludeExclude.BLACKLIST, "AppEng.Gui.Blacklisted", "AppEng.Gui.BlacklistedDesc" );
|
||||
|
||||
registerApp( 34, Settings.COMPARISON, MatchingMode.FUZZY, "AppEng.GuiITooltip.MatchingMode", "AppEng.GuiITooltip.MatchingFuzzy" );
|
||||
registerApp( 32, Settings.COMPARISON, MatchingMode.PRECISE, "AppEng.GuiITooltip.MatchingMode", "AppEng.GuiITooltip.MatchingExact" );
|
||||
|
||||
registerApp( 50, Settings.OPERATION_MODE, OperationMode.EMPTY, "AppEng.GuiITooltip.TransferDirection", "AppEng.GuiITooltip.TransferToNetwork" );
|
||||
registerApp( 51, Settings.OPERATION_MODE, OperationMode.FILL, "AppEng.GuiITooltip.TransferDirection", "AppEng.GuiITooltip.TransferToStorageCell" );
|
||||
|
||||
registerApp( 51, Settings.IO_DIRECTION, RelativeDirection.LEFT, "AppEng.GuiITooltip.TransferDirection", "AppEng.GuiITooltip.TransferToStorageCell" );
|
||||
registerApp( 50, Settings.IO_DIRECTION, RelativeDirection.RIGHT, "AppEng.GuiITooltip.TransferDirection", "AppEng.GuiITooltip.TransferToNetwork" );
|
||||
|
||||
registerApp( 48, Settings.SORT_DIRECTION, SortDir.ASCENDING, "AppEng.GuiITooltip.SortOrder", "AppEng.GuiITooltip.ToggleSortDirection" );
|
||||
registerApp( 49, Settings.SORT_DIRECTION, SortDir.DESCENDING, "AppEng.GuiITooltip.SortOrder", "AppEng.GuiITooltip.ToggleSortDirection" );
|
||||
|
||||
registerApp( 16 * 2 + 3, Settings.SEARCH_MODE, SearchBoxMode.AUTOSEARCH, "AppEng.GuiITooltip.SearchMode", "AppEng.GuiITooltip.SearchMode_Auto" );
|
||||
registerApp( 16 * 2 + 4, Settings.SEARCH_MODE, SearchBoxMode.MANUAL_SEARCH, "AppEng.GuiITooltip.SearchMode",
|
||||
"AppEng.GuiITooltip.SearchMode_Standard" );
|
||||
registerApp( 16 * 2 + 5, Settings.SEARCH_MODE, SearchBoxMode.NEI_AUTOSEARCH, "AppEng.GuiITooltip.SearchMode",
|
||||
"AppEng.GuiITooltip.SearchMode_NEIAuto" );
|
||||
registerApp( 16 * 2 + 6, Settings.SEARCH_MODE, SearchBoxMode.NEI_MANUAL_SEARCH, "AppEng.GuiITooltip.SearchMode",
|
||||
"AppEng.GuiITooltip.SearchMode_NEIStandard" );
|
||||
|
||||
registerApp( 64, Settings.SORT_BY, SortOrder.NAME, "AppEng.GuiITooltip.SortBy", "AppEng.GuiITooltip.ItemName" );
|
||||
registerApp( 65, Settings.SORT_BY, SortOrder.AMOUNT, "AppEng.GuiITooltip.SortBy", "AppEng.GuiITooltip.NumberOfItems" );
|
||||
// registerApp( 66, Settings.SORT_BY, SortOrder.PRIORITY, "AppEng.GuiITooltip.SortBy",
|
||||
// "AppEng.GuiITooltip.PriorityCellOrder" );
|
||||
registerApp( 68, Settings.SORT_BY, SortOrder.MOD, "AppEng.GuiITooltip.SortBy", "AppEng.GuiITooltip.ItemID" );
|
||||
|
||||
registerApp( 66, Settings.ACTIONS, ActionItems.WRENCH, "AppEng.GuiITooltip.PartitionStorage", "AppEng.GuiITooltip.PartitionStorageHint" );
|
||||
registerApp( 6, Settings.ACTIONS, ActionItems.CLOSE, "AppEng.Gui.Clear", "AppEng.GuiITooltip.ClearCraftingGrid" );
|
||||
|
||||
registerApp( 16, Settings.VIEW_MODE, ViewItems.STORED, "AppEng.GuiITooltip.View", "AppEng.GuiITooltip.StoredItems" );
|
||||
registerApp( 18, Settings.VIEW_MODE, ViewItems.ALL, "AppEng.GuiITooltip.View", "AppEng.GuiITooltip.StoredCraftable" );
|
||||
registerApp( 19, Settings.VIEW_MODE, ViewItems.CRAFTABLE, "AppEng.GuiITooltip.View", "AppEng.GuiITooltip.Craftable" );
|
||||
|
||||
registerApp( 16 * 6 + 0, Settings.FUZZY_MODE, FuzzyMode.PERCENT_25, "AppEng.GuiITooltip.FuzzyMode", "AppEng.GuiITooltip.FuzzyMode.Percent_25" );
|
||||
registerApp( 16 * 6 + 1, Settings.FUZZY_MODE, FuzzyMode.PERCENT_50, "AppEng.GuiITooltip.FuzzyMode", "AppEng.GuiITooltip.FuzzyMode.Percent_50" );
|
||||
registerApp( 16 * 6 + 2, Settings.FUZZY_MODE, FuzzyMode.PERCENT_75, "AppEng.GuiITooltip.FuzzyMode", "AppEng.GuiITooltip.FuzzyMode.Percent_75" );
|
||||
registerApp( 16 * 6 + 3, Settings.FUZZY_MODE, FuzzyMode.PERCENT_99, "AppEng.GuiITooltip.FuzzyMode", "AppEng.GuiITooltip.FuzzyMode.Percent_99" );
|
||||
registerApp( 16 * 6 + 4, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL, "AppEng.GuiITooltip.FuzzyMode", "AppEng.GuiITooltip.FuzzyMode.IgnoreAll" );
|
||||
|
||||
registerApp( 80, Settings.FULLNESS_MODE, FullnessMode.EMPTY, "AppEng.GuiITooltip.OperationMode", "AppEng.GuiITooltip.MoveWhenEmpty" );
|
||||
registerApp( 81, Settings.FULLNESS_MODE, FullnessMode.HALF, "AppEng.GuiITooltip.OperationMode", "AppEng.GuiITooltip.MoveWhenWorkIsDone" );
|
||||
registerApp( 82, Settings.FULLNESS_MODE, FullnessMode.FULL, "AppEng.GuiITooltip.OperationMode", "AppEng.GuiITooltip.MoveWhenFull" );
|
||||
|
||||
registerApp( 16 * 8 + 0, Settings.TRASH_CATCH, YesNo.YES, "AppEng.GuiITooltip.TrashController", "AppEng.GuiITooltip.Disabled" );
|
||||
registerApp( 16 * 8 + 1, Settings.TRASH_CATCH, YesNo.NO, "AppEng.GuiITooltip.TrashController", "AppEng.GuiITooltip.Enable" );
|
||||
|
||||
registerApp( 16 * 1 + 5, Settings.BLOCK, YesNo.YES, "AppEng.GuiITooltip.InterfaceBlockingMode", "AppEng.GuiITooltip.Blocking" );
|
||||
registerApp( 16 * 1 + 4, Settings.BLOCK, YesNo.NO, "AppEng.GuiITooltip.InterfaceBlockingMode", "AppEng.GuiITooltip.NonBlocking" );
|
||||
|
||||
registerApp( 19, Settings.CRAFT, YesNo.YES, "AppEng.GuiITooltip.InterfaceCraftingMode", "AppEng.GuiITooltip.Craft" );
|
||||
registerApp( 17, Settings.CRAFT, YesNo.NO, "AppEng.GuiITooltip.InterfaceCraftingMode", "AppEng.GuiITooltip.DontCraft" );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3)
|
||||
{
|
||||
if ( this.drawButton )
|
||||
{
|
||||
int iconIndex = getIconIndex();
|
||||
|
||||
if ( halfSize )
|
||||
{
|
||||
width = 8;
|
||||
height = 8;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef( this.xPosition, this.yPosition, 0.0F );
|
||||
GL11.glScalef( 0.5f, 0.5f, 0.5f );
|
||||
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
par1Minecraft.renderEngine.bindTexture( ExtraTextures.GuiTexture( "guis/states.png" ) );
|
||||
this.field_82253_i = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width
|
||||
&& par3 < this.yPosition + this.height;
|
||||
|
||||
int uv_y = (int) Math.floor( iconIndex / 16 );
|
||||
int uv_x = iconIndex - uv_y * 16;
|
||||
|
||||
this.drawTexturedModalRect( 0, 0, 256 - 16, 256 - 16, 16, 16 );
|
||||
this.drawTexturedModalRect( 0, 0, uv_x * 16, uv_y * 16, 16, 16 );
|
||||
this.mouseDragged( par1Minecraft, par2, par3 );
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
par1Minecraft.renderEngine.bindTexture( ExtraTextures.GuiTexture( "guis/states.png" ) );
|
||||
this.field_82253_i = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width
|
||||
&& par3 < this.yPosition + this.height;
|
||||
|
||||
int uv_y = (int) Math.floor( iconIndex / 16 );
|
||||
int uv_x = iconIndex - uv_y * 16;
|
||||
|
||||
this.drawTexturedModalRect( this.xPosition, this.yPosition, 256 - 16, 256 - 16, 16, 16 );
|
||||
this.drawTexturedModalRect( this.xPosition, this.yPosition, uv_x * 16, uv_y * 16, 16, 16 );
|
||||
this.mouseDragged( par1Minecraft, par2, par3 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int getIconIndex()
|
||||
{
|
||||
if ( buttonSetting != null && currentValue != null )
|
||||
{
|
||||
return Appearances.get( new EnumPair( buttonSetting, currentValue ) ).index;
|
||||
}
|
||||
return 256 - 1;
|
||||
}
|
||||
|
||||
public Enum getSetting()
|
||||
{
|
||||
return buttonSetting;
|
||||
}
|
||||
|
||||
public Enum getCurrentValue()
|
||||
{
|
||||
return currentValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMsg()
|
||||
{
|
||||
String DisplayName = null;
|
||||
String DisplayValue = null;
|
||||
|
||||
if ( buttonSetting != null && currentValue != null )
|
||||
{
|
||||
BtnAppearance ba = Appearances.get( new EnumPair( buttonSetting, currentValue ) );
|
||||
DisplayName = ba.DisplayName;
|
||||
DisplayValue = ba.DisplayValue;
|
||||
}
|
||||
|
||||
if ( DisplayName != null )
|
||||
{
|
||||
String Name = StatCollector.translateToLocal( DisplayName );
|
||||
String Value = StatCollector.translateToLocal( DisplayValue );
|
||||
|
||||
if ( Name == null || Name.equals( "" ) )
|
||||
Name = DisplayName;
|
||||
if ( Value == null || Value.equals( "" ) )
|
||||
Value = DisplayValue;
|
||||
|
||||
if ( FillVar != null )
|
||||
Value = Value.replaceFirst( "%s", FillVar );
|
||||
|
||||
StringBuilder sb = new StringBuilder( Value );
|
||||
|
||||
int i = sb.lastIndexOf( "\n" );
|
||||
if ( i <= 0 )
|
||||
i = 0;
|
||||
while (i + 30 < sb.length() && (i = sb.lastIndexOf( " ", i + 30 )) != -1)
|
||||
{
|
||||
sb.replace( i, i + 1, "\n" );
|
||||
}
|
||||
|
||||
return Name + "\n" + sb.toString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int xPos()
|
||||
{
|
||||
return xPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int yPos()
|
||||
{
|
||||
return yPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth()
|
||||
{
|
||||
return halfSize ? 8 : 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight()
|
||||
{
|
||||
return halfSize ? 8 : 16;
|
||||
}
|
||||
|
||||
public void set(Enum e)
|
||||
{
|
||||
if ( currentValue != e )
|
||||
{
|
||||
currentValue = e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
package appeng.client.gui.widgets;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiProgressBar extends GuiButton implements ITooltip
|
||||
{
|
||||
|
||||
public enum Direction
|
||||
{
|
||||
HORIZONTAL, VERTICAL
|
||||
};
|
||||
|
||||
private ResourceLocation texture;
|
||||
private int fill_u;
|
||||
private int fill_v;
|
||||
private int width;
|
||||
private int height;
|
||||
private Direction layout;
|
||||
|
||||
public String FullMsg;
|
||||
|
||||
public String TitleName;
|
||||
public int current;
|
||||
public int max;
|
||||
|
||||
public GuiProgressBar(String string, int posX, int posY, int u, int y, int _width, int _height, Direction dir) {
|
||||
super( posX, posY, _width, "" );
|
||||
texture = new ResourceLocation( "appliedenergistics2", "textures/" + string );
|
||||
width = _width;
|
||||
height = _height;
|
||||
fill_u = u;
|
||||
fill_v = y;
|
||||
current = 0;
|
||||
max = 100;
|
||||
layout = dir;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3)
|
||||
{
|
||||
if ( this.drawButton )
|
||||
{
|
||||
par1Minecraft.getTextureManager().bindTexture( texture );
|
||||
|
||||
if ( layout == Direction.VERTICAL )
|
||||
{
|
||||
int diff = height - (max > 0 ? (height * current) / max : 0);
|
||||
this.drawTexturedModalRect( this.xPosition, this.yPosition + diff, fill_u, fill_v + diff, width, height - diff );
|
||||
}
|
||||
else
|
||||
{
|
||||
int diff = width - (max > 0 ? (width * current) / max : 0);
|
||||
this.drawTexturedModalRect( this.xPosition, this.yPosition, fill_u + diff, fill_v, width - diff, height );
|
||||
}
|
||||
|
||||
this.mouseDragged( par1Minecraft, par2, par3 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMsg()
|
||||
{
|
||||
if ( FullMsg != null )
|
||||
return FullMsg;
|
||||
|
||||
return (TitleName != null ? TitleName : "") + "\n" + current + " " + GuiText.Of.getLocal() + " " + max;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int xPos()
|
||||
{
|
||||
return xPosition - 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int yPos()
|
||||
{
|
||||
return yPosition - 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth()
|
||||
{
|
||||
return width + 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight()
|
||||
{
|
||||
return height + 4;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
package appeng.client.gui.widgets;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
|
||||
public class GuiScrollbar implements IScrollSource
|
||||
{
|
||||
|
||||
private int displayX = 0;
|
||||
private int displayY = 0;
|
||||
private int width = 12;
|
||||
private int height = 16;
|
||||
private int pageSize = 1;
|
||||
|
||||
private int maxScroll = 0;
|
||||
private int minScroll = 0;
|
||||
private int currentScroll = 0;
|
||||
|
||||
private void applyRange()
|
||||
{
|
||||
currentScroll = Math.max( Math.min( currentScroll, maxScroll ), minScroll );
|
||||
}
|
||||
|
||||
public void draw(AEBaseGui g)
|
||||
{
|
||||
g.bindTexture( "minecraft", "gui/container/creative_inventory/tabs.png" );
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
|
||||
if ( getRange() == 0 )
|
||||
{
|
||||
g.drawTexturedModalRect( displayX, displayY, 232 + width, 0, width, 15 );
|
||||
}
|
||||
else
|
||||
{
|
||||
int offset = (currentScroll - minScroll) * (height - 15) / getRange();
|
||||
g.drawTexturedModalRect( displayX, offset + displayY, 232, 0, width, 15 );
|
||||
}
|
||||
}
|
||||
|
||||
public int getRange()
|
||||
{
|
||||
return maxScroll - minScroll;
|
||||
}
|
||||
|
||||
public int getLeft()
|
||||
{
|
||||
return displayX;
|
||||
}
|
||||
|
||||
public int getTop()
|
||||
{
|
||||
return displayY;
|
||||
}
|
||||
|
||||
public int getWidth()
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
public int getHeight()
|
||||
{
|
||||
return height;
|
||||
}
|
||||
|
||||
public GuiScrollbar setLeft(int v)
|
||||
{
|
||||
displayX = v;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GuiScrollbar setTop(int v)
|
||||
{
|
||||
displayY = v;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GuiScrollbar setWidth(int v)
|
||||
{
|
||||
width = v;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GuiScrollbar setHeight(int v)
|
||||
{
|
||||
height = v;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setRange(int min, int max, int pageSize)
|
||||
{
|
||||
minScroll = min;
|
||||
maxScroll = max;
|
||||
this.pageSize = pageSize;
|
||||
|
||||
if ( minScroll > maxScroll )
|
||||
maxScroll = minScroll;
|
||||
|
||||
applyRange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentScroll()
|
||||
{
|
||||
return currentScroll;
|
||||
}
|
||||
|
||||
public void click(AEBaseGui aeBaseGui, int x, int y)
|
||||
{
|
||||
if ( getRange() == 0 )
|
||||
return;
|
||||
|
||||
if ( x > displayX && x <= displayX + width )
|
||||
{
|
||||
if ( y > displayY && y <= displayY + height )
|
||||
{
|
||||
currentScroll = (y - displayY);
|
||||
currentScroll = minScroll + ((currentScroll * 2 * getRange() / height));
|
||||
currentScroll = (currentScroll + 1) >> 1;
|
||||
applyRange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void wheel(int delta)
|
||||
{
|
||||
delta = Math.max( Math.min( -delta, 1 ), -1 );
|
||||
currentScroll += delta * pageSize;
|
||||
applyRange();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package appeng.client.gui.widgets;
|
||||
|
||||
public interface IScrollSource
|
||||
{
|
||||
|
||||
int getCurrentScroll();
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package appeng.client.gui.widgets;
|
||||
|
||||
/**
|
||||
* AEBaseGui controlled Tooltip Interface.
|
||||
*
|
||||
*/
|
||||
public interface ITooltip
|
||||
{
|
||||
|
||||
/**
|
||||
* returns the tooltip message.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getMsg();
|
||||
|
||||
/**
|
||||
* x Location for the object that triggers the tooltip.
|
||||
*
|
||||
* @return xPosition
|
||||
*/
|
||||
int xPos();
|
||||
|
||||
/**
|
||||
* y Location for the object that triggers the tooltip.
|
||||
*
|
||||
* @return yPosition
|
||||
*/
|
||||
int yPos();
|
||||
|
||||
/**
|
||||
* Width of the object that triggers the tooltip.
|
||||
*
|
||||
* @return width
|
||||
*/
|
||||
int getWidth();
|
||||
|
||||
/**
|
||||
* Height for the object that triggers the tooltip.
|
||||
*
|
||||
* @return height
|
||||
*/
|
||||
int getHeight();
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package appeng.client.me;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
||||
public class InternalSlotME
|
||||
{
|
||||
|
||||
private final ItemRepo repo;
|
||||
|
||||
public int offset;
|
||||
public int xPos;
|
||||
public int yPos;
|
||||
|
||||
public InternalSlotME(ItemRepo def, int offset, int displayX, int displayY) {
|
||||
this.repo = def;
|
||||
this.offset = offset;
|
||||
this.xPos = displayX;
|
||||
this.yPos = displayY;
|
||||
}
|
||||
|
||||
public ItemStack getStack()
|
||||
{
|
||||
return repo.getItem( offset );
|
||||
}
|
||||
|
||||
public IAEItemStack getAEStack()
|
||||
{
|
||||
return repo.getRefrenceItem( offset );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,148 @@
|
|||
package appeng.client.me;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.widgets.IScrollSource;
|
||||
import appeng.core.Configuration;
|
||||
import appeng.util.ItemSorters;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.ItemList;
|
||||
|
||||
public class ItemRepo
|
||||
{
|
||||
|
||||
final private IItemList<IAEItemStack> list = new ItemList();
|
||||
final private ArrayList<IAEItemStack> view = new ArrayList();
|
||||
final private ArrayList<ItemStack> dsp = new ArrayList();
|
||||
final private IScrollSource src;
|
||||
|
||||
public int rowSize = 9;
|
||||
|
||||
public String searchString = "";
|
||||
|
||||
public ItemRepo(IScrollSource src) {
|
||||
this.src = src;
|
||||
}
|
||||
|
||||
public IAEItemStack getRefrenceItem(int idx)
|
||||
{
|
||||
idx += src.getCurrentScroll() * rowSize;
|
||||
|
||||
if ( idx >= view.size() )
|
||||
return null;
|
||||
return view.get( idx );
|
||||
}
|
||||
|
||||
public ItemStack getItem(int idx)
|
||||
{
|
||||
idx += src.getCurrentScroll() * rowSize;
|
||||
|
||||
if ( idx >= dsp.size() )
|
||||
return null;
|
||||
return dsp.get( idx );
|
||||
}
|
||||
|
||||
void setSearch(String search)
|
||||
{
|
||||
searchString = search == null ? "" : search;
|
||||
}
|
||||
|
||||
public void postUpdate(IAEItemStack is)
|
||||
{
|
||||
IAEItemStack st = list.findPrecise( is );
|
||||
|
||||
if ( st != null )
|
||||
{
|
||||
st.reset();
|
||||
st.add( is );
|
||||
}
|
||||
else
|
||||
list.add( is );
|
||||
}
|
||||
|
||||
public void updateView()
|
||||
{
|
||||
view.clear();
|
||||
dsp.clear();
|
||||
|
||||
view.ensureCapacity( list.size() );
|
||||
dsp.ensureCapacity( list.size() );
|
||||
|
||||
boolean terminalSearchToolTips = Configuration.instance.settings.getSetting( Settings.SEARCH_TOOLTIPS ) != YesNo.NO;
|
||||
// boolean terminalSearchMods = Configuration.instance.settings.getSetting( Settings.SEARCH_MODS ) != YesNo.NO;
|
||||
|
||||
Pattern m = null;
|
||||
try
|
||||
{
|
||||
m = Pattern.compile( searchString.toLowerCase(), Pattern.CASE_INSENSITIVE );
|
||||
}
|
||||
catch (Throwable _)
|
||||
{
|
||||
try
|
||||
{
|
||||
m = Pattern.compile( Pattern.quote( searchString.toLowerCase() ), Pattern.CASE_INSENSITIVE );
|
||||
}
|
||||
catch (Throwable __)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
boolean notDone = false;
|
||||
for (IAEItemStack is : list)
|
||||
{
|
||||
String dspName = Platform.getItemDisplayName( is );
|
||||
notDone = true;
|
||||
|
||||
if ( m.matcher( dspName.toLowerCase() ).find() )
|
||||
{
|
||||
view.add( is );
|
||||
notDone = false;
|
||||
}
|
||||
|
||||
if ( terminalSearchToolTips && notDone )
|
||||
{
|
||||
for (Object lp : Platform.getTooltip( is ))
|
||||
if ( lp instanceof String && m.matcher( (String) lp ).find() )
|
||||
{
|
||||
view.add( is );
|
||||
notDone = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* if ( terminalSearchMods && notDone ) { if ( m.matcher( Platform.getMod( is.getItemStack() ) ).find() ) {
|
||||
* view.add( is ); notDone = false; } }
|
||||
*/
|
||||
}
|
||||
|
||||
Enum SortBy = Configuration.instance.settings.getSetting( Settings.SORT_BY );
|
||||
Enum SortDir = Configuration.instance.settings.getSetting( Settings.SORT_DIRECTION );
|
||||
|
||||
ItemSorters.Direction = (appeng.api.config.SortDir) SortDir;
|
||||
|
||||
if ( SortBy == SortOrder.AMOUNT )
|
||||
Collections.sort( view, ItemSorters.ConfigBased_SortBySize );
|
||||
else if ( SortBy == SortOrder.MOD )
|
||||
Collections.sort( view, ItemSorters.ConfigBased_SortByMod );
|
||||
else
|
||||
Collections.sort( view, ItemSorters.ConfigBased_SortByName );
|
||||
|
||||
for (IAEItemStack is : view)
|
||||
dsp.add( is.getItemStack() );
|
||||
}
|
||||
|
||||
public int size()
|
||||
{
|
||||
return view.size();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package appeng.client.me;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
|
||||
public class SlotME extends Slot
|
||||
{
|
||||
|
||||
public InternalSlotME mySlot;
|
||||
|
||||
public SlotME(InternalSlotME me) {
|
||||
super( null, 0, me.xPos, me.yPos );
|
||||
mySlot = me;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack()
|
||||
{
|
||||
return mySlot.getStack();
|
||||
}
|
||||
|
||||
public IAEItemStack getAEStack()
|
||||
{
|
||||
return mySlot.getAEStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int par1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStack(ItemStack par1ItemStack)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasStack()
|
||||
{
|
||||
return getStack() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotInInventory(IInventory par1iInventory, int par2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
package appeng.client.render;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.Configuration;
|
||||
|
||||
public class AppEngRenderItem extends RenderItem
|
||||
{
|
||||
|
||||
public IAEItemStack aestack;
|
||||
|
||||
private void renderQuad(Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
par1Tessellator.startDrawingQuads();
|
||||
par1Tessellator.setColorOpaque_I( par6 );
|
||||
par1Tessellator.addVertex( par2 + 0, par3 + 0, 0.0D );
|
||||
par1Tessellator.addVertex( par2 + 0, par3 + par5, 0.0D );
|
||||
par1Tessellator.addVertex( par2 + par4, par3 + par5, 0.0D );
|
||||
par1Tessellator.addVertex( par2 + par4, par3 + 0, 0.0D );
|
||||
par1Tessellator.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItemOverlayIntoGUI(FontRenderer par1FontRenderer, TextureManager par2RenderEngine, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
this.renderItemOverlayIntoGUI( par1FontRenderer, par2RenderEngine, par3ItemStack, par4, par5, (String) null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItemOverlayIntoGUI(FontRenderer par1FontRenderer, TextureManager par2RenderEngine, ItemStack is, int par4, int par5, String par6Str)
|
||||
{
|
||||
if ( is != null )
|
||||
{
|
||||
float ScaleFactor = Configuration.instance.useTerminalUseLargeFont() ? 0.85f : 0.5f;
|
||||
float RScaleFactor = 1.0f / ScaleFactor;
|
||||
int offset = Configuration.instance.useTerminalUseLargeFont() ? 0 : -1;
|
||||
|
||||
if ( is.isItemDamaged() )
|
||||
{
|
||||
int k = (int) Math.round( 13.0D - is.getItemDamageForDisplay() * 13.0D / is.getMaxDamage() );
|
||||
int l = (int) Math.round( 255.0D - is.getItemDamageForDisplay() * 255.0D / is.getMaxDamage() );
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
GL11.glDisable( GL11.GL_DEPTH_TEST );
|
||||
GL11.glDisable( GL11.GL_TEXTURE_2D );
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
int i1 = 255 - l << 16 | l << 8;
|
||||
int j1 = (255 - l) / 4 << 16 | 16128;
|
||||
this.renderQuad( tessellator, par4 + 2, par5 + 13, 13, 2, 0 );
|
||||
this.renderQuad( tessellator, par4 + 2, par5 + 13, 12, 1, j1 );
|
||||
this.renderQuad( tessellator, par4 + 2, par5 + 13, k, 1, i1 );
|
||||
GL11.glEnable( GL11.GL_TEXTURE_2D );
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
GL11.glEnable( GL11.GL_DEPTH_TEST );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
}
|
||||
|
||||
if ( is.stackSize == 0 )
|
||||
{
|
||||
String var6 = Configuration.instance.useTerminalUseLargeFont() ? "+" : "Craft";
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
GL11.glDisable( GL11.GL_DEPTH_TEST );
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled( ScaleFactor, ScaleFactor, ScaleFactor );
|
||||
int X = (int) (((float) par4 + offset + 16.0f - par1FontRenderer.getStringWidth( var6 ) * ScaleFactor) * RScaleFactor);
|
||||
int Y = (int) (((float) par5 + offset + 16.0f - 7.0f * ScaleFactor) * RScaleFactor);
|
||||
par1FontRenderer.drawStringWithShadow( var6, X, Y, 16777215 );
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
GL11.glEnable( GL11.GL_DEPTH_TEST );
|
||||
}
|
||||
|
||||
long amount = aestack != null ? aestack.getStackSize() : is.stackSize;
|
||||
if ( amount > 999999999999L )
|
||||
amount = 999999999999L;
|
||||
|
||||
if ( amount != 0 )
|
||||
{
|
||||
String var6 = "" + Math.abs( amount );
|
||||
|
||||
if ( Configuration.instance.useTerminalUseLargeFont() )
|
||||
{
|
||||
if ( amount > 999999999 )
|
||||
{
|
||||
var6 = "" + (int) Math.floor( amount / 1000000000.0 ) + "B";
|
||||
}
|
||||
else if ( amount > 99999999 )
|
||||
{
|
||||
var6 = "." + (int) Math.floor( amount / 100000000.0 ) + "B";
|
||||
}
|
||||
else if ( amount > 999999 )
|
||||
{
|
||||
var6 = "" + (int) Math.floor( amount / 1000000.0 ) + "M";
|
||||
}
|
||||
else if ( amount > 99999 )
|
||||
{
|
||||
var6 = "." + (int) Math.floor( amount / 100000.0 ) + "M";
|
||||
}
|
||||
else if ( amount > 999 )
|
||||
{
|
||||
var6 = "" + (int) Math.floor( amount / 1000.0 ) + "K";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( amount > 999999999 )
|
||||
{
|
||||
var6 = "" + (int) Math.floor( amount / 1000000000.0 ) + "B";
|
||||
}
|
||||
else if ( amount > 999999999 )
|
||||
{
|
||||
var6 = "" + (int) Math.floor( amount / 1000000000.0 ) + "B";
|
||||
}
|
||||
else if ( amount > 999999 )
|
||||
{
|
||||
var6 = "" + (int) Math.floor( amount / 1000000.0 ) + "M";
|
||||
}
|
||||
else if ( amount > 9999 )
|
||||
{
|
||||
var6 = "" + (int) Math.floor( amount / 1000.0 ) + "K";
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
GL11.glDisable( GL11.GL_DEPTH_TEST );
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled( ScaleFactor, ScaleFactor, ScaleFactor );
|
||||
int X = (int) (((float) par4 + offset + 16.0f - par1FontRenderer.getStringWidth( var6 ) * ScaleFactor) * RScaleFactor);
|
||||
int Y = (int) (((float) par5 + offset + 16.0f - 7.0f * ScaleFactor) * RScaleFactor);
|
||||
par1FontRenderer.drawStringWithShadow( var6, X, Y, 16777215 );
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
GL11.glEnable( GL11.GL_DEPTH_TEST );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,750 @@
|
|||
package appeng.client.render;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BaseBlockRender
|
||||
{
|
||||
|
||||
final int ORIENTATION_BITS = 7;
|
||||
final static int FLIP_H_BIT = 8;
|
||||
final static int FLIP_V_BIT = 16;
|
||||
|
||||
final double MAX_DISTANCE;
|
||||
final public boolean hasTESR;
|
||||
final static private byte OrientationMap[][][] = new byte[6][6][6];
|
||||
|
||||
static public int getOrientation(ForgeDirection in, ForgeDirection forward, ForgeDirection up)
|
||||
{
|
||||
if ( in == null || in.equals( ForgeDirection.UNKNOWN ) // 1
|
||||
|| forward == null || forward.equals( ForgeDirection.UNKNOWN ) // 2
|
||||
|| up == null || up.equals( ForgeDirection.UNKNOWN ) )
|
||||
return 0;
|
||||
|
||||
int a = in.ordinal();
|
||||
int b = forward.ordinal();
|
||||
int c = up.ordinal();
|
||||
|
||||
return OrientationMap[a][b][c];
|
||||
}
|
||||
|
||||
static public void setOriMap()
|
||||
{
|
||||
// pointed up...
|
||||
OrientationMap[0][3][1] = 0;
|
||||
OrientationMap[1][3][1] = 0;
|
||||
OrientationMap[2][3][1] = 0;
|
||||
OrientationMap[3][3][1] = 0;
|
||||
OrientationMap[4][3][1] = 0;
|
||||
OrientationMap[5][3][1] = 0;
|
||||
|
||||
OrientationMap[0][5][1] = 1;
|
||||
OrientationMap[1][5][1] = 2;
|
||||
OrientationMap[2][5][1] = 0;
|
||||
OrientationMap[3][5][1] = 0;
|
||||
OrientationMap[4][5][1] = 0;
|
||||
OrientationMap[5][5][1] = 0;
|
||||
|
||||
OrientationMap[0][2][1] = 3;
|
||||
OrientationMap[1][2][1] = 3;
|
||||
OrientationMap[2][2][1] = 0;
|
||||
OrientationMap[3][2][1] = 0;
|
||||
OrientationMap[4][2][1] = 0;
|
||||
OrientationMap[5][2][1] = 0;
|
||||
|
||||
OrientationMap[0][4][1] = 2;
|
||||
OrientationMap[1][4][1] = 1;
|
||||
OrientationMap[2][4][1] = 0;
|
||||
OrientationMap[3][4][1] = 0;
|
||||
OrientationMap[4][4][1] = 0;
|
||||
OrientationMap[5][4][1] = 0;
|
||||
|
||||
// upside down
|
||||
OrientationMap[0][3][0] = 0 | FLIP_H_BIT;
|
||||
OrientationMap[1][3][0] = 0 | FLIP_H_BIT;
|
||||
OrientationMap[2][3][0] = 3;
|
||||
OrientationMap[3][3][0] = 3;
|
||||
OrientationMap[4][3][0] = 3;
|
||||
OrientationMap[5][3][0] = 3;
|
||||
|
||||
OrientationMap[0][4][0] = 2 | FLIP_H_BIT;
|
||||
OrientationMap[1][4][0] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[2][4][0] = 3;
|
||||
OrientationMap[3][4][0] = 3;
|
||||
OrientationMap[4][4][0] = 3;
|
||||
OrientationMap[5][4][0] = 3;
|
||||
|
||||
OrientationMap[0][5][0] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[1][5][0] = 2 | FLIP_H_BIT;
|
||||
OrientationMap[2][5][0] = 3;
|
||||
OrientationMap[3][5][0] = 3;
|
||||
OrientationMap[4][5][0] = 3;
|
||||
OrientationMap[5][5][0] = 3;
|
||||
|
||||
OrientationMap[0][2][0] = 3 | FLIP_H_BIT;
|
||||
OrientationMap[1][2][0] = 3 | FLIP_H_BIT;
|
||||
OrientationMap[2][2][0] = 3;
|
||||
OrientationMap[3][2][0] = 3;
|
||||
OrientationMap[4][2][0] = 3;
|
||||
OrientationMap[5][2][0] = 3;
|
||||
|
||||
// side 1
|
||||
OrientationMap[0][3][5] = 1 | FLIP_V_BIT;
|
||||
OrientationMap[1][3][5] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[2][3][5] = 1;
|
||||
OrientationMap[3][3][5] = 1;
|
||||
OrientationMap[4][3][5] = 1;
|
||||
OrientationMap[5][3][5] = 1 | FLIP_V_BIT;
|
||||
|
||||
OrientationMap[0][1][5] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[1][1][5] = 1;
|
||||
OrientationMap[2][1][5] = 3 | FLIP_V_BIT;
|
||||
OrientationMap[3][1][5] = 3;
|
||||
OrientationMap[4][1][5] = 1 | FLIP_V_BIT;
|
||||
OrientationMap[5][1][5] = 1;
|
||||
|
||||
OrientationMap[0][2][5] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[1][2][5] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[2][2][5] = 1;
|
||||
OrientationMap[3][2][5] = 2 | FLIP_V_BIT;
|
||||
OrientationMap[4][2][5] = 1 | FLIP_V_BIT;
|
||||
OrientationMap[5][2][5] = 1;
|
||||
|
||||
OrientationMap[0][0][5] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[1][0][5] = 1;
|
||||
OrientationMap[2][0][5] = 0;
|
||||
OrientationMap[3][0][5] = 0 | FLIP_V_BIT;
|
||||
OrientationMap[4][0][5] = 1;
|
||||
OrientationMap[5][0][5] = 1 | FLIP_V_BIT;
|
||||
|
||||
// side 2
|
||||
OrientationMap[0][1][2] = 0 | FLIP_H_BIT;
|
||||
OrientationMap[1][1][2] = 0;
|
||||
OrientationMap[2][1][2] = 2 | FLIP_H_BIT;
|
||||
OrientationMap[3][1][2] = 1;
|
||||
OrientationMap[4][1][2] = 3;
|
||||
OrientationMap[5][1][2] = 3 | FLIP_H_BIT;
|
||||
|
||||
OrientationMap[0][4][2] = 0 | FLIP_H_BIT;
|
||||
OrientationMap[1][4][2] = 0 | FLIP_H_BIT;
|
||||
OrientationMap[2][4][2] = 2 | FLIP_H_BIT;
|
||||
OrientationMap[3][4][2] = 1;
|
||||
OrientationMap[4][4][2] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[5][4][2] = 2;
|
||||
|
||||
OrientationMap[0][0][2] = 0 | FLIP_V_BIT;
|
||||
OrientationMap[1][0][2] = 0;
|
||||
OrientationMap[2][0][2] = 2;
|
||||
OrientationMap[3][0][2] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[4][0][2] = 3 | FLIP_H_BIT;
|
||||
OrientationMap[5][0][2] = 0;
|
||||
|
||||
OrientationMap[0][5][2] = 0 | FLIP_H_BIT;
|
||||
OrientationMap[1][5][2] = 0 | FLIP_H_BIT;
|
||||
OrientationMap[2][5][2] = 2;
|
||||
OrientationMap[3][5][2] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[4][5][2] = 2;
|
||||
OrientationMap[5][5][2] = 1 | FLIP_H_BIT;
|
||||
|
||||
// side 3
|
||||
OrientationMap[0][0][3] = 3 | FLIP_H_BIT;
|
||||
OrientationMap[1][0][3] = 3;
|
||||
OrientationMap[2][0][3] = 1;
|
||||
OrientationMap[3][0][3] = 2 | FLIP_H_BIT;
|
||||
OrientationMap[4][0][3] = 0;
|
||||
OrientationMap[5][0][3] = 0 | FLIP_H_BIT;
|
||||
|
||||
OrientationMap[0][4][3] = 3;
|
||||
OrientationMap[1][4][3] = 3;
|
||||
OrientationMap[2][4][3] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[3][4][3] = 2;
|
||||
OrientationMap[4][4][3] = 1;
|
||||
OrientationMap[5][4][3] = 2 | FLIP_H_BIT;
|
||||
|
||||
OrientationMap[0][1][3] = 3 | FLIP_V_BIT;
|
||||
OrientationMap[1][1][3] = 3;
|
||||
OrientationMap[2][1][3] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[3][1][3] = 2;
|
||||
OrientationMap[4][1][3] = 3 | FLIP_H_BIT;
|
||||
OrientationMap[5][1][3] = 0;
|
||||
|
||||
OrientationMap[0][5][3] = 3;
|
||||
OrientationMap[1][5][3] = 3;
|
||||
OrientationMap[2][5][3] = 1;
|
||||
OrientationMap[3][5][3] = 2 | FLIP_H_BIT;
|
||||
OrientationMap[4][5][3] = 2 | FLIP_H_BIT;
|
||||
OrientationMap[5][5][3] = 1;
|
||||
|
||||
// side 4
|
||||
OrientationMap[0][3][4] = 1;
|
||||
OrientationMap[1][3][4] = 2;
|
||||
OrientationMap[2][3][4] = 2 | FLIP_H_BIT;
|
||||
OrientationMap[3][3][4] = 1;
|
||||
OrientationMap[4][3][4] = 2 | FLIP_H_BIT;
|
||||
OrientationMap[5][3][4] = 1;
|
||||
|
||||
OrientationMap[0][0][4] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[1][0][4] = 2;
|
||||
OrientationMap[2][0][4] = 0;
|
||||
OrientationMap[3][0][4] = 0 | FLIP_H_BIT;
|
||||
OrientationMap[4][0][4] = 2 | FLIP_H_BIT;
|
||||
OrientationMap[5][0][4] = 1;
|
||||
|
||||
OrientationMap[0][1][4] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[1][1][4] = 2;
|
||||
OrientationMap[2][1][4] = 3 | FLIP_H_BIT;
|
||||
OrientationMap[3][1][4] = 3;
|
||||
OrientationMap[4][1][4] = 2;
|
||||
OrientationMap[5][1][4] = 1 | FLIP_H_BIT;
|
||||
|
||||
OrientationMap[0][2][4] = 1;
|
||||
OrientationMap[1][2][4] = 2;
|
||||
OrientationMap[2][2][4] = 1;
|
||||
OrientationMap[3][2][4] = 2 | FLIP_H_BIT;
|
||||
OrientationMap[4][2][4] = 2;
|
||||
OrientationMap[5][2][4] = 1 | FLIP_H_BIT;
|
||||
}
|
||||
|
||||
public BaseBlockRender() {
|
||||
this( false, 20 );
|
||||
}
|
||||
|
||||
public BaseBlockRender(boolean enableTESR, double TESRrange) {
|
||||
hasTESR = enableTESR;
|
||||
MAX_DISTANCE = TESRrange;
|
||||
setOriMap();
|
||||
}
|
||||
|
||||
public double getTesrRenderDistance()
|
||||
{
|
||||
return MAX_DISTANCE;
|
||||
}
|
||||
|
||||
public Icon firstNotNull(Icon... s)
|
||||
{
|
||||
for (Icon o : s)
|
||||
if ( o != null )
|
||||
return o;
|
||||
return ExtraTextures.getMissing();
|
||||
}
|
||||
|
||||
public void renderInvBlock(EnumSet<ForgeDirection> sides, AEBaseBlock block, Tessellator tess, int color, RenderBlocks renderer)
|
||||
{
|
||||
if ( tess.isDrawing )
|
||||
tess.draw();
|
||||
|
||||
if ( sides.contains( ForgeDirection.DOWN ) )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal( 0.0F, -1.0F, 0.0F );
|
||||
tess.setColorOpaque_I( color );
|
||||
renderer.renderFaceYNeg( block, 0.0D, 0.0D, 0.0D,
|
||||
firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.DOWN ), block.getIcon( 0, 0 ) ) );
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
if ( sides.contains( ForgeDirection.UP ) )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal( 0.0F, 1.0F, 0.0F );
|
||||
tess.setColorOpaque_I( color );
|
||||
renderer.renderFaceYPos(
|
||||
block,
|
||||
0.0D,
|
||||
0.0D,
|
||||
0.0D,
|
||||
firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.UP ),
|
||||
block.getIcon( ForgeDirection.UP.ordinal(), 0 ) ) );
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
if ( sides.contains( ForgeDirection.NORTH ) )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal( 0.0F, 0.0F, -1.0F );
|
||||
tess.setColorOpaque_I( color );
|
||||
renderer.renderFaceZNeg(
|
||||
block,
|
||||
0.0D,
|
||||
0.0D,
|
||||
0.0D,
|
||||
firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.NORTH ),
|
||||
block.getIcon( ForgeDirection.NORTH.ordinal(), 0 ) ) );
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
if ( sides.contains( ForgeDirection.SOUTH ) )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal( 0.0F, 0.0F, 1.0F );
|
||||
tess.setColorOpaque_I( color );
|
||||
renderer.renderFaceZPos(
|
||||
block,
|
||||
0.0D,
|
||||
0.0D,
|
||||
0.0D,
|
||||
firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.SOUTH ),
|
||||
block.getIcon( ForgeDirection.SOUTH.ordinal(), 0 ) ) );
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
if ( sides.contains( ForgeDirection.WEST ) )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal( -1.0F, 0.0F, 0.0F );
|
||||
tess.setColorOpaque_I( color );
|
||||
renderer.renderFaceXNeg(
|
||||
block,
|
||||
0.0D,
|
||||
0.0D,
|
||||
0.0D,
|
||||
firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.WEST ),
|
||||
block.getIcon( ForgeDirection.WEST.ordinal(), 0 ) ) );
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
if ( sides.contains( ForgeDirection.EAST ) )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal( 1.0F, 0.0F, 0.0F );
|
||||
tess.setColorOpaque_I( color );
|
||||
renderer.renderFaceXPos(
|
||||
block,
|
||||
0.0D,
|
||||
0.0D,
|
||||
0.0D,
|
||||
firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.EAST ),
|
||||
block.getIcon( ForgeDirection.EAST.ordinal(), 0 ) ) );
|
||||
tess.draw();
|
||||
}
|
||||
}
|
||||
|
||||
public void renderInventory(AEBaseBlock block, ItemStack item, RenderBlocks renderer)
|
||||
{
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
BlockRenderInfo info = block.getRendererInstance();
|
||||
if ( info.isValid() )
|
||||
{
|
||||
renderer.uvRotateBottom = info.getTexture( ForgeDirection.DOWN ).setFlip(
|
||||
getOrientation( ForgeDirection.DOWN, ForgeDirection.SOUTH, ForgeDirection.UP ) );
|
||||
renderer.uvRotateTop = info.getTexture( ForgeDirection.UP ).setFlip( getOrientation( ForgeDirection.UP, ForgeDirection.SOUTH, ForgeDirection.UP ) );
|
||||
|
||||
renderer.uvRotateEast = info.getTexture( ForgeDirection.EAST ).setFlip(
|
||||
getOrientation( ForgeDirection.EAST, ForgeDirection.SOUTH, ForgeDirection.UP ) );
|
||||
renderer.uvRotateWest = info.getTexture( ForgeDirection.WEST ).setFlip(
|
||||
getOrientation( ForgeDirection.WEST, ForgeDirection.SOUTH, ForgeDirection.UP ) );
|
||||
|
||||
renderer.uvRotateNorth = info.getTexture( ForgeDirection.NORTH ).setFlip(
|
||||
getOrientation( ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.UP ) );
|
||||
renderer.uvRotateSouth = info.getTexture( ForgeDirection.SOUTH ).setFlip(
|
||||
getOrientation( ForgeDirection.SOUTH, ForgeDirection.SOUTH, ForgeDirection.UP ) );
|
||||
|
||||
}
|
||||
|
||||
renderInvBlock( EnumSet.allOf( ForgeDirection.class ), block, tess, 0xffffff, renderer );
|
||||
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
}
|
||||
|
||||
public IOrientable getOrientable(AEBaseBlock block, IBlockAccess w, int x, int y, int z)
|
||||
{
|
||||
if ( block.hasBlockTileEntity() )
|
||||
return (AEBaseTile) block.getTileEntity( w, x, y, z );
|
||||
else if ( block instanceof IOrientableBlock )
|
||||
return ((IOrientableBlock) block).getOrientable( w, x, y, z );
|
||||
return null;
|
||||
}
|
||||
|
||||
public void preRenderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
ForgeDirection forward = ForgeDirection.SOUTH;
|
||||
ForgeDirection up = ForgeDirection.UP;
|
||||
|
||||
BlockRenderInfo info = block.getRendererInstance();
|
||||
IOrientable te = getOrientable( block, world, x, y, z );
|
||||
if ( te != null )
|
||||
{
|
||||
forward = te.getForward();
|
||||
up = te.getUp();
|
||||
|
||||
renderer.uvRotateBottom = info.getTexture( ForgeDirection.DOWN ).setFlip( getOrientation( ForgeDirection.DOWN, forward, up ) );
|
||||
renderer.uvRotateTop = info.getTexture( ForgeDirection.UP ).setFlip( getOrientation( ForgeDirection.UP, forward, up ) );
|
||||
|
||||
renderer.uvRotateEast = info.getTexture( ForgeDirection.EAST ).setFlip( getOrientation( ForgeDirection.EAST, forward, up ) );
|
||||
renderer.uvRotateWest = info.getTexture( ForgeDirection.WEST ).setFlip( getOrientation( ForgeDirection.WEST, forward, up ) );
|
||||
|
||||
renderer.uvRotateNorth = info.getTexture( ForgeDirection.NORTH ).setFlip( getOrientation( ForgeDirection.NORTH, forward, up ) );
|
||||
renderer.uvRotateSouth = info.getTexture( ForgeDirection.SOUTH ).setFlip( getOrientation( ForgeDirection.SOUTH, forward, up ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void postRenderInWorld(RenderBlocks renderer)
|
||||
{
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
}
|
||||
|
||||
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
preRenderInWorld( block, world, x, y, z, renderer );
|
||||
|
||||
boolean o = renderer.renderStandardBlock( block, x, y, z );
|
||||
|
||||
postRenderInWorld( renderer );
|
||||
return o;
|
||||
}
|
||||
|
||||
final FloatBuffer rotMat = BufferUtils.createFloatBuffer( 16 );
|
||||
|
||||
protected void applyTESRRotation(double x, double y, double z, ForgeDirection forward, ForgeDirection up)
|
||||
{
|
||||
if ( forward != null && up != null )
|
||||
{
|
||||
ForgeDirection west = Platform.crossProduct( forward, up );
|
||||
|
||||
rotMat.put( 0, west.offsetX );
|
||||
rotMat.put( 1, west.offsetY );
|
||||
rotMat.put( 2, west.offsetZ );
|
||||
rotMat.put( 3, 0 );
|
||||
|
||||
rotMat.put( 4, up.offsetX );
|
||||
rotMat.put( 5, up.offsetY );
|
||||
rotMat.put( 6, up.offsetZ );
|
||||
rotMat.put( 7, 0 );
|
||||
|
||||
rotMat.put( 8, forward.offsetX );
|
||||
rotMat.put( 9, forward.offsetY );
|
||||
rotMat.put( 10, forward.offsetZ );
|
||||
rotMat.put( 11, 0 );
|
||||
|
||||
rotMat.put( 12, 0 );
|
||||
rotMat.put( 13, 0 );
|
||||
rotMat.put( 14, 0 );
|
||||
rotMat.put( 15, 1 );
|
||||
GL11.glTranslated( x + 0.5, y + 0.5, z + 0.5 );
|
||||
GL11.glMultMatrix( rotMat );
|
||||
GL11.glTranslated( -0.5, -0.5, -0.5 );
|
||||
GL11.glCullFace( GL11.GL_FRONT );
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslated( x, y, z );
|
||||
}
|
||||
}
|
||||
|
||||
protected void setInvRenderBounds(RenderBlocks renderer, int i, int j, int k, int l, int m, int n)
|
||||
{
|
||||
renderer.setRenderBounds( i / 16.0, j / 16.0, k / 16.0, l / 16.0, m / 16.0, n / 16.0 );
|
||||
}
|
||||
|
||||
protected void renderBlockBounds(RenderBlocks renderer,
|
||||
|
||||
double minX, double minY, double minZ,
|
||||
|
||||
double maxX, double maxY, double maxZ,
|
||||
|
||||
ForgeDirection x, ForgeDirection y, ForgeDirection z)
|
||||
{
|
||||
minX /= 16.0;
|
||||
minY /= 16.0;
|
||||
minZ /= 16.0;
|
||||
maxX /= 16.0;
|
||||
maxY /= 16.0;
|
||||
maxZ /= 16.0;
|
||||
|
||||
double aX = minX * x.offsetX + minY * y.offsetX + minZ * z.offsetX;
|
||||
double aY = minX * x.offsetY + minY * y.offsetY + minZ * z.offsetY;
|
||||
double aZ = minX * x.offsetZ + minY * y.offsetZ + minZ * z.offsetZ;
|
||||
|
||||
double bX = maxX * x.offsetX + maxY * y.offsetX + maxZ * z.offsetX;
|
||||
double bY = maxX * x.offsetY + maxY * y.offsetY + maxZ * z.offsetY;
|
||||
double bZ = maxX * x.offsetZ + maxY * y.offsetZ + maxZ * z.offsetZ;
|
||||
|
||||
if ( x.offsetX + y.offsetX + z.offsetX < 0 )
|
||||
{
|
||||
aX += 1;
|
||||
bX += 1;
|
||||
}
|
||||
|
||||
if ( x.offsetY + y.offsetY + z.offsetY < 0 )
|
||||
{
|
||||
aY += 1;
|
||||
bY += 1;
|
||||
}
|
||||
|
||||
if ( x.offsetZ + y.offsetZ + z.offsetZ < 0 )
|
||||
{
|
||||
aZ += 1;
|
||||
bZ += 1;
|
||||
}
|
||||
|
||||
renderer.renderMinX = Math.min( aX, bX );
|
||||
renderer.renderMinY = Math.min( aY, bY );
|
||||
renderer.renderMinZ = Math.min( aZ, bZ );
|
||||
renderer.renderMaxX = Math.max( aX, bX );
|
||||
renderer.renderMaxY = Math.max( aY, bY );
|
||||
renderer.renderMaxZ = Math.max( aZ, bZ );
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void renderFace(Tessellator tess, double offsetX, double offsetY, double offsetZ, double ax, double ay, double az, double bx, double by, double bz,
|
||||
double ua, double ub, double va, double vb, Icon ico, boolean flip)
|
||||
{
|
||||
if ( flip )
|
||||
{
|
||||
tess.addVertexWithUV( offsetX + ax * ua + bx * va, offsetY + ay * ua + by * va, offsetZ + az * ua + bz * va, ico.getInterpolatedU( ua * 16.0 ),
|
||||
ico.getInterpolatedV( va * 16.0 ) );
|
||||
tess.addVertexWithUV( offsetX + ax * ua + bx * vb, offsetY + ay * ua + by * vb, offsetZ + az * ua + bz * vb, ico.getInterpolatedU( ua * 16.0 ),
|
||||
ico.getInterpolatedV( vb * 16.0 ) );
|
||||
tess.addVertexWithUV( offsetX + ax * ub + bx * vb, offsetY + ay * ub + by * vb, offsetZ + az * ub + bz * vb, ico.getInterpolatedU( ub * 16.0 ),
|
||||
ico.getInterpolatedV( vb * 16.0 ) );
|
||||
tess.addVertexWithUV( offsetX + ax * ub + bx * va, offsetY + ay * ub + by * va, offsetZ + az * ub + bz * va, ico.getInterpolatedU( ub * 16.0 ),
|
||||
ico.getInterpolatedV( va * 16.0 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
tess.addVertexWithUV( offsetX + ax * ua + bx * va, offsetY + ay * ua + by * va, offsetZ + az * ua + bz * va, ico.getInterpolatedU( ua * 16.0 ),
|
||||
ico.getInterpolatedV( va * 16.0 ) );
|
||||
tess.addVertexWithUV( offsetX + ax * ub + bx * va, offsetY + ay * ub + by * va, offsetZ + az * ub + bz * va, ico.getInterpolatedU( ub * 16.0 ),
|
||||
ico.getInterpolatedV( va * 16.0 ) );
|
||||
tess.addVertexWithUV( offsetX + ax * ub + bx * vb, offsetY + ay * ub + by * vb, offsetZ + az * ub + bz * vb, ico.getInterpolatedU( ub * 16.0 ),
|
||||
ico.getInterpolatedV( vb * 16.0 ) );
|
||||
tess.addVertexWithUV( offsetX + ax * ua + bx * vb, offsetY + ay * ua + by * vb, offsetZ + az * ua + bz * vb, ico.getInterpolatedU( ua * 16.0 ),
|
||||
ico.getInterpolatedV( vb * 16.0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void renderCutoutFace(Block block, Icon ico, int x, int y, int z, RenderBlocks renderer, ForgeDirection orientation, float edgeThickness)
|
||||
{
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
double offsetX = 0.0, offsetY = 0.0, offsetZ = 0.0;
|
||||
double layaX = 0.0, layaY = 0.0, layaZ = 0.0;
|
||||
double laybX = 0.0, laybY = 0.0, laybZ = 0.0;
|
||||
|
||||
boolean flip = false;
|
||||
switch (orientation)
|
||||
{
|
||||
case NORTH:
|
||||
|
||||
layaX = 1.0;
|
||||
laybY = 1.0;
|
||||
flip = true;
|
||||
|
||||
break;
|
||||
case SOUTH:
|
||||
|
||||
layaX = 1.0;
|
||||
laybY = 1.0;
|
||||
offsetZ = 1.0;
|
||||
|
||||
break;
|
||||
case EAST:
|
||||
|
||||
flip = true;
|
||||
layaZ = 1.0;
|
||||
laybY = 1.0;
|
||||
offsetX = 1.0;
|
||||
|
||||
break;
|
||||
case WEST:
|
||||
|
||||
layaZ = 1.0;
|
||||
laybY = 1.0;
|
||||
|
||||
break;
|
||||
case UP:
|
||||
|
||||
flip = true;
|
||||
layaX = 1.0;
|
||||
laybZ = 1.0;
|
||||
offsetY = 1.0;
|
||||
|
||||
break;
|
||||
case DOWN:
|
||||
|
||||
layaX = 1.0;
|
||||
laybZ = 1.0;
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
offsetX += x;
|
||||
offsetY += y;
|
||||
offsetZ += z;
|
||||
|
||||
renderFace( tess, offsetX, offsetY, offsetZ, layaX, layaY, layaZ, laybX, laybY, laybZ,
|
||||
// u -> u
|
||||
0, 1.0,
|
||||
// v -> v
|
||||
0, edgeThickness, ico, flip );
|
||||
|
||||
renderFace( tess, offsetX, offsetY, offsetZ, layaX, layaY, layaZ, laybX, laybY, laybZ,
|
||||
// u -> u
|
||||
0.0, edgeThickness,
|
||||
// v -> v
|
||||
edgeThickness, 1.0 - edgeThickness, ico, flip );
|
||||
|
||||
renderFace( tess, offsetX, offsetY, offsetZ, layaX, layaY, layaZ, laybX, laybY, laybZ,
|
||||
// u -> u
|
||||
1.0 - edgeThickness, 1.0,
|
||||
// v -> v
|
||||
edgeThickness, 1.0 - edgeThickness, ico, flip );
|
||||
|
||||
renderFace( tess, offsetX, offsetY, offsetZ, layaX, layaY, layaZ, laybX, laybY, laybZ,
|
||||
// u -> u
|
||||
0, 1.0,
|
||||
// v -> v
|
||||
1.0 - edgeThickness, 1.0, ico, flip );
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void renderFace(int x, int y, int z, Block block, Icon ico, RenderBlocks renderer, ForgeDirection orientation)
|
||||
{
|
||||
switch (orientation)
|
||||
{
|
||||
case NORTH:
|
||||
renderer.renderFaceZNeg( block, x, y, z, ico );
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.renderFaceZPos( block, x, y, z, ico );
|
||||
break;
|
||||
case EAST:
|
||||
renderer.renderFaceXPos( block, x, y, z, ico );
|
||||
break;
|
||||
case WEST:
|
||||
renderer.renderFaceXNeg( block, x, y, z, ico );
|
||||
break;
|
||||
case UP:
|
||||
renderer.renderFaceYPos( block, x, y, z, ico );
|
||||
break;
|
||||
case DOWN:
|
||||
renderer.renderFaceYNeg( block, x, y, z, ico );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void selectFace(RenderBlocks renderer, ForgeDirection west, ForgeDirection up, ForgeDirection forward, int u1, int u2, int v1, int v2)
|
||||
{
|
||||
v1 = 16 - v1;
|
||||
v2 = 16 - v2;
|
||||
|
||||
double minX = (forward.offsetX > 0 ? 1 : 0) + mapFaceUV( west.offsetX, u1 ) + mapFaceUV( up.offsetX, v1 );
|
||||
double minY = (forward.offsetY > 0 ? 1 : 0) + mapFaceUV( west.offsetY, u1 ) + mapFaceUV( up.offsetY, v1 );
|
||||
double minZ = (forward.offsetZ > 0 ? 1 : 0) + mapFaceUV( west.offsetZ, u1 ) + mapFaceUV( up.offsetZ, v1 );
|
||||
|
||||
double maxX = (forward.offsetX > 0 ? 1 : 0) + mapFaceUV( west.offsetX, u2 ) + mapFaceUV( up.offsetX, v2 );
|
||||
double maxY = (forward.offsetY > 0 ? 1 : 0) + mapFaceUV( west.offsetY, u2 ) + mapFaceUV( up.offsetY, v2 );
|
||||
double maxZ = (forward.offsetZ > 0 ? 1 : 0) + mapFaceUV( west.offsetZ, u2 ) + mapFaceUV( up.offsetZ, v2 );
|
||||
|
||||
renderer.renderMinX = Math.max( 0.0, Math.min( minX, maxX ) - 0.001 );
|
||||
renderer.renderMaxX = Math.min( 1.0, Math.max( minX, maxX ) + 0.001 );
|
||||
|
||||
renderer.renderMinY = Math.max( 0.0, Math.min( minY, maxY ) - 0.001 );
|
||||
renderer.renderMaxY = Math.min( 1.0, Math.max( minY, maxY ) + 0.001 );
|
||||
|
||||
renderer.renderMinZ = Math.max( 0.0, Math.min( minZ, maxZ ) - 0.001 );
|
||||
renderer.renderMaxZ = Math.min( 1.0, Math.max( minZ, maxZ ) + 0.001 );
|
||||
}
|
||||
|
||||
private double mapFaceUV(int offset, int uv)
|
||||
{
|
||||
if ( offset == 0 )
|
||||
return 0;
|
||||
|
||||
if ( offset > 0 )
|
||||
return (double) uv / 16.0;
|
||||
|
||||
return (16.0 - (double) uv) / 16.0;
|
||||
}
|
||||
|
||||
public void renderTile(AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer)
|
||||
{
|
||||
ForgeDirection forward = ForgeDirection.SOUTH;
|
||||
ForgeDirection up = ForgeDirection.UP;
|
||||
|
||||
renderer.uvRotateBottom = renderer.uvRotateTop = renderer.uvRotateEast = renderer.uvRotateWest = renderer.uvRotateNorth = renderer.uvRotateSouth = 0;
|
||||
|
||||
applyTESRRotation( x, y, z, forward, up );
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.locationBlocksTexture );
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
if ( Minecraft.isAmbientOcclusionEnabled() )
|
||||
GL11.glShadeModel( GL11.GL_SMOOTH );
|
||||
else
|
||||
GL11.glShadeModel( GL11.GL_FLAT );
|
||||
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
|
||||
tess.setTranslation( -tile.xCoord, -tile.yCoord, -tile.zCoord );
|
||||
tess.startDrawingQuads();
|
||||
|
||||
// note that this is a terrible approach...
|
||||
renderer.setRenderBoundsFromBlock( block );
|
||||
renderer.renderStandardBlock( block, tile.xCoord, tile.yCoord, tile.zCoord );
|
||||
|
||||
tess.draw();
|
||||
tess.setTranslation( 0, 0, 0 );
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
|
||||
renderer.uvRotateBottom = renderer.uvRotateTop = renderer.uvRotateEast = renderer.uvRotateWest = renderer.uvRotateNorth = renderer.uvRotateSouth = 0;
|
||||
}
|
||||
|
||||
public void doRenderItem(ItemStack itemstack, TileEntity par1EntityItemFrame)
|
||||
{
|
||||
if ( itemstack != null )
|
||||
{
|
||||
EntityItem entityitem = new EntityItem( par1EntityItemFrame.worldObj, 0.0D, 0.0D, 0.0D, itemstack );
|
||||
entityitem.getEntityItem().stackSize = 1;
|
||||
|
||||
// set all this stuff and then do shit? meh?
|
||||
entityitem.hoverStart = 0;
|
||||
entityitem.age = 0;
|
||||
entityitem.rotationYaw = 0;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef( 0, -0.14F, 0 );
|
||||
|
||||
RenderItem.renderInFrame = true;
|
||||
RenderManager.instance.renderEntityWithPosYaw( entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F );
|
||||
RenderItem.renderInFrame = false;
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
package appeng.client.render;
|
||||
|
||||
import appeng.client.texture.FlipableIcon;
|
||||
import appeng.client.texture.TmpFlipableIcon;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class BlockRenderInfo
|
||||
{
|
||||
|
||||
public BlockRenderInfo(BaseBlockRender inst) {
|
||||
rendererInstance = inst;
|
||||
}
|
||||
|
||||
final public BaseBlockRender rendererInstance;
|
||||
|
||||
private boolean useTmp = false;
|
||||
private TmpFlipableIcon tmpTopIcon = new TmpFlipableIcon();
|
||||
private TmpFlipableIcon tmpBottomIcon = new TmpFlipableIcon();
|
||||
private TmpFlipableIcon tmpSouthIcon = new TmpFlipableIcon();
|
||||
private TmpFlipableIcon tmpNorthIcon = new TmpFlipableIcon();
|
||||
private TmpFlipableIcon tmpEastIcon = new TmpFlipableIcon();
|
||||
private TmpFlipableIcon tmpWestIcon = new TmpFlipableIcon();
|
||||
|
||||
private FlipableIcon topIcon = null;
|
||||
private FlipableIcon bottomIcon = null;
|
||||
private FlipableIcon southIcon = null;
|
||||
private FlipableIcon northIcon = null;
|
||||
private FlipableIcon eastIcon = null;
|
||||
private FlipableIcon westIcon = null;
|
||||
|
||||
public void updateIcons(FlipableIcon Bottom, FlipableIcon Top, FlipableIcon North, FlipableIcon South, FlipableIcon East,
|
||||
FlipableIcon West)
|
||||
{
|
||||
topIcon = Top;
|
||||
bottomIcon = Bottom;
|
||||
southIcon = South;
|
||||
northIcon = North;
|
||||
eastIcon = East;
|
||||
westIcon = West;
|
||||
|
||||
}
|
||||
|
||||
public void setTemporaryRenderIcon(Icon icon)
|
||||
{
|
||||
if ( icon == null )
|
||||
useTmp = false;
|
||||
else
|
||||
{
|
||||
useTmp = true;
|
||||
tmpTopIcon.setOriginal( icon );
|
||||
tmpBottomIcon.setOriginal( icon );
|
||||
tmpSouthIcon.setOriginal( icon );
|
||||
tmpNorthIcon.setOriginal( icon );
|
||||
tmpEastIcon.setOriginal( icon );
|
||||
tmpWestIcon.setOriginal( icon );
|
||||
}
|
||||
}
|
||||
|
||||
public void setTemporaryRenderIcons(Icon nTopIcon, Icon nBottomIcon, Icon nSouthIcon, Icon nNorthIcon, Icon nEastIcon,
|
||||
Icon nWestIcon)
|
||||
{
|
||||
tmpTopIcon.setOriginal( nTopIcon == null ? getTexture( ForgeDirection.UP ) : nTopIcon );
|
||||
tmpBottomIcon.setOriginal( nBottomIcon == null ? getTexture( ForgeDirection.DOWN ) : nBottomIcon );
|
||||
tmpSouthIcon.setOriginal( nSouthIcon == null ? getTexture( ForgeDirection.SOUTH ) : nSouthIcon );
|
||||
tmpNorthIcon.setOriginal( nNorthIcon == null ? getTexture( ForgeDirection.NORTH ) : nNorthIcon );
|
||||
tmpEastIcon.setOriginal( nEastIcon == null ? getTexture( ForgeDirection.EAST ) : nEastIcon );
|
||||
tmpWestIcon.setOriginal( nWestIcon == null ? getTexture( ForgeDirection.WEST ) : nWestIcon );
|
||||
useTmp = true;
|
||||
}
|
||||
|
||||
public FlipableIcon getTexture(ForgeDirection dir)
|
||||
{
|
||||
if ( useTmp )
|
||||
{
|
||||
switch (dir)
|
||||
{
|
||||
case DOWN:
|
||||
return tmpBottomIcon;
|
||||
case UP:
|
||||
return tmpTopIcon;
|
||||
case NORTH:
|
||||
return tmpNorthIcon;
|
||||
case SOUTH:
|
||||
return tmpSouthIcon;
|
||||
case EAST:
|
||||
return tmpEastIcon;
|
||||
case WEST:
|
||||
return tmpWestIcon;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (dir)
|
||||
{
|
||||
case DOWN:
|
||||
return bottomIcon;
|
||||
case UP:
|
||||
return topIcon;
|
||||
case NORTH:
|
||||
return northIcon;
|
||||
case SOUTH:
|
||||
return southIcon;
|
||||
case EAST:
|
||||
return eastIcon;
|
||||
case WEST:
|
||||
return westIcon;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return topIcon;
|
||||
}
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
return topIcon != null && bottomIcon != null && southIcon != null && northIcon != null && eastIcon != null
|
||||
&& westIcon != null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,254 @@
|
|||
package appeng.client.render;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.parts.IPartRenderHelper;
|
||||
import appeng.block.AEBaseBlock;
|
||||
|
||||
public class BusRenderHelper implements IPartRenderHelper
|
||||
{
|
||||
|
||||
final public static BusRenderHelper instance = new BusRenderHelper();
|
||||
|
||||
double minX = 0;
|
||||
double minY = 0;
|
||||
double minZ = 0;
|
||||
double maxX = 16;
|
||||
double maxY = 16;
|
||||
double maxZ = 16;
|
||||
|
||||
AEBaseBlock blk = (AEBaseBlock) AEApi.instance().blocks().blockMultiPart.block();
|
||||
BaseBlockRender bbr = new BaseBlockRender();
|
||||
|
||||
public ForgeDirection ax;
|
||||
public ForgeDirection ay;
|
||||
public ForgeDirection az;
|
||||
|
||||
int color = 0xffffff;
|
||||
|
||||
@Override
|
||||
public void setBounds(float minx, float miny, float minz, float maxx, float maxy, float maxz)
|
||||
{
|
||||
minX = minx;
|
||||
minY = miny;
|
||||
minZ = minz;
|
||||
maxX = maxx;
|
||||
maxY = maxy;
|
||||
maxZ = maxz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInvColor(int newColor)
|
||||
{
|
||||
color = newColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTexture(Icon ico)
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ico );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTexture(Icon Down, Icon Up, Icon North, Icon South, Icon West, Icon East)
|
||||
{
|
||||
Icon list[] = new Icon[6];
|
||||
|
||||
list[0] = Down;
|
||||
list[1] = Up;
|
||||
list[2] = North;
|
||||
list[3] = South;
|
||||
list[4] = West;
|
||||
list[5] = East;
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcons( list[mapRotation( ForgeDirection.UP ).ordinal()],
|
||||
list[mapRotation( ForgeDirection.DOWN ).ordinal()], list[mapRotation( ForgeDirection.SOUTH ).ordinal()],
|
||||
list[mapRotation( ForgeDirection.NORTH ).ordinal()], list[mapRotation( ForgeDirection.EAST ).ordinal()],
|
||||
list[mapRotation( ForgeDirection.WEST ).ordinal()] );
|
||||
}
|
||||
|
||||
public ForgeDirection mapRotation(ForgeDirection dir)
|
||||
{
|
||||
ForgeDirection forward = az;
|
||||
ForgeDirection up = ay;
|
||||
ForgeDirection west = ForgeDirection.UNKNOWN;
|
||||
|
||||
if ( forward == null || up == null )
|
||||
return dir;
|
||||
|
||||
int west_x = forward.offsetY * up.offsetZ - forward.offsetZ * up.offsetY;
|
||||
int west_y = forward.offsetZ * up.offsetX - forward.offsetX * up.offsetZ;
|
||||
int west_z = forward.offsetX * up.offsetY - forward.offsetY * up.offsetX;
|
||||
|
||||
for (ForgeDirection dx : ForgeDirection.VALID_DIRECTIONS)
|
||||
if ( dx.offsetX == west_x && dx.offsetY == west_y && dx.offsetZ == west_z )
|
||||
west = dx;
|
||||
|
||||
if ( dir.equals( forward ) )
|
||||
return ForgeDirection.SOUTH;
|
||||
if ( dir.equals( forward.getOpposite() ) )
|
||||
return ForgeDirection.NORTH;
|
||||
|
||||
if ( dir.equals( up ) )
|
||||
return ForgeDirection.UP;
|
||||
if ( dir.equals( up.getOpposite() ) )
|
||||
return ForgeDirection.DOWN;
|
||||
|
||||
if ( dir.equals( west ) )
|
||||
return ForgeDirection.WEST;
|
||||
if ( dir.equals( west.getOpposite() ) )
|
||||
return ForgeDirection.EAST;
|
||||
|
||||
return ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBox(RenderBlocks renderer)
|
||||
{
|
||||
renderer.setRenderBounds( minX / 16.0, minY / 16.0, minZ / 16.0, maxX / 16.0, maxY / 16.0, maxZ / 16.0 );
|
||||
bbr.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, Tessellator.instance, color, renderer );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryFace(Icon icon, ForgeDirection face, RenderBlocks renderer)
|
||||
{
|
||||
renderer.setRenderBounds( minX / 16.0, minY / 16.0, minZ / 16.0, maxX / 16.0, maxY / 16.0, maxZ / 16.0 );
|
||||
setTexture( icon );
|
||||
bbr.renderInvBlock( EnumSet.of( face ), blk, Tessellator.instance, color, renderer );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBlock(int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
AEBaseBlock blk = (AEBaseBlock) AEApi.instance().blocks().blockMultiPart.block();
|
||||
BlockRenderInfo info = blk.getRendererInstance();
|
||||
ForgeDirection forward = BusRenderHelper.instance.az;
|
||||
ForgeDirection up = BusRenderHelper.instance.ay;
|
||||
|
||||
renderer.uvRotateBottom = info.getTexture( ForgeDirection.DOWN ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.DOWN, forward, up ) );
|
||||
renderer.uvRotateTop = info.getTexture( ForgeDirection.UP ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.UP, forward, up ) );
|
||||
|
||||
renderer.uvRotateEast = info.getTexture( ForgeDirection.EAST ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.EAST, forward, up ) );
|
||||
renderer.uvRotateWest = info.getTexture( ForgeDirection.WEST ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.WEST, forward, up ) );
|
||||
|
||||
renderer.uvRotateNorth = info.getTexture( ForgeDirection.NORTH ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.NORTH, forward, up ) );
|
||||
renderer.uvRotateSouth = info.getTexture( ForgeDirection.SOUTH ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.SOUTH, forward, up ) );
|
||||
|
||||
bbr.renderBlockBounds( renderer, minX, minY, minZ, maxX, maxY, maxZ, ax, ay, az );
|
||||
|
||||
int blkId = renderer.blockAccess.getBlockId( x, y, z );
|
||||
if ( Block.blocksList[blkId] == null )
|
||||
return;
|
||||
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock()
|
||||
{
|
||||
return AEApi.instance().blocks().blockMultiPart.block();
|
||||
}
|
||||
|
||||
public void prepareBounds(RenderBlocks renderer)
|
||||
{
|
||||
bbr.renderBlockBounds( renderer, minX, minY, minZ, maxX, maxY, maxZ, ax, ay, az );
|
||||
}
|
||||
|
||||
public void renderBlockCurrentBounds(int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
int blkId = renderer.blockAccess.getBlockId( x, y, z );
|
||||
if ( Block.blocksList[blkId] == null )
|
||||
return;
|
||||
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceCutout(int x, int y, int z, Icon ico, ForgeDirection face, float edgeThickness, RenderBlocks renderer)
|
||||
{
|
||||
switch (face)
|
||||
{
|
||||
case DOWN:
|
||||
face = ay.getOpposite();
|
||||
break;
|
||||
case EAST:
|
||||
face = ax;
|
||||
break;
|
||||
case NORTH:
|
||||
face = az.getOpposite();
|
||||
break;
|
||||
case SOUTH:
|
||||
face = az;
|
||||
break;
|
||||
case UP:
|
||||
face = ay;
|
||||
break;
|
||||
case WEST:
|
||||
face = ax.getOpposite();
|
||||
break;
|
||||
case UNKNOWN:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
bbr.renderCutoutFace( blk, ico, x, y, z, renderer, face, edgeThickness );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFace(int x, int y, int z, Icon ico, ForgeDirection face, RenderBlocks renderer)
|
||||
{
|
||||
prepareBounds( renderer );
|
||||
switch (face)
|
||||
{
|
||||
case DOWN:
|
||||
face = ay.getOpposite();
|
||||
break;
|
||||
case EAST:
|
||||
face = ax;
|
||||
break;
|
||||
case NORTH:
|
||||
face = az.getOpposite();
|
||||
break;
|
||||
case SOUTH:
|
||||
face = az;
|
||||
break;
|
||||
case UP:
|
||||
face = ay;
|
||||
break;
|
||||
case WEST:
|
||||
face = ax.getOpposite();
|
||||
break;
|
||||
case UNKNOWN:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
bbr.renderFace( x, y, z, blk, ico, renderer, face );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getWorldX()
|
||||
{
|
||||
return ax;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getWorldY()
|
||||
{
|
||||
return ay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getWorldZ()
|
||||
{
|
||||
return az;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package appeng.client.render;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.parts.IPartItem;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.client.ClientHelper;
|
||||
import appeng.facade.IFacadeItem;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class BusRenderer implements IItemRenderer
|
||||
{
|
||||
|
||||
public static final BusRenderer instance = new BusRenderer();
|
||||
|
||||
public RenderBlocksWorkaround renderer = new RenderBlocksWorkaround();
|
||||
public static final HashMap<Integer, IPart> renderPart = new HashMap();
|
||||
|
||||
public IPart getRenderer(ItemStack is, IPartItem c)
|
||||
{
|
||||
int id = (is.getItem().itemID << Platform.DEF_OFFSET) | is.getItemDamage();
|
||||
|
||||
IPart part = renderPart.get( id );
|
||||
if ( part == null )
|
||||
{
|
||||
part = c.createPartFromItemStack( is );
|
||||
renderPart.put( id, part );
|
||||
}
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
if ( type == ItemRenderType.ENTITY )
|
||||
GL11.glTranslatef( -0.5f, -0.5f, -0.5f );
|
||||
if ( type == ItemRenderType.INVENTORY )
|
||||
GL11.glTranslatef( 0.0f, -0.1f, 0.0f );
|
||||
|
||||
GL11.glTranslated( 0.2, 0.3, 0.0 );
|
||||
|
||||
GL11.glColor4f( 1, 1, 1, 1 );
|
||||
Tessellator.instance.setColorOpaque_F( 1, 1, 1 );
|
||||
|
||||
BusRenderHelper.instance.setBounds( 0, 0, 0, 1, 1, 1 );
|
||||
BusRenderHelper.instance.setTexture( null );
|
||||
BusRenderHelper.instance.setInvColor( 0xffffff );
|
||||
renderer.blockAccess = ClientHelper.proxy.getWorld();
|
||||
|
||||
if ( item.getItem() instanceof IFacadeItem )
|
||||
{
|
||||
IFacadeItem fi = (IFacadeItem) item.getItem();
|
||||
IFacadePart fp = fi.createPartFromItemStack( item, ForgeDirection.SOUTH );
|
||||
|
||||
if ( fp != null )
|
||||
fp.renderInventory( BusRenderHelper.instance, renderer );
|
||||
}
|
||||
else
|
||||
getRenderer( item, (IPartItem) item.getItem() ).renderInventory( BusRenderHelper.instance, renderer );
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package appeng.client.render;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ItemRenderer implements IItemRenderer
|
||||
{
|
||||
|
||||
public static final ItemRenderer instance = new ItemRenderer();
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
if ( type == ItemRenderType.ENTITY )
|
||||
GL11.glTranslatef( -0.5f, -0.5f, -0.5f );
|
||||
if ( type == ItemRenderType.INVENTORY )
|
||||
GL11.glTranslatef( 0.0f, -0.1f, 0.0f );
|
||||
WorldRender.instance.renderItemBlock( item );
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,499 @@
|
|||
package appeng.client.render;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class RenderBlocksWorkaround extends RenderBlocks
|
||||
{
|
||||
|
||||
public boolean calculations = true;
|
||||
public EnumSet<ForgeDirection> faces = EnumSet.allOf( ForgeDirection.class );
|
||||
|
||||
private Icon rXPos = null;
|
||||
private Icon rXNeg = null;
|
||||
private Icon rYPos = null;
|
||||
private Icon rYNeg = null;
|
||||
private Icon rZPos = null;
|
||||
private Icon rZNeg = null;
|
||||
|
||||
private boolean isAO = false;
|
||||
|
||||
private int bXPos = 0;
|
||||
private int bXNeg = 0;
|
||||
private int bYPos = 0;
|
||||
private int bYNeg = 0;
|
||||
private int bZPos = 0;
|
||||
private int bZNeg = 0;
|
||||
|
||||
private int aoXPos[] = new int[4];
|
||||
private int aoXNeg[] = new int[4];
|
||||
private int aoYPos[] = new int[4];
|
||||
private int aoYNeg[] = new int[4];
|
||||
private int aoZPos[] = new int[4];
|
||||
private int aoZNeg[] = new int[4];
|
||||
|
||||
private float foXPos[] = new float[12];
|
||||
private float foXNeg[] = new float[12];
|
||||
private float foYPos[] = new float[12];
|
||||
private float foYNeg[] = new float[12];
|
||||
private float foZPos[] = new float[12];
|
||||
private float foZNeg[] = new float[12];
|
||||
|
||||
public boolean isFacade = false;
|
||||
|
||||
Field fBrightness;
|
||||
|
||||
public int getCurrentBrightness()
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( fBrightness == null )
|
||||
{
|
||||
fBrightness = Tessellator.class.getDeclaredField( "brightness" );
|
||||
fBrightness.setAccessible( true );
|
||||
}
|
||||
return (Integer) fBrightness.get( Tessellator.instance );
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setTexture(Icon ico)
|
||||
{
|
||||
rXPos = rXNeg = rYPos = rYNeg = rZPos = rZNeg = ico;
|
||||
}
|
||||
|
||||
public boolean renderStandardBlockNoCalculations(Block b, int x, int y, int z)
|
||||
{
|
||||
Tessellator.instance.setBrightness( bXPos );
|
||||
restoreAO( aoXPos, foXPos );
|
||||
renderFaceXPos( b, x, y, z, rXPos );
|
||||
|
||||
Tessellator.instance.setBrightness( bXNeg );
|
||||
restoreAO( aoXNeg, foXNeg );
|
||||
renderFaceXNeg( b, x, y, z, rXNeg );
|
||||
|
||||
Tessellator.instance.setBrightness( bYPos );
|
||||
restoreAO( aoYPos, foYPos );
|
||||
renderFaceYPos( b, x, y, z, rYPos );
|
||||
|
||||
Tessellator.instance.setBrightness( bYNeg );
|
||||
restoreAO( aoYNeg, foYNeg );
|
||||
renderFaceYNeg( b, x, y, z, rYNeg );
|
||||
|
||||
Tessellator.instance.setBrightness( bZPos );
|
||||
restoreAO( aoZPos, foZPos );
|
||||
renderFaceZPos( b, x, y, z, rZPos );
|
||||
|
||||
Tessellator.instance.setBrightness( bZNeg );
|
||||
restoreAO( aoZNeg, foZNeg );
|
||||
renderFaceZNeg( b, x, y, z, rZNeg );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void restoreAO(int[] z, float[] c)
|
||||
{
|
||||
brightnessBottomLeft = z[0];
|
||||
brightnessBottomRight = z[1];
|
||||
brightnessTopLeft = z[2];
|
||||
brightnessTopRight = z[3];
|
||||
|
||||
colorRedTopLeft = c[0];
|
||||
colorGreenTopLeft = c[1];
|
||||
colorBlueTopLeft = c[2];
|
||||
colorRedBottomLeft = c[3];
|
||||
colorGreenBottomLeft = c[4];
|
||||
colorBlueBottomLeft = c[5];
|
||||
colorRedBottomRight = c[6];
|
||||
colorGreenBottomRight = c[7];
|
||||
colorBlueBottomRight = c[8];
|
||||
colorRedTopRight = c[9];
|
||||
colorGreenTopRight = c[10];
|
||||
colorBlueTopRight = c[11];
|
||||
}
|
||||
|
||||
private void saveAO(int[] z, float[] c)
|
||||
{
|
||||
z[0] = brightnessBottomLeft;
|
||||
z[1] = brightnessBottomRight;
|
||||
z[2] = brightnessTopLeft;
|
||||
z[3] = brightnessTopRight;
|
||||
|
||||
c[0] = colorRedTopLeft;
|
||||
c[1] = colorGreenTopLeft;
|
||||
c[2] = colorBlueTopLeft;
|
||||
c[3] = colorRedBottomLeft;
|
||||
c[4] = colorGreenBottomLeft;
|
||||
c[5] = colorBlueBottomLeft;
|
||||
c[6] = colorRedBottomRight;
|
||||
c[7] = colorGreenBottomRight;
|
||||
c[8] = colorBlueBottomRight;
|
||||
c[9] = colorRedTopRight;
|
||||
c[10] = colorGreenTopRight;
|
||||
c[11] = colorBlueTopRight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderStandardBlock(Block par1Block, int par2, int par3, int par4)
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( calculations )
|
||||
return super.renderStandardBlock( par1Block, par2, par3, par4 );
|
||||
else
|
||||
{
|
||||
enableAO = isAO;
|
||||
return renderStandardBlockNoCalculations( par1Block, par2, par3, par4 );
|
||||
}
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
t.printStackTrace();
|
||||
// meh
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXNeg(Block par1Block, double par2, double par4, double par6, Icon par8Icon)
|
||||
{
|
||||
if ( faces.contains( ForgeDirection.WEST ) )
|
||||
{
|
||||
if ( isFacade )
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
double d3 = (double) par8Icon.getInterpolatedU( this.renderMinZ * 16.0D );
|
||||
double d4 = (double) par8Icon.getInterpolatedU( this.renderMaxZ * 16.0D );
|
||||
double d5 = (double) par8Icon.getInterpolatedV( 16.0D - this.renderMaxY * 16.0D );
|
||||
double d6 = (double) par8Icon.getInterpolatedV( 16.0D - this.renderMinY * 16.0D );
|
||||
|
||||
double d11 = par2 + this.renderMinX;
|
||||
double d12 = par4 + this.renderMinY;
|
||||
double d13 = par4 + this.renderMaxY;
|
||||
double d14 = par6 + this.renderMinZ;
|
||||
double d15 = par6 + this.renderMaxZ;
|
||||
|
||||
if ( this.enableAO )
|
||||
{
|
||||
partialLightingColoring( renderMaxY, renderMaxZ );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d4, d5 );
|
||||
partialLightingColoring( renderMaxY, renderMinZ );
|
||||
tessellator.addVertexWithUV( d11, d13, d14, d3, d5 );
|
||||
partialLightingColoring( renderMinY, renderMinZ );
|
||||
tessellator.addVertexWithUV( d11, d12, d14, d3, d6 );
|
||||
partialLightingColoring( renderMinY, renderMaxZ );
|
||||
tessellator.addVertexWithUV( d11, d12, d15, d4, d6 );
|
||||
}
|
||||
else
|
||||
{
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d4, d5 );
|
||||
tessellator.addVertexWithUV( d11, d13, d14, d3, d5 );
|
||||
tessellator.addVertexWithUV( d11, d12, d14, d3, d6 );
|
||||
tessellator.addVertexWithUV( d11, d12, d15, d4, d6 );
|
||||
}
|
||||
}
|
||||
else
|
||||
super.renderFaceXNeg( par1Block, par2, par4, par6, par8Icon );
|
||||
}
|
||||
else
|
||||
{
|
||||
isAO = enableAO;
|
||||
rXNeg = par8Icon;
|
||||
saveAO( aoXNeg, foXNeg );
|
||||
bXNeg = getCurrentBrightness();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXPos(Block par1Block, double par2, double par4, double par6, Icon par8Icon)
|
||||
{
|
||||
if ( faces.contains( ForgeDirection.EAST ) )
|
||||
{
|
||||
if ( isFacade )
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
double d3 = (double) par8Icon.getInterpolatedU( this.renderMinZ * 16.0D );
|
||||
double d4 = (double) par8Icon.getInterpolatedU( this.renderMaxZ * 16.0D );
|
||||
double d5 = (double) par8Icon.getInterpolatedV( 16.0D - this.renderMaxY * 16.0D );
|
||||
double d6 = (double) par8Icon.getInterpolatedV( 16.0D - this.renderMinY * 16.0D );
|
||||
|
||||
double d11 = par2 + this.renderMaxX;
|
||||
double d12 = par4 + this.renderMinY;
|
||||
double d13 = par4 + this.renderMaxY;
|
||||
double d14 = par6 + this.renderMinZ;
|
||||
double d15 = par6 + this.renderMaxZ;
|
||||
|
||||
if ( this.enableAO )
|
||||
{
|
||||
partialLightingColoring( 1.0 - renderMinY, renderMaxZ );
|
||||
tessellator.addVertexWithUV( d11, d12, d15, d4, d6 );
|
||||
partialLightingColoring( 1.0 - renderMinY, renderMinZ );
|
||||
tessellator.addVertexWithUV( d11, d12, d14, d3, d6 );
|
||||
partialLightingColoring( 1.0 - renderMaxY, renderMinZ );
|
||||
tessellator.addVertexWithUV( d11, d13, d14, d3, d5 );
|
||||
partialLightingColoring( 1.0 - renderMaxY, renderMaxZ );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d4, d5 );
|
||||
}
|
||||
else
|
||||
{
|
||||
tessellator.addVertexWithUV( d11, d12, d15, d4, d6 );
|
||||
tessellator.addVertexWithUV( d11, d12, d14, d3, d6 );
|
||||
tessellator.addVertexWithUV( d11, d13, d14, d3, d5 );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d4, d5 );
|
||||
}
|
||||
}
|
||||
else
|
||||
super.renderFaceXPos( par1Block, par2, par4, par6, par8Icon );
|
||||
}
|
||||
else
|
||||
{
|
||||
isAO = enableAO;
|
||||
rXPos = par8Icon;
|
||||
saveAO( aoXPos, foXPos );
|
||||
bXPos = getCurrentBrightness();
|
||||
}
|
||||
}
|
||||
|
||||
private void partialLightingColoring(double u, double v)
|
||||
{
|
||||
double rA = colorRedTopLeft * u + (1.0 - u) * colorRedTopRight;
|
||||
double rB = colorRedBottomLeft * u + (1.0 - u) * colorRedBottomRight;
|
||||
float r = (float) (rA * v + rB * (1.0 - v));
|
||||
|
||||
double gA = colorGreenTopLeft * u + (1.0 - u) * colorGreenTopRight;
|
||||
double gB = colorGreenBottomLeft * u + (1.0 - u) * colorGreenBottomRight;
|
||||
float g = (float) (gA * v + gB * (1.0 - v));
|
||||
|
||||
double bA = colorBlueTopLeft * u + (1.0 - u) * colorBlueTopRight;
|
||||
double bB = colorBlueBottomLeft * u + (1.0 - u) * colorBlueBottomRight;
|
||||
float b = (float) (bA * v + bB * (1.0 - v));
|
||||
|
||||
double highA = (brightnessTopLeft >> 16 & 255) * u + (1.0 - u) * (brightnessTopRight >> 16 & 255);
|
||||
double highB = (brightnessBottomLeft >> 16 & 255) * u + (1.0 - u) * (brightnessBottomRight >> 16 & 255);
|
||||
int high = ((int) (highA * v + highB * (1.0 - v))) & 255;
|
||||
|
||||
double lowA = ((brightnessTopLeft & 255)) * u + (1.0 - u) * ((brightnessTopRight & 255));
|
||||
double lowB = ((brightnessBottomLeft & 255)) * u + (1.0 - u) * ((brightnessBottomRight & 255));
|
||||
int low = ((int) (lowA * v + lowB * (1.0 - v))) & 255;
|
||||
|
||||
int out = (high << 16) | low;
|
||||
|
||||
Tessellator.instance.setColorOpaque_F( r, g, b );
|
||||
Tessellator.instance.setBrightness( out );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYNeg(Block par1Block, double par2, double par4, double par6, Icon par8Icon)
|
||||
{
|
||||
if ( faces.contains( ForgeDirection.DOWN ) )
|
||||
{
|
||||
if ( isFacade )
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
double d3 = (double) par8Icon.getInterpolatedU( this.renderMinX * 16.0D );
|
||||
double d4 = (double) par8Icon.getInterpolatedU( this.renderMaxX * 16.0D );
|
||||
double d5 = (double) par8Icon.getInterpolatedV( this.renderMinZ * 16.0D );
|
||||
double d6 = (double) par8Icon.getInterpolatedV( this.renderMaxZ * 16.0D );
|
||||
|
||||
double d11 = par2 + this.renderMinX;
|
||||
double d12 = par2 + this.renderMaxX;
|
||||
double d13 = par4 + this.renderMinY;
|
||||
double d14 = par6 + this.renderMinZ;
|
||||
double d15 = par6 + this.renderMaxZ;
|
||||
|
||||
if ( this.enableAO )
|
||||
{
|
||||
partialLightingColoring( 1.0 - renderMinX, renderMaxZ );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d3, d6 );
|
||||
partialLightingColoring( 1.0 - renderMinX, renderMinZ );
|
||||
tessellator.addVertexWithUV( d11, d13, d14, d3, d5 );
|
||||
partialLightingColoring( 1.0 - renderMaxX, renderMinZ );
|
||||
tessellator.addVertexWithUV( d12, d13, d14, d4, d5 );
|
||||
partialLightingColoring( 1.0 - renderMaxX, renderMaxZ );
|
||||
tessellator.addVertexWithUV( d12, d13, d15, d4, d6 );
|
||||
}
|
||||
else
|
||||
{
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d3, d6 );
|
||||
tessellator.addVertexWithUV( d11, d13, d14, d3, d5 );
|
||||
tessellator.addVertexWithUV( d12, d13, d14, d4, d5 );
|
||||
tessellator.addVertexWithUV( d12, d13, d15, d4, d6 );
|
||||
}
|
||||
}
|
||||
else
|
||||
super.renderFaceYNeg( par1Block, par2, par4, par6, par8Icon );
|
||||
}
|
||||
else
|
||||
{
|
||||
isAO = enableAO;
|
||||
rYNeg = par8Icon;
|
||||
saveAO( aoYNeg, foYNeg );
|
||||
bYNeg = getCurrentBrightness();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYPos(Block par1Block, double par2, double par4, double par6, Icon par8Icon)
|
||||
{
|
||||
if ( faces.contains( ForgeDirection.UP ) )
|
||||
{
|
||||
if ( isFacade )
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
double d3 = (double) par8Icon.getInterpolatedU( this.renderMinX * 16.0D );
|
||||
double d4 = (double) par8Icon.getInterpolatedU( this.renderMaxX * 16.0D );
|
||||
double d5 = (double) par8Icon.getInterpolatedV( this.renderMinZ * 16.0D );
|
||||
double d6 = (double) par8Icon.getInterpolatedV( this.renderMaxZ * 16.0D );
|
||||
|
||||
double d11 = par2 + this.renderMinX;
|
||||
double d12 = par2 + this.renderMaxX;
|
||||
double d13 = par4 + this.renderMaxY;
|
||||
double d14 = par6 + this.renderMinZ;
|
||||
double d15 = par6 + this.renderMaxZ;
|
||||
|
||||
if ( this.enableAO )
|
||||
{
|
||||
partialLightingColoring( this.renderMaxX, renderMaxZ );
|
||||
tessellator.addVertexWithUV( d12, d13, d15, d4, d6 );
|
||||
partialLightingColoring( this.renderMaxX, renderMinZ );
|
||||
tessellator.addVertexWithUV( d12, d13, d14, d4, d5 );
|
||||
partialLightingColoring( this.renderMinX, renderMinZ );
|
||||
tessellator.addVertexWithUV( d11, d13, d14, d3, d5 );
|
||||
partialLightingColoring( this.renderMinX, renderMaxZ );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d3, d6 );
|
||||
}
|
||||
else
|
||||
{
|
||||
tessellator.addVertexWithUV( d12, d13, d15, d3, d6 );
|
||||
tessellator.addVertexWithUV( d12, d13, d14, d3, d5 );
|
||||
tessellator.addVertexWithUV( d11, d13, d14, d4, d5 );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d4, d6 );
|
||||
}
|
||||
}
|
||||
else
|
||||
super.renderFaceYPos( par1Block, par2, par4, par6, par8Icon );
|
||||
}
|
||||
else
|
||||
{
|
||||
isAO = enableAO;
|
||||
rYPos = par8Icon;
|
||||
saveAO( aoYPos, foYPos );
|
||||
bYPos = getCurrentBrightness();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZNeg(Block par1Block, double par2, double par4, double par6, Icon par8Icon)
|
||||
{
|
||||
if ( faces.contains( ForgeDirection.NORTH ) )
|
||||
{
|
||||
if ( isFacade )
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
double d3 = (double) par8Icon.getInterpolatedU( this.renderMinX * 16.0D );
|
||||
double d4 = (double) par8Icon.getInterpolatedU( this.renderMaxX * 16.0D );
|
||||
double d5 = (double) par8Icon.getInterpolatedV( 16.0D - this.renderMaxY * 16.0D );
|
||||
double d6 = (double) par8Icon.getInterpolatedV( 16.0D - this.renderMinY * 16.0D );
|
||||
|
||||
double d11 = par2 + this.renderMinX;
|
||||
double d12 = par2 + this.renderMaxX;
|
||||
double d13 = par4 + this.renderMinY;
|
||||
double d14 = par4 + this.renderMaxY;
|
||||
double d15 = par6 + this.renderMinZ;
|
||||
|
||||
if ( this.enableAO )
|
||||
{
|
||||
partialLightingColoring( renderMaxY, 1.0 - renderMinX );
|
||||
tessellator.addVertexWithUV( d11, d14, d15, d3, d5 );
|
||||
partialLightingColoring( renderMaxY, 1.0 - renderMaxX );
|
||||
tessellator.addVertexWithUV( d12, d14, d15, d4, d5 );
|
||||
partialLightingColoring( renderMinY, 1.0 - renderMaxX );
|
||||
tessellator.addVertexWithUV( d12, d13, d15, d4, d6 );
|
||||
partialLightingColoring( renderMinY, 1.0 - renderMinX );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d3, d6 );
|
||||
}
|
||||
else
|
||||
{
|
||||
tessellator.addVertexWithUV( d11, d14, d15, d3, d5 );
|
||||
tessellator.addVertexWithUV( d12, d14, d15, d4, d5 );
|
||||
tessellator.addVertexWithUV( d12, d13, d15, d4, d6 );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d3, d6 );
|
||||
}
|
||||
}
|
||||
else
|
||||
super.renderFaceZNeg( par1Block, par2, par4, par6, par8Icon );
|
||||
}
|
||||
else
|
||||
{
|
||||
isAO = enableAO;
|
||||
rZNeg = par8Icon;
|
||||
saveAO( aoZNeg, foZNeg );
|
||||
bZNeg = getCurrentBrightness();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZPos(Block par1Block, double par2, double par4, double par6, Icon par8Icon)
|
||||
{
|
||||
if ( faces.contains( ForgeDirection.SOUTH ) )
|
||||
{
|
||||
if ( isFacade )
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
double d3 = (double) par8Icon.getInterpolatedU( this.renderMinX * 16.0D );
|
||||
double d4 = (double) par8Icon.getInterpolatedU( this.renderMaxX * 16.0D );
|
||||
double d5 = (double) par8Icon.getInterpolatedV( 16.0D - this.renderMaxY * 16.0D );
|
||||
double d6 = (double) par8Icon.getInterpolatedV( 16.0D - this.renderMinY * 16.0D );
|
||||
|
||||
double d11 = par2 + this.renderMinX;
|
||||
double d12 = par2 + this.renderMaxX;
|
||||
double d13 = par4 + this.renderMinY;
|
||||
double d14 = par4 + this.renderMaxY;
|
||||
double d15 = par6 + this.renderMaxZ;
|
||||
|
||||
if ( this.enableAO )
|
||||
{
|
||||
partialLightingColoring( 1.0 - renderMinX, renderMaxY );
|
||||
tessellator.addVertexWithUV( d11, d14, d15, d3, d5 );
|
||||
partialLightingColoring( 1.0 - renderMinX, renderMinY );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d3, d6 );
|
||||
partialLightingColoring( 1.0 - renderMaxX, renderMinY );
|
||||
tessellator.addVertexWithUV( d12, d13, d15, d4, d6 );
|
||||
partialLightingColoring( 1.0 - renderMaxX, renderMaxY );
|
||||
tessellator.addVertexWithUV( d12, d14, d15, d4, d5 );
|
||||
}
|
||||
else
|
||||
{
|
||||
tessellator.addVertexWithUV( d11, d14, d15, d3, d5 );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d3, d6 );
|
||||
tessellator.addVertexWithUV( d12, d13, d15, d4, d6 );
|
||||
tessellator.addVertexWithUV( d12, d14, d15, d4, d5 );
|
||||
}
|
||||
}
|
||||
else
|
||||
super.renderFaceZPos( par1Block, par2, par4, par6, par8Icon );
|
||||
}
|
||||
else
|
||||
{
|
||||
isAO = enableAO;
|
||||
rZPos = par8Icon;
|
||||
saveAO( aoZPos, foZPos );
|
||||
bZPos = getCurrentBrightness();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package appeng.client.render;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
public class TESRWrapper extends TileEntitySpecialRenderer
|
||||
{
|
||||
|
||||
final public RenderBlocks rbinstance = new RenderBlocks();
|
||||
|
||||
final BaseBlockRender blkRender;
|
||||
final double MAX_DISTANCE;
|
||||
|
||||
public TESRWrapper(BaseBlockRender render) {
|
||||
blkRender = render;
|
||||
MAX_DISTANCE = blkRender.getTesrRenderDistance();
|
||||
}
|
||||
|
||||
@Override
|
||||
final public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f)
|
||||
{
|
||||
if ( Math.abs( x ) > MAX_DISTANCE || Math.abs( y ) > MAX_DISTANCE || Math.abs( z ) > MAX_DISTANCE )
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
Block b = te.getBlockType();
|
||||
Tessellator tess = Tessellator.instance;
|
||||
if ( tess.isDrawing )
|
||||
return;
|
||||
|
||||
if ( b instanceof AEBaseBlock && te instanceof AEBaseTile )
|
||||
{
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
|
||||
rbinstance.blockAccess = te.worldObj;
|
||||
blkRender.renderTile( (AEBaseBlock) b, (AEBaseTile) te, tess, x, y, z, f, rbinstance );
|
||||
|
||||
if ( tess.isDrawing )
|
||||
throw new RuntimeException( "Error durring rendering." );
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
FMLLog.severe( "Hi, Looks like there was a crash while rendering something..." );
|
||||
t.printStackTrace();
|
||||
FMLLog.severe( "MC will now crash ( probobly )!" );
|
||||
throw new RuntimeException( t );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package appeng.client.render;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class WorldRender implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
|
||||
private RenderBlocks renderer = new RenderBlocks();
|
||||
final int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
public static final WorldRender instance = new WorldRender();
|
||||
|
||||
public HashMap<AEBaseBlock, BaseBlockRender> blockRenders = new HashMap();
|
||||
|
||||
void setRender(AEBaseBlock in, BaseBlockRender r)
|
||||
{
|
||||
blockRenders.put( in, r );
|
||||
}
|
||||
|
||||
private WorldRender() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
// wtf is this for?
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
AEBaseBlock blk = (AEBaseBlock) block;
|
||||
renderer.setRenderBoundsFromBlock( block );
|
||||
return getRender( blk ).renderInWorld( blk, world, x, y, z, renderer );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
return renderID;
|
||||
}
|
||||
|
||||
public void renderItemBlock(ItemStack item)
|
||||
{
|
||||
AEBaseBlock block = (AEBaseBlock) Block.blocksList[item.itemID];
|
||||
renderer.setRenderBoundsFromBlock( block );
|
||||
getRender( block ).renderInventory( block, item, renderer );
|
||||
}
|
||||
|
||||
private BaseBlockRender getRender(AEBaseBlock block)
|
||||
{
|
||||
return block.getRendererInstance().rendererInstance;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.block.misc.BlockCharger;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class RenderBlockCharger extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderBlockCharger() {
|
||||
super( true, 30 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer)
|
||||
{
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
renderer.renderAllFaces = true;
|
||||
setInvRenderBounds( renderer, 6, 1, 0, 10, 15, 2 );
|
||||
renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, tess, 0xffffff, renderer );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcons( ExtraTextures.BlockChargerInside.getIcon(), null, null, null, null, null );
|
||||
|
||||
setInvRenderBounds( renderer, 2, 0, 2, 14, 3, 14 );
|
||||
renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, tess, 0xffffff, renderer );
|
||||
|
||||
setInvRenderBounds( renderer, 3, 3, 3, 13, 4, 13 );
|
||||
renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, tess, 0xffffff, renderer );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcons( null, ExtraTextures.BlockChargerInside.getIcon(), null, null, null, null );
|
||||
|
||||
setInvRenderBounds( renderer, 2, 13, 2, 14, 16, 14 );
|
||||
renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, tess, 0xffffff, renderer );
|
||||
|
||||
setInvRenderBounds( renderer, 3, 12, 3, 13, 13, 13 );
|
||||
renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, tess, 0xffffff, renderer );
|
||||
|
||||
renderer.renderAllFaces = false;
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
preRenderInWorld( block, world, x, y, z, renderer );
|
||||
|
||||
BlockCharger blk = (BlockCharger) block;
|
||||
|
||||
IOrientable te = getOrientable( block, world, x, y, z );
|
||||
|
||||
ForgeDirection fdy = te.getUp();
|
||||
ForgeDirection fdz = te.getForward();
|
||||
ForgeDirection fdx = Platform.crossProduct( fdz, fdy ).getOpposite();
|
||||
|
||||
renderer.renderAllFaces = true;
|
||||
renderBlockBounds( renderer, 6, 1, 0, 10, 15, 2, fdx, fdy, fdz );
|
||||
boolean out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcons( ExtraTextures.BlockChargerInside.getIcon(), null, null, null, null, null );
|
||||
|
||||
renderBlockBounds( renderer, 2, 0, 2, 14, 3, 14, fdx, fdy, fdz );
|
||||
out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
|
||||
renderBlockBounds( renderer, 3, 3, 3, 13, 4, 13, fdx, fdy, fdz );
|
||||
out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcons( null, ExtraTextures.BlockChargerInside.getIcon(), null, null, null, null );
|
||||
|
||||
renderBlockBounds( renderer, 2, 13, 2, 14, 16, 14, fdx, fdy, fdz );
|
||||
out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
|
||||
renderBlockBounds( renderer, 3, 12, 3, 13, 13, 13, fdx, fdy, fdz );
|
||||
out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
|
||||
renderer.renderAllFaces = false;
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
postRenderInWorld( renderer );
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile(AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer)
|
||||
{
|
||||
ItemStack sis = null;
|
||||
if ( tile instanceof IInventory )
|
||||
sis = ((IInventory) tile).getStackInSlot( 0 );
|
||||
|
||||
if ( sis != null )
|
||||
{
|
||||
applyTESRRotation( x, y, z, tile.getForward(), tile.getUp() );
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
try
|
||||
{
|
||||
GL11.glTranslatef( 0.5f, 0.45f, 0.5f );
|
||||
GL11.glScalef( 1.0f / 1.1f, 1.0f / 1.1f, 1.0f / 1.1f );
|
||||
GL11.glScalef( 1.0f, 1.0f, 1.0f );
|
||||
|
||||
int k = sis.itemID;
|
||||
if ( sis.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( Block.blocksList[k].getRenderType() ) )
|
||||
{
|
||||
GL11.glRotatef( 25.0f, 1.0f, 0.0f, 0.0f );
|
||||
GL11.glRotatef( 15.0f, 0.0f, 1.0f, 0.0f );
|
||||
GL11.glRotatef( 30.0f, 0.0f, 1.0f, 0.0f );
|
||||
}
|
||||
|
||||
int light = tile.worldObj.getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 );
|
||||
int br = light;// << 20 | light << 4;
|
||||
int var11 = br % 65536;
|
||||
int var12 = br / 65536;
|
||||
OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11, var12 );
|
||||
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
GL11.glDisable( GL12.GL_RESCALE_NORMAL );
|
||||
tess.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
|
||||
|
||||
doRenderItem( sis, tile );
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
err.printStackTrace();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
import appeng.tile.networking.TileController;
|
||||
|
||||
public class RenderBlockController extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderBlockController() {
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
|
||||
boolean xx = world.getBlockTileEntity( x - 1, y, z ) instanceof TileController && world.getBlockTileEntity( x + 1, y, z ) instanceof TileController;
|
||||
boolean yy = world.getBlockTileEntity( x, y - 1, z ) instanceof TileController && world.getBlockTileEntity( x, y + 1, z ) instanceof TileController;
|
||||
boolean zz = world.getBlockTileEntity( x, y, z - 1 ) instanceof TileController && world.getBlockTileEntity( x, y, z + 1 ) instanceof TileController;
|
||||
|
||||
int meta = world.getBlockMetadata( x, y, z );
|
||||
boolean hasPower = meta > 0;
|
||||
boolean isConflict = meta == 2;
|
||||
|
||||
ExtraTextures lights = null;
|
||||
|
||||
if ( xx && !yy && !zz )
|
||||
{
|
||||
if ( hasPower )
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraTextures.BlockControllerColumnPowered.getIcon() );
|
||||
if ( isConflict )
|
||||
lights = ExtraTextures.BlockControllerColumnConflict;
|
||||
else
|
||||
lights = ExtraTextures.BlockControllerColumnLights;
|
||||
}
|
||||
else
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraTextures.BlockControllerColumn.getIcon() );
|
||||
|
||||
renderer.uvRotateEast = 1;
|
||||
renderer.uvRotateWest = 1;
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
}
|
||||
else if ( !xx && yy && !zz )
|
||||
{
|
||||
if ( hasPower )
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraTextures.BlockControllerColumnPowered.getIcon() );
|
||||
if ( isConflict )
|
||||
lights = ExtraTextures.BlockControllerColumnConflict;
|
||||
else
|
||||
lights = ExtraTextures.BlockControllerColumnLights;
|
||||
}
|
||||
else
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraTextures.BlockControllerColumn.getIcon() );
|
||||
|
||||
renderer.uvRotateEast = 0;
|
||||
renderer.uvRotateNorth = 0;
|
||||
}
|
||||
else if ( !xx && !yy && zz )
|
||||
{
|
||||
if ( hasPower )
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraTextures.BlockControllerColumnPowered.getIcon() );
|
||||
if ( isConflict )
|
||||
lights = ExtraTextures.BlockControllerColumnConflict;
|
||||
else
|
||||
lights = ExtraTextures.BlockControllerColumnLights;
|
||||
}
|
||||
else
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraTextures.BlockControllerColumn.getIcon() );
|
||||
|
||||
renderer.uvRotateNorth = 1;
|
||||
renderer.uvRotateSouth = 1;
|
||||
renderer.uvRotateTop = 0;
|
||||
}
|
||||
else if ( (xx ? 1 : 0) + (yy ? 1 : 0) + (zz ? 1 : 0) >= 2 )
|
||||
{
|
||||
int v = (Math.abs( x ) + Math.abs( y ) + Math.abs( z )) % 2;
|
||||
renderer.uvRotateEast = renderer.uvRotateBottom = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
|
||||
if ( v == 0 )
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraTextures.BlockControllerInsideA.getIcon() );
|
||||
else
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraTextures.BlockControllerInsideB.getIcon() );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( hasPower )
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraTextures.BlockControllerPowered.getIcon() );
|
||||
if ( isConflict )
|
||||
lights = ExtraTextures.BlockControllerConflict;
|
||||
else
|
||||
lights = ExtraTextures.BlockControllerLights;
|
||||
}
|
||||
else
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
}
|
||||
|
||||
boolean out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
if ( lights != null )
|
||||
{
|
||||
Tessellator.instance.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
|
||||
Tessellator.instance.setBrightness( 14 << 20 | 14 << 4 );
|
||||
renderer.renderFaceXNeg( blk, x, y, z, lights.getIcon() );
|
||||
renderer.renderFaceXPos( blk, x, y, z, lights.getIcon() );
|
||||
renderer.renderFaceYNeg( blk, x, y, z, lights.getIcon() );
|
||||
renderer.renderFaceYPos( blk, x, y, z, lights.getIcon() );
|
||||
renderer.renderFaceZNeg( blk, x, y, z, lights.getIcon() );
|
||||
renderer.renderFaceZPos( blk, x, y, z, lights.getIcon() );
|
||||
}
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
renderer.uvRotateEast = renderer.uvRotateBottom = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
return out;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.grindstone.TileCrank;
|
||||
|
||||
public class RenderBlockCrank extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderBlockCrank() {
|
||||
super( true, 60 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer)
|
||||
{
|
||||
renderer.renderAllFaces = true;
|
||||
|
||||
renderer.setRenderBounds( 0.5D - 0.05, 0.5D - 0.5, 0.5D - 0.05, 0.5D + 0.05, 0.5D + 0.3, 0.5D + 0.05 );
|
||||
super.renderInventory( blk, is, renderer );
|
||||
|
||||
renderer.setRenderBounds( 0.70D - 0.15, 0.75D - 0.05, 0.5D - 0.05, 0.70D + 0.28, 0.75D + 0.05, 0.5D + 0.05 );
|
||||
super.renderInventory( blk, is, renderer );
|
||||
|
||||
renderer.renderAllFaces = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile(AEBaseBlock blk, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks rbinstance)
|
||||
{
|
||||
TileCrank tc = (TileCrank) tile;
|
||||
if ( tc.getUp() == null || tc.getUp() == ForgeDirection.UNKNOWN )
|
||||
return;
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.locationBlocksTexture );
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
if ( Minecraft.isAmbientOcclusionEnabled() )
|
||||
GL11.glShadeModel( GL11.GL_SMOOTH );
|
||||
else
|
||||
GL11.glShadeModel( GL11.GL_FLAT );
|
||||
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
|
||||
applyTESRRotation( x, y, z, tile.getForward(), tile.getUp() );
|
||||
|
||||
GL11.glTranslated( 0.5, 0, 0.5 );
|
||||
GL11.glRotatef( tc.visibleRotation, 0, 1, 0 );
|
||||
GL11.glTranslated( -0.5, 0, -0.5 );
|
||||
|
||||
tess.setTranslation( -tc.xCoord, -tc.yCoord, -tc.zCoord );
|
||||
tess.startDrawingQuads();
|
||||
rbinstance.renderAllFaces = true;
|
||||
rbinstance.blockAccess = tc.worldObj;
|
||||
|
||||
rbinstance.setRenderBounds( 0.5D - 0.05, 0.5D - 0.5, 0.5D - 0.05, 0.5D + 0.05, 0.5D + 0.1, 0.5D + 0.05 );
|
||||
|
||||
rbinstance.renderStandardBlock( blk, tc.xCoord, tc.yCoord, tc.zCoord );
|
||||
|
||||
rbinstance.setRenderBounds( 0.70D - 0.15, 0.55D - 0.05, 0.5D - 0.05, 0.70D + 0.15, 0.55D + 0.05, 0.5D + 0.05 );
|
||||
|
||||
rbinstance.renderStandardBlock( blk, tc.xCoord, tc.yCoord, tc.zCoord );
|
||||
|
||||
tess.draw();
|
||||
tess.setTranslation( 0, 0, 0 );
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import appeng.api.implementations.IAEItemPowerStorage;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
|
||||
public class RenderBlockEnergyCube extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderBlockEnergyCube() {
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer)
|
||||
{
|
||||
IAEItemPowerStorage myItem = (IAEItemPowerStorage) is.getItem();
|
||||
double internalCurrentPower = myItem.getAECurrentPower( is );
|
||||
double internalMaxPower = myItem.getAEMaxPower( is );
|
||||
|
||||
int meta = (int) (8.0 * (internalCurrentPower / internalMaxPower));
|
||||
|
||||
if ( meta > 7 )
|
||||
meta = 7;
|
||||
if ( meta < 0 )
|
||||
meta = 0;
|
||||
|
||||
renderer.setOverrideBlockTexture( blk.getIcon( 0, meta ) );
|
||||
super.renderInventory( blk, is, renderer );
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
int meta = world.getBlockMetadata( x, y, z );
|
||||
|
||||
renderer.overrideBlockTexture = blk.getIcon( 0, meta );
|
||||
boolean out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.overrideBlockTexture = null;
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,247 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BlockRenderInfo;
|
||||
import appeng.client.texture.CableBusTextures;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
import appeng.client.texture.OffsetIcon;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class RenderBlockWireless extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderBlockWireless() {
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer)
|
||||
{
|
||||
this.blk = blk;
|
||||
cenx = 0;
|
||||
ceny = 0;
|
||||
cenz = 0;
|
||||
hasChan = false;
|
||||
hasPower = false;
|
||||
BlockRenderInfo ri = blk.getRendererInstance();
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
renderer.renderAllFaces = true;
|
||||
|
||||
Icon r = CableBusTextures.PartMonitorSidesStatus.getIcon();
|
||||
ri.setTemporaryRenderIcons( r, r, CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), r, r );
|
||||
renderBlockBounds( renderer, 5, 5, 0, 11, 11, 1, ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, tess, 0xffffff, renderer );
|
||||
|
||||
r = CableBusTextures.PartMonitorSides.getIcon();
|
||||
ri.setTemporaryRenderIcons( r, r, ExtraTextures.BlockChargerInside.getIcon(), ExtraTextures.BlockChargerInside.getIcon(), r, r );
|
||||
renderBlockBounds( renderer, 5, 5, 1, 11, 11, 2, ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, tess, 0xffffff, renderer );
|
||||
|
||||
tess.startDrawingQuads();
|
||||
ri.setTemporaryRenderIcon( null );
|
||||
renderTorchAtAngle( renderer, ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
super.postRenderInWorld( renderer );
|
||||
tess.draw();
|
||||
|
||||
ri.setTemporaryRenderIcons( r, r, ExtraTextures.BlockChargerInside.getIcon(), ExtraTextures.BlockChargerInside.getIcon(), r, r );
|
||||
|
||||
ForgeDirection sides[] = new ForgeDirection[] { ForgeDirection.EAST, ForgeDirection.WEST, ForgeDirection.UP, ForgeDirection.DOWN };
|
||||
|
||||
int s = 1;
|
||||
|
||||
for (ForgeDirection side : sides)
|
||||
{
|
||||
renderBlockBounds( renderer, 8 + (side.offsetX != 0 ? side.offsetX * 2 : -2), 8 + (side.offsetY != 0 ? side.offsetY * 2 : -2), 2
|
||||
+ (side.offsetZ != 0 ? side.offsetZ * 2 : -1) + s, 8 + (side.offsetX != 0 ? side.offsetX * 4 : 2),
|
||||
8 + (side.offsetY != 0 ? side.offsetY * 4 : 2), 2 + (side.offsetZ != 0 ? side.offsetZ * 5 : 1) + s, ForgeDirection.EAST, ForgeDirection.UP,
|
||||
ForgeDirection.SOUTH );
|
||||
renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, tess, 0xffffff, renderer );
|
||||
}
|
||||
|
||||
s = 3;
|
||||
for (ForgeDirection side : sides)
|
||||
{
|
||||
renderBlockBounds( renderer, 8 + (side.offsetX != 0 ? side.offsetX * 4 : -1), 8 + (side.offsetY != 0 ? side.offsetY * 4 : -1), 1
|
||||
+ (side.offsetZ != 0 ? side.offsetZ * 4 : -1) + s, 8 + (side.offsetX != 0 ? side.offsetX * 5 : 1),
|
||||
8 + (side.offsetY != 0 ? side.offsetY * 5 : 1), 2 + (side.offsetZ != 0 ? side.offsetZ * 5 : 1) + s, ForgeDirection.EAST, ForgeDirection.UP,
|
||||
ForgeDirection.SOUTH );
|
||||
|
||||
renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, tess, 0xffffff, renderer );
|
||||
}
|
||||
}
|
||||
|
||||
int cenx = 0;
|
||||
int ceny = 0;
|
||||
int cenz = 0;
|
||||
AEBaseBlock blk;
|
||||
boolean hasChan = false;
|
||||
boolean hasPower = false;
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
TileWireless tw = blk.getTileEntity( world, x, y, z );
|
||||
this.blk = blk;
|
||||
if ( tw != null )
|
||||
{
|
||||
hasChan = (tw.clientFlags & (TileWireless.POWERED_FLAG | TileWireless.CHANNEL_FLAG)) == (TileWireless.POWERED_FLAG | TileWireless.CHANNEL_FLAG);
|
||||
hasPower = (tw.clientFlags & TileWireless.POWERED_FLAG) == TileWireless.POWERED_FLAG;
|
||||
|
||||
BlockRenderInfo ri = blk.getRendererInstance();
|
||||
|
||||
ForgeDirection fdy = tw.getUp();
|
||||
ForgeDirection fdz = tw.getForward();
|
||||
ForgeDirection fdx = Platform.crossProduct( fdz, fdy ).getOpposite();
|
||||
|
||||
renderer.renderAllFaces = true;
|
||||
|
||||
Icon r = CableBusTextures.PartMonitorSidesStatus.getIcon();
|
||||
ri.setTemporaryRenderIcons( r, r, CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), r, r );
|
||||
renderBlockBounds( renderer, 5, 5, 0, 11, 11, 1, fdx, fdy, fdz );
|
||||
super.renderInWorld( blk, world, x, y, z, renderer );
|
||||
|
||||
r = CableBusTextures.PartMonitorSides.getIcon();
|
||||
ri.setTemporaryRenderIcons( r, r, ExtraTextures.BlockChargerInside.getIcon(), ExtraTextures.BlockChargerInside.getIcon(), r, r );
|
||||
renderBlockBounds( renderer, 5, 5, 1, 11, 11, 2, fdx, fdy, fdz );
|
||||
super.renderInWorld( blk, world, x, y, z, renderer );
|
||||
|
||||
cenx = x;
|
||||
ceny = y;
|
||||
cenz = z;
|
||||
ri.setTemporaryRenderIcon( null );
|
||||
|
||||
renderTorchAtAngle( renderer, fdx, fdy, fdz );
|
||||
super.postRenderInWorld( renderer );
|
||||
|
||||
ri.setTemporaryRenderIcons( r, r, ExtraTextures.BlockChargerInside.getIcon(), ExtraTextures.BlockChargerInside.getIcon(), r, r );
|
||||
|
||||
ForgeDirection sides[] = new ForgeDirection[] { ForgeDirection.EAST, ForgeDirection.WEST, ForgeDirection.UP, ForgeDirection.DOWN };
|
||||
|
||||
int s = 1;
|
||||
|
||||
for (ForgeDirection side : sides)
|
||||
{
|
||||
renderBlockBounds( renderer, 8 + (side.offsetX != 0 ? side.offsetX * 2 : -2), 8 + (side.offsetY != 0 ? side.offsetY * 2 : -2), 2
|
||||
+ (side.offsetZ != 0 ? side.offsetZ * 2 : -1) + s, 8 + (side.offsetX != 0 ? side.offsetX * 4 : 2),
|
||||
8 + (side.offsetY != 0 ? side.offsetY * 4 : 2), 2 + (side.offsetZ != 0 ? side.offsetZ * 5 : 1) + s, fdx, fdy, fdz );
|
||||
super.renderInWorld( blk, world, x, y, z, renderer );
|
||||
}
|
||||
|
||||
s = 3;
|
||||
for (ForgeDirection side : sides)
|
||||
{
|
||||
renderBlockBounds( renderer, 8 + (side.offsetX != 0 ? side.offsetX * 4 : -1), 8 + (side.offsetY != 0 ? side.offsetY * 4 : -1), 1
|
||||
+ (side.offsetZ != 0 ? side.offsetZ * 4 : -1) + s, 8 + (side.offsetX != 0 ? side.offsetX * 5 : 1),
|
||||
8 + (side.offsetY != 0 ? side.offsetY * 5 : 1), 2 + (side.offsetZ != 0 ? side.offsetZ * 5 : 1) + s, fdx, fdy, fdz );
|
||||
super.renderInWorld( blk, world, x, y, z, renderer );
|
||||
}
|
||||
|
||||
r = CableBusTextures.PartMonitorSidesStatusLights.getIcon();
|
||||
// ri.setTemporaryRenderIcons( r, r, ExtraTextures.BlockChargerInside.getIcon(),
|
||||
// ExtraTextures.BlockChargerInside.getIcon(), r, r );
|
||||
renderBlockBounds( renderer, 5, 5, 0, 11, 11, 1, fdx, fdy, fdz );
|
||||
|
||||
if ( hasChan )
|
||||
{
|
||||
int l = 14;
|
||||
Tessellator.instance.setBrightness( l << 20 | l << 4 );
|
||||
Tessellator.instance.setColorOpaque_I( AEColor.Transparent.blackVariant );
|
||||
}
|
||||
else if ( hasPower )
|
||||
{
|
||||
int l = 9;
|
||||
Tessellator.instance.setBrightness( l << 20 | l << 4 );
|
||||
Tessellator.instance.setColorOpaque_I( AEColor.Transparent.whiteVariant );
|
||||
}
|
||||
else
|
||||
{
|
||||
Tessellator.instance.setBrightness( 0 );
|
||||
Tessellator.instance.setColorOpaque_I( 0x000000 );
|
||||
}
|
||||
|
||||
if ( ForgeDirection.UP != fdz.getOpposite() )
|
||||
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.UP );
|
||||
if ( ForgeDirection.DOWN != fdz.getOpposite() )
|
||||
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.DOWN );
|
||||
if ( ForgeDirection.EAST != fdz.getOpposite() )
|
||||
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.EAST );
|
||||
if ( ForgeDirection.WEST != fdz.getOpposite() )
|
||||
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.WEST );
|
||||
if ( ForgeDirection.SOUTH != fdz.getOpposite() )
|
||||
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.SOUTH );
|
||||
if ( ForgeDirection.NORTH != fdz.getOpposite() )
|
||||
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.NORTH );
|
||||
|
||||
ri.setTemporaryRenderIcon( null );
|
||||
renderer.renderAllFaces = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void renderTorchAtAngle(RenderBlocks renderer, ForgeDirection x, ForgeDirection y, ForgeDirection z)
|
||||
{
|
||||
Icon r = (hasChan ? CableBusTextures.BlockWirelessOn.getIcon() : blk.getIcon( 0, 0 ));
|
||||
Icon sides = new OffsetIcon( r, 0.0f, -2.0f );
|
||||
|
||||
switch (z)
|
||||
{
|
||||
case DOWN:
|
||||
renderer.uvRotateNorth = 3;
|
||||
renderer.uvRotateSouth = 3;
|
||||
renderer.uvRotateEast = 3;
|
||||
renderer.uvRotateWest = 3;
|
||||
break;
|
||||
case EAST:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 2;
|
||||
renderer.uvRotateEast = 2;
|
||||
renderer.uvRotateWest = 1;
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
renderer.uvRotateNorth = 2;
|
||||
renderer.uvRotateSouth = 1;
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.uvRotateTop = 3;
|
||||
renderer.uvRotateBottom = 3;
|
||||
renderer.uvRotateNorth = 1;
|
||||
renderer.uvRotateSouth = 2;
|
||||
break;
|
||||
case WEST:
|
||||
renderer.uvRotateTop = 2;
|
||||
renderer.uvRotateBottom = 1;
|
||||
renderer.uvRotateEast = 1;
|
||||
renderer.uvRotateWest = 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( 0xffffff );
|
||||
renderBlockBounds( renderer, 0, 7, 1, 16, 9, 16, x, y, z );
|
||||
renderFace( cenx, ceny, cenz, blk, sides, renderer, y );
|
||||
renderFace( cenx, ceny, cenz, blk, sides, renderer, y.getOpposite() );
|
||||
|
||||
renderBlockBounds( renderer, 7, 0, 1, 9, 16, 16, x, y, z );
|
||||
renderFace( cenx, ceny, cenz, blk, sides, renderer, x );
|
||||
renderFace( cenx, ceny, cenz, blk, sides, renderer, x.getOpposite() );
|
||||
|
||||
renderBlockBounds( renderer, 7, 7, 1, 9, 9, 10.6, x, y, z );
|
||||
renderFace( cenx, ceny, cenz, blk, r, renderer, z );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
|
||||
public class RenderCable extends BaseBlockRender
|
||||
{
|
||||
|
||||
public void renderCableAt(double Thickness, IBlockAccess world, int x, int y, int z, AEBaseBlock block, RenderBlocks renderer, Icon texture, double pull,
|
||||
EnumSet<ForgeDirection> connections)
|
||||
{
|
||||
|
||||
if ( connections.contains( ForgeDirection.UNKNOWN ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.5D - Thickness, 0.5D + Thickness, 0.5D + Thickness, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.WEST ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.0D, 0.5D - Thickness, 0.5D - Thickness, 0.5D - Thickness - pull, 0.5D + Thickness, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.EAST ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D + Thickness + pull, 0.5D - Thickness, 0.5D - Thickness, 1.0D, 0.5D + Thickness, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.NORTH ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.0D, 0.5D + Thickness, 0.5D + Thickness, 0.5D - Thickness - pull );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.SOUTH ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.5D + Thickness + pull, 0.5D + Thickness, 0.5D + Thickness, 1.0D );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.DOWN ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.0D, 0.5D - Thickness, 0.5D + Thickness, 0.5D - Thickness - pull, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.UP ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.5D + Thickness + pull, 0.5D - Thickness, 0.5D + Thickness, 1.0D, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,308 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
import appeng.tile.storage.TileDrive;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class RenderDrive extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderDrive() {
|
||||
super( false, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer)
|
||||
{
|
||||
renderer.overrideBlockTexture = ExtraTextures.getMissing();
|
||||
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, Tessellator.instance, 0x000000, renderer );
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
super.renderInventory( block, is, renderer );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
TileDrive sp = imb.getTileEntity( world, x, y, z );
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
ForgeDirection up = sp.getUp();
|
||||
ForgeDirection forward = sp.getForward();
|
||||
ForgeDirection west = Platform.crossProduct( forward, up );
|
||||
|
||||
boolean result = super.renderInWorld( imb, world, x, y, z, renderer );
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
Icon ico = ExtraTextures.MEStorageCellTextures.getIcon();
|
||||
|
||||
int b = world.getLightBrightnessForSkyBlocks( x + forward.offsetX, y + forward.offsetY, z + forward.offsetZ, 0 );
|
||||
|
||||
for (int yy = 0; yy < 5; yy++)
|
||||
{
|
||||
for (int xx = 0; xx < 2; xx++)
|
||||
{
|
||||
int stat = sp.getCellStatus( yy * 2 + (1 - xx) );
|
||||
selectFace( renderer, west, up, forward, 2 + xx * 7, 7 + xx * 7, 1 + yy * 3, 3 + yy * 3 );
|
||||
|
||||
int spin = 0;
|
||||
|
||||
switch (forward.offsetX + forward.offsetY * 2 + forward.offsetZ * 3)
|
||||
{
|
||||
case 1:
|
||||
switch (up)
|
||||
{
|
||||
case UP:
|
||||
spin = 3;
|
||||
break;
|
||||
case DOWN:
|
||||
spin = 1;
|
||||
break;
|
||||
case NORTH:
|
||||
spin = 0;
|
||||
break;
|
||||
case SOUTH:
|
||||
spin = 2;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
switch (up)
|
||||
{
|
||||
case UP:
|
||||
spin = 1;
|
||||
break;
|
||||
case DOWN:
|
||||
spin = 3;
|
||||
break;
|
||||
case NORTH:
|
||||
spin = 0;
|
||||
break;
|
||||
case SOUTH:
|
||||
spin = 2;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
case -2:
|
||||
switch (up)
|
||||
{
|
||||
case EAST:
|
||||
spin = 1;
|
||||
break;
|
||||
case WEST:
|
||||
spin = 3;
|
||||
break;
|
||||
case NORTH:
|
||||
spin = 2;
|
||||
break;
|
||||
case SOUTH:
|
||||
spin = 0;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch (up)
|
||||
{
|
||||
case EAST:
|
||||
spin = 1;
|
||||
break;
|
||||
case WEST:
|
||||
spin = 3;
|
||||
break;
|
||||
case NORTH:
|
||||
spin = 0;
|
||||
break;
|
||||
case SOUTH:
|
||||
spin = 0;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch (up)
|
||||
{
|
||||
case UP:
|
||||
spin = 2;
|
||||
break;
|
||||
case DOWN:
|
||||
spin = 0;
|
||||
break;
|
||||
case EAST:
|
||||
spin = 3;
|
||||
break;
|
||||
case WEST:
|
||||
spin = 1;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
case -3:
|
||||
switch (up)
|
||||
{
|
||||
case UP:
|
||||
spin = 2;
|
||||
break;
|
||||
case DOWN:
|
||||
spin = 0;
|
||||
break;
|
||||
case EAST:
|
||||
spin = 1;
|
||||
break;
|
||||
case WEST:
|
||||
spin = 3;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
double u1 = ico.getInterpolatedU( (spin % 4 < 2) ? 1 : 6 );
|
||||
double u2 = ico.getInterpolatedU( ((spin + 1) % 4 < 2) ? 1 : 6 );
|
||||
double u3 = ico.getInterpolatedU( ((spin + 2) % 4 < 2) ? 1 : 6 );
|
||||
double u4 = ico.getInterpolatedU( ((spin + 3) % 4 < 2) ? 1 : 6 );
|
||||
|
||||
int m = 1;
|
||||
int mx = 3;
|
||||
if ( stat == 0 )
|
||||
{
|
||||
m = 4;
|
||||
mx = 5;
|
||||
}
|
||||
|
||||
double v1 = ico.getInterpolatedV( ((spin + 1) % 4 < 2) ? m : mx );
|
||||
double v2 = ico.getInterpolatedV( ((spin + 2) % 4 < 2) ? m : mx );
|
||||
double v3 = ico.getInterpolatedV( ((spin + 3) % 4 < 2) ? m : mx );
|
||||
double v4 = ico.getInterpolatedV( ((spin + 0) % 4 < 2) ? m : mx );
|
||||
|
||||
tess.setBrightness( b );
|
||||
tess.setColorOpaque_I( 0xffffff );
|
||||
switch (forward.offsetX + forward.offsetY * 2 + forward.offsetZ * 3)
|
||||
{
|
||||
case 1:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case -1:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case -2:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case 2:
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case 3:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
|
||||
break;
|
||||
case -3:
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( (forward == ForgeDirection.UP && up == ForgeDirection.SOUTH) || forward == ForgeDirection.DOWN )
|
||||
selectFace( renderer, west, up, forward, 3 + xx * 7, 4 + xx * 7, 1 + yy * 3, 2 + yy * 3 );
|
||||
else
|
||||
selectFace( renderer, west, up, forward, 5 + xx * 7, 6 + xx * 7, 2 + yy * 3, 3 + yy * 3 );
|
||||
|
||||
if ( stat != 0 )
|
||||
{
|
||||
Icon wico = ExtraTextures.White.getIcon();
|
||||
u1 = wico.getInterpolatedU( (spin % 4 < 2) ? 1 : 6 );
|
||||
u2 = wico.getInterpolatedU( ((spin + 1) % 4 < 2) ? 1 : 6 );
|
||||
u3 = wico.getInterpolatedU( ((spin + 2) % 4 < 2) ? 1 : 6 );
|
||||
u4 = wico.getInterpolatedU( ((spin + 3) % 4 < 2) ? 1 : 6 );
|
||||
|
||||
v1 = wico.getInterpolatedV( ((spin + 1) % 4 < 2) ? 1 : 3 );
|
||||
v2 = wico.getInterpolatedV( ((spin + 2) % 4 < 2) ? 1 : 3 );
|
||||
v3 = wico.getInterpolatedV( ((spin + 3) % 4 < 2) ? 1 : 3 );
|
||||
v4 = wico.getInterpolatedV( ((spin + 0) % 4 < 2) ? 1 : 3 );
|
||||
|
||||
if ( sp.isPowered() )
|
||||
tess.setBrightness( 15 << 20 | 15 << 4 );
|
||||
else
|
||||
tess.setBrightness( 0 );
|
||||
|
||||
if ( stat == 1 )
|
||||
Tessellator.instance.setColorOpaque_I( 0x00ff00 );
|
||||
if ( stat == 2 )
|
||||
Tessellator.instance.setColorOpaque_I( 0xffaa00 );
|
||||
if ( stat == 3 )
|
||||
Tessellator.instance.setColorOpaque_I( 0xff0000 );
|
||||
|
||||
switch (forward.offsetX + forward.offsetY * 2 + forward.offsetZ * 3)
|
||||
{
|
||||
case 1:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case -1:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case -2:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case 2:
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case 3:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
|
||||
break;
|
||||
case -3:
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
import appeng.client.texture.FlipableIcon;
|
||||
import appeng.client.texture.OffsetIcon;
|
||||
import appeng.tile.storage.TileChest;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class RenderMEChest extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderMEChest() {
|
||||
super( false, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer)
|
||||
{
|
||||
renderer.overrideBlockTexture = ExtraTextures.getMissing();
|
||||
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, Tessellator.instance, 0x000000, renderer );
|
||||
|
||||
renderer.overrideBlockTexture = ExtraTextures.MEChest.getIcon();
|
||||
this.renderInvBlock( EnumSet.of( ForgeDirection.UP ), block, Tessellator.instance, 0xffffff, renderer );
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
super.renderInventory( block, is, renderer );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
TileChest sp = imb.getTileEntity( world, x, y, z );
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
ForgeDirection up = sp.getUp();
|
||||
ForgeDirection forward = sp.getForward();
|
||||
ForgeDirection west = Platform.crossProduct( forward, up );
|
||||
|
||||
preRenderInWorld( imb, world, x, y, z, renderer );
|
||||
|
||||
int stat = sp.getCellStatus( 0 );
|
||||
boolean result = renderer.renderStandardBlock( imb, x, y, z );
|
||||
|
||||
selectFace( renderer, west, up, forward, 5, 16 - 5, 9, 12 );
|
||||
|
||||
int offsetU = -4;
|
||||
int offsetV = 8;
|
||||
if ( stat == 0 )
|
||||
offsetV = 3;
|
||||
|
||||
int b = world.getLightBrightnessForSkyBlocks( x + forward.offsetX, y + forward.offsetY, z + forward.offsetZ, 0 );
|
||||
Tessellator.instance.setBrightness( b );
|
||||
Tessellator.instance.setColorOpaque_I( 0xffffff );
|
||||
|
||||
FlipableIcon fico = new FlipableIcon( new OffsetIcon( ExtraTextures.MEStorageCellTextures.getIcon(), offsetU, offsetV ) );
|
||||
if ( forward == ForgeDirection.EAST && (up == ForgeDirection.NORTH || up == ForgeDirection.SOUTH) )
|
||||
fico.setFlip( true, false );
|
||||
else if ( forward == ForgeDirection.NORTH && up == ForgeDirection.EAST )
|
||||
fico.setFlip( false, true );
|
||||
else if ( forward == ForgeDirection.NORTH && up == ForgeDirection.WEST )
|
||||
fico.setFlip( true, false );
|
||||
else if ( forward == ForgeDirection.DOWN && up == ForgeDirection.EAST )
|
||||
fico.setFlip( false, true );
|
||||
else if ( forward == ForgeDirection.DOWN )
|
||||
fico.setFlip( true, false );
|
||||
|
||||
renderFace( x, y, z, imb, fico, renderer, forward );
|
||||
|
||||
if ( stat != 0 )
|
||||
{
|
||||
b = 0;
|
||||
if ( sp.isPowered() )
|
||||
{
|
||||
b = 15 << 20 | 15 << 4;
|
||||
}
|
||||
|
||||
Tessellator.instance.setBrightness( b );
|
||||
if ( stat == 1 )
|
||||
Tessellator.instance.setColorOpaque_I( 0x00ff00 );
|
||||
if ( stat == 2 )
|
||||
Tessellator.instance.setColorOpaque_I( 0xffaa00 );
|
||||
if ( stat == 3 )
|
||||
Tessellator.instance.setColorOpaque_I( 0xff0000 );
|
||||
selectFace( renderer, west, up, forward, 9, 10, 11, 12 );
|
||||
renderFace( x, y, z, imb, ExtraTextures.White.getIcon(), renderer, forward );
|
||||
}
|
||||
|
||||
b = world.getLightBrightnessForSkyBlocks( x + up.offsetX, y + up.offsetY, z + up.offsetZ, 0 );
|
||||
if ( sp.isPowered() )
|
||||
{
|
||||
b = 15 << 20 | 15 << 4;
|
||||
}
|
||||
|
||||
Tessellator.instance.setBrightness( b );
|
||||
Tessellator.instance.setColorOpaque_I( 0xffffff );
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
ICellHandler ch = AEApi.instance().registries().cell().getHander( sp.getStorageType() );
|
||||
Icon ico = ch == null ? null : ch.getTopTexture();
|
||||
renderFace( x, y, z, imb, ico == null ? ExtraTextures.MEChest.getIcon() : ico, renderer, up );
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
postRenderInWorld( renderer );
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
|
||||
public class RenderNull extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderNull() {
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
|
||||
public class RenderQNB extends RenderCable
|
||||
{
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack item, RenderBlocks renderer)
|
||||
{
|
||||
float px = 2.0f / 16.0f;
|
||||
float maxpx = 14.0f / 16.0f;
|
||||
renderer.setRenderBounds( px, px, px, maxpx, maxpx, maxpx );
|
||||
|
||||
super.renderInventory( block, item, renderer );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
TileQuantumBridge tqb = block.getTileEntity( world, x, y, z );
|
||||
if ( tqb == null )
|
||||
return false;
|
||||
|
||||
renderer.renderAllFaces = true;
|
||||
|
||||
if ( tqb.getBlockType() == AEApi.instance().blocks().blockQuantumLink.block() )
|
||||
{
|
||||
if ( tqb.isFormed() )
|
||||
{
|
||||
EnumSet<ForgeDirection> sides = EnumSet.allOf( ForgeDirection.class );
|
||||
renderCableAt( 0.11D, world, x, y, z, block, renderer, block.getIcon( 0, 0 ), 0.141D, sides );
|
||||
renderCableAt( 0.188D, world, x, y, z, block, renderer, block.getIcon( 0, 0 ), 0.1875D,
|
||||
EnumSet.complementOf( EnumSet.of( ForgeDirection.UNKNOWN ) ) );
|
||||
}
|
||||
|
||||
float px = 2.0f / 16.0f;
|
||||
float maxpx = 14.0f / 16.0f;
|
||||
renderer.setRenderBounds( px, px, px, maxpx, maxpx, maxpx );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
// super.renderWorldBlock(world, x, y, z, block, modelId, renderer);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !tqb.isFormed() )
|
||||
{
|
||||
float px = 2.0f / 16.0f;
|
||||
float maxpx = 14.0f / 16.0f;
|
||||
renderer.setRenderBounds( px, px, px, maxpx, maxpx, maxpx );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
else if ( tqb.isCorner() )
|
||||
{
|
||||
// renderCableAt(0.11D, world, x, y, z, block, modelId, renderer,
|
||||
// AppEngTextureRegistry.Blocks.MECable.get(), true, 0.0D);
|
||||
renderCableAt( 0.188D, world, x, y, z, block, renderer, ExtraTextures.BlockInterfaceAlternate.getIcon(), 0.05D,
|
||||
EnumSet.complementOf( EnumSet.of( ForgeDirection.UNKNOWN ) ) );
|
||||
|
||||
float px = 4.0f / 16.0f;
|
||||
float maxpx = 12.0f / 16.0f;
|
||||
|
||||
renderer.setRenderBounds( px, px, px, maxpx, maxpx, maxpx );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
|
||||
if ( tqb.isPowered() )
|
||||
{
|
||||
|
||||
px = 3.9f / 16.0f;
|
||||
maxpx = 12.1f / 16.0f;
|
||||
renderer.setRenderBounds( px, px, px, maxpx, maxpx, maxpx );
|
||||
|
||||
int bn = 15;
|
||||
Tessellator.instance.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
|
||||
Tessellator.instance.setBrightness( bn << 20 | bn << 4 );
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
renderFace( x, y, z, block, block.getIcon( 0, 0 ), renderer, side );
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float px = 2.0f / 16.0f;
|
||||
float maxpx = 14.0f / 16.0f;
|
||||
renderer.setRenderBounds( 0, px, px, 1, maxpx, maxpx );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
|
||||
renderer.setRenderBounds( px, 0, px, maxpx, 1, maxpx );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
|
||||
renderer.setRenderBounds( px, px, 0, maxpx, maxpx, 1 );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
|
||||
if ( tqb.isPowered() )
|
||||
{
|
||||
px = -0.01f / 16.0f;
|
||||
maxpx = 16.01f / 16.0f;
|
||||
renderer.setRenderBounds( px, px, px, maxpx, maxpx, maxpx );
|
||||
|
||||
int bn = 15;
|
||||
Tessellator.instance.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
|
||||
Tessellator.instance.setBrightness( bn << 20 | bn << 4 );
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
renderFace( x, y, z, block, block.getIcon( 0, 0 ), renderer, side );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
renderer.renderAllFaces = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
|
||||
public class RenderQuartzGlass extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderQuartzGlass() {
|
||||
super( false, 0 );
|
||||
}
|
||||
|
||||
boolean isFlush(AEBaseBlock imb, IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return isGlass( imb, world, x, y, z );
|
||||
}
|
||||
|
||||
boolean isGlass(AEBaseBlock imb, IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return world.getBlockId( x, y, z ) == AEApi.instance().blocks().blockQuartzGlass.block().blockID
|
||||
|| world.getBlockId( x, y, z ) == AEApi.instance().blocks().blockQuartzVibrantGlass.block().blockID;
|
||||
}
|
||||
|
||||
void renderEdge(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer, ForgeDirection side, ForgeDirection direction)
|
||||
{
|
||||
if ( !isFlush( imb, world, x + side.offsetX, y + side.offsetY, z + side.offsetZ ) )
|
||||
{
|
||||
if ( !isFlush( imb, world, x + direction.offsetX, y + direction.offsetY, z + direction.offsetZ ) )
|
||||
{
|
||||
float minX = 0.5f + (side.offsetX + direction.offsetX) / 2.0f;
|
||||
float minY = 0.5f + (side.offsetY + direction.offsetY) / 2.0f;
|
||||
float minZ = 0.5f + (side.offsetZ + direction.offsetZ) / 2.0f;
|
||||
float maxX = 0.5f + (side.offsetX + direction.offsetX) / 2.0f;
|
||||
float maxY = 0.5f + (side.offsetY + direction.offsetY) / 2.0f;
|
||||
float maxZ = 0.5f + (side.offsetZ + direction.offsetZ) / 2.0f;
|
||||
|
||||
if ( 0 == side.offsetX && 0 == direction.offsetX )
|
||||
{
|
||||
minX = 0.0f;
|
||||
maxX = 1.0f;
|
||||
}
|
||||
if ( 0 == side.offsetY && 0 == direction.offsetY )
|
||||
{
|
||||
minY = 0.0f;
|
||||
maxY = 1.0f;
|
||||
}
|
||||
if ( 0 == side.offsetZ && 0 == direction.offsetZ )
|
||||
{
|
||||
minZ = 0.0f;
|
||||
maxZ = 1.0f;
|
||||
}
|
||||
|
||||
if ( maxX <= 0.001f )
|
||||
maxX += 0.9f / 16.0f;
|
||||
if ( maxY <= 0.001f )
|
||||
maxY += 0.9f / 16.0f;
|
||||
if ( maxZ <= 0.001f )
|
||||
maxZ += 0.9f / 16.0f;
|
||||
|
||||
if ( minX >= 0.999f )
|
||||
minX -= 0.9f / 16.0f;
|
||||
if ( minY >= 0.999f )
|
||||
minY -= 0.9f / 16.0f;
|
||||
if ( minZ >= 0.999f )
|
||||
minZ -= 0.9f / 16.0f;
|
||||
|
||||
renderer.setRenderBounds( minX, minY, minZ, maxX, maxY, maxZ );
|
||||
|
||||
switch (side)
|
||||
{
|
||||
case WEST:
|
||||
renderer.renderFaceXNeg( imb, x, y, z, ExtraTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case EAST:
|
||||
renderer.renderFaceXPos( imb, x, y, z, ExtraTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.renderFaceZNeg( imb, x, y, z, ExtraTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.renderFaceZPos( imb, x, y, z, ExtraTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case DOWN:
|
||||
renderer.renderFaceYNeg( imb, x, y, z, ExtraTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case UP:
|
||||
renderer.renderFaceYPos( imb, x, y, z, ExtraTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer)
|
||||
{
|
||||
renderer.overrideBlockTexture = ExtraTextures.GlassFrame.getIcon();
|
||||
super.renderInventory( block, is, renderer );
|
||||
renderer.overrideBlockTexture = null;
|
||||
super.renderInventory( block, is, renderer );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
renderer.overrideBlockTexture = imb.getIcon( 0, 0 );
|
||||
boolean result = renderer.renderStandardBlock( imb, x, y, z );
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.UP, ForgeDirection.EAST );
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.UP, ForgeDirection.WEST );
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.UP, ForgeDirection.NORTH );
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.DOWN, ForgeDirection.EAST );
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.DOWN, ForgeDirection.WEST );
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.DOWN, ForgeDirection.NORTH );
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.DOWN, ForgeDirection.SOUTH );
|
||||
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.EAST, ForgeDirection.UP );
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.EAST, ForgeDirection.DOWN );
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.EAST, ForgeDirection.NORTH );
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.EAST, ForgeDirection.SOUTH );
|
||||
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.WEST, ForgeDirection.UP );
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.WEST, ForgeDirection.DOWN );
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.WEST, ForgeDirection.NORTH );
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.WEST, ForgeDirection.SOUTH );
|
||||
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.NORTH, ForgeDirection.EAST );
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.NORTH, ForgeDirection.WEST );
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.NORTH, ForgeDirection.UP );
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.NORTH, ForgeDirection.DOWN );
|
||||
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.SOUTH, ForgeDirection.EAST );
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.SOUTH, ForgeDirection.WEST );
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.SOUTH, ForgeDirection.UP );
|
||||
renderEdge( imb, world, x, y, z, renderer, ForgeDirection.SOUTH, ForgeDirection.DOWN );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.block.solids.OreQuartz;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
|
||||
public class RenderQuartzOre extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderQuartzOre() {
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer)
|
||||
{
|
||||
super.renderInventory( blk, is, renderer );
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraTextures.OreQuartzStone.getIcon() );
|
||||
super.renderInventory( blk, is, renderer );
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
OreQuartz blk = (OreQuartz) block;
|
||||
blk.enhanceBrightness = true;
|
||||
super.renderInWorld( block, world, x, y, z, renderer );
|
||||
blk.enhanceBrightness = false;
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraTextures.OreQuartzStone.getIcon() );
|
||||
boolean out = super.renderInWorld( block, world, x, y, z, renderer );
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,192 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.block.misc.BlockQuartzTorch;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
|
||||
public class RenderQuartzTorch extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderQuartzTorch() {
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer)
|
||||
{
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
float Point2 = 6.0f / 16.0f;
|
||||
float Point3 = 7.0f / 16.0f;
|
||||
float Point13 = 10.0f / 16.0f;
|
||||
float Point12 = 9.0f / 16.0f;
|
||||
|
||||
float Onepx = 1.0f / 16.0f;
|
||||
float rbottom = 5.0f / 16.0f;
|
||||
float rtop = 10.0f / 16.0f;
|
||||
|
||||
float bottom = 7.0f / 16.0f;
|
||||
float top = 8.0f / 16.0f;
|
||||
|
||||
float xOff = 0.0f;
|
||||
float yOff = 0.0f;
|
||||
float zOff = 0.0f;
|
||||
|
||||
renderer.setRenderBounds( Point3 + xOff, rbottom + yOff, Point3 + zOff, Point12 + xOff, rtop + yOff, Point12 + zOff );
|
||||
renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, tess, 0xffffff, renderer );
|
||||
|
||||
renderer.setRenderBounds( Point3 + xOff, rtop + yOff, Point3 + zOff, Point3 + Onepx + xOff, rtop + Onepx + yOff, Point3 + Onepx + zOff );
|
||||
renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, tess, 0xffffff, renderer );
|
||||
|
||||
renderer.setRenderBounds( Point12 - Onepx + xOff, rbottom - Onepx + yOff, Point12 - Onepx + zOff, Point12 + xOff, rbottom + yOff, Point12 + zOff );
|
||||
|
||||
renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, tess, 0xffffff, renderer );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( Block.hopperBlock.getIcon( 0, 0 ) );
|
||||
renderer.renderAllFaces = true;
|
||||
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point2 + zOff, Point13 + xOff, top + yOff, Point3 + zOff );
|
||||
|
||||
renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, tess, 0xffffff, renderer );
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point12 + zOff, Point13 + xOff, top + yOff, Point13 + zOff );
|
||||
|
||||
renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, tess, 0xffffff, renderer );
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point3 + zOff, Point3 + xOff, top + yOff, Point12 + zOff );
|
||||
|
||||
renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, tess, 0xffffff, renderer );
|
||||
renderer.setRenderBounds( Point12 + xOff, bottom + yOff, Point3 + zOff, Point13 + xOff, top + yOff, Point12 + zOff );
|
||||
|
||||
renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, tess, 0xffffff, renderer );
|
||||
|
||||
renderer.renderAllFaces = false;
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
BlockQuartzTorch blk = (BlockQuartzTorch) block;
|
||||
|
||||
IOrientable te = getOrientable( block, world, x, y, z );
|
||||
|
||||
float Point2 = 6.0f / 16.0f;
|
||||
float Point3 = 7.0f / 16.0f;
|
||||
float Point13 = 10.0f / 16.0f;
|
||||
float Point12 = 9.0f / 16.0f;
|
||||
|
||||
float Onepx = 1.0f / 16.0f;
|
||||
float rbottom = 5.0f / 16.0f;
|
||||
float rtop = 10.0f / 16.0f;
|
||||
|
||||
float bottom = 7.0f / 16.0f;
|
||||
float top = 8.0f / 16.0f;
|
||||
|
||||
float xOff = 0.0f;
|
||||
float yOff = 0.0f;
|
||||
float zOff = 0.0f;
|
||||
|
||||
renderer.renderAllFaces = true;
|
||||
if ( te != null )
|
||||
{
|
||||
ForgeDirection forward = te.getUp();
|
||||
xOff = forward.offsetX * -(4.0f / 16.0f);
|
||||
yOff = forward.offsetY * -(4.0f / 16.0f);
|
||||
zOff = forward.offsetZ * -(4.0f / 16.0f);
|
||||
}
|
||||
|
||||
renderer.setRenderBounds( Point3 + xOff, rbottom + yOff, Point3 + zOff, Point12 + xOff, rtop + yOff, Point12 + zOff );
|
||||
super.renderInWorld( block, world, x, y, z, renderer );
|
||||
|
||||
int r = (x + y + z) % 2;
|
||||
if ( r == 0 )
|
||||
{
|
||||
renderer.setRenderBounds( Point3 + xOff, rtop + yOff, Point3 + zOff, Point3 + Onepx + xOff, rtop + Onepx + yOff, Point3 + Onepx + zOff );
|
||||
super.renderInWorld( block, world, x, y, z, renderer );
|
||||
|
||||
renderer.setRenderBounds( Point12 - Onepx + xOff, rbottom - Onepx + yOff, Point12 - Onepx + zOff, Point12 + xOff, rbottom + yOff, Point12 + zOff );
|
||||
super.renderInWorld( block, world, x, y, z, renderer );
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer.setRenderBounds( Point3 + xOff, rbottom - Onepx + yOff, Point3 + zOff, Point3 + Onepx + xOff, rbottom + yOff, Point3 + Onepx + zOff );
|
||||
super.renderInWorld( block, world, x, y, z, renderer );
|
||||
|
||||
renderer.setRenderBounds( Point12 - Onepx + xOff, rtop + yOff, Point12 - Onepx + zOff, Point12 + xOff, rtop + Onepx + yOff, Point12 + zOff );
|
||||
super.renderInWorld( block, world, x, y, z, renderer );
|
||||
}
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( Block.hopperBlock.getIcon( 0, 0 ) );
|
||||
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point2 + zOff, Point13 + xOff, top + yOff, Point3 + zOff );
|
||||
boolean out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point12 + zOff, Point13 + xOff, top + yOff, Point13 + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point3 + zOff, Point3 + xOff, top + yOff, Point12 + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
|
||||
renderer.setRenderBounds( Point12 + xOff, bottom + yOff, Point3 + zOff, Point13 + xOff, top + yOff, Point12 + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
|
||||
if ( te != null )
|
||||
{
|
||||
ForgeDirection forward = te.getUp();
|
||||
switch (forward)
|
||||
{
|
||||
case EAST:
|
||||
renderer.setRenderBounds( 0, bottom + yOff, bottom + zOff, Point2 + xOff, top + yOff, top + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
break;
|
||||
case WEST:
|
||||
renderer.setRenderBounds( Point13 + xOff, bottom + yOff, bottom + zOff, 1.0, top + yOff, top + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.setRenderBounds( bottom + xOff, bottom + yOff, Point13 + zOff, top + xOff, top + yOff, 1.0 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.setRenderBounds( bottom + xOff, bottom + yOff, 0, top + xOff, top + yOff, Point2 + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
break;
|
||||
case UP:
|
||||
renderer.setRenderBounds( Point2, 0, Point2, Point3, bottom + yOff, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.setRenderBounds( Point2, 0, Point12, Point3, bottom + yOff, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.setRenderBounds( Point12, 0, Point2, Point13, bottom + yOff, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.setRenderBounds( Point12, 0, Point12, Point13, bottom + yOff, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
break;
|
||||
case DOWN:
|
||||
renderer.setRenderBounds( Point2, top + yOff, Point2, Point3, 1.0, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.setRenderBounds( Point2, top + yOff, Point12, Point3, 1.0, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.setRenderBounds( Point12, top + yOff, Point2, Point13, 1.0, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.setRenderBounds( Point12, top + yOff, Point12, Point13, 1.0, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
renderer.renderAllFaces = false;
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,188 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BlockRenderInfo;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
import appeng.tile.spatial.TileSpatialPylon;
|
||||
|
||||
public class RenderSpatialPylon extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderSpatialPylon() {
|
||||
super( false, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer)
|
||||
{
|
||||
renderer.overrideBlockTexture = ExtraTextures.BlockSpatialPylon_dim.getIcon();
|
||||
super.renderInventory( block, is, renderer );
|
||||
renderer.overrideBlockTexture = null;
|
||||
super.renderInventory( block, is, renderer );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
TileSpatialPylon sp = imb.getTileEntity( world, x, y, z );
|
||||
|
||||
int displayBits = sp.getDisplayBits();
|
||||
ForgeDirection ori = ForgeDirection.UNKNOWN;
|
||||
|
||||
if ( displayBits != 0 )
|
||||
{
|
||||
if ( (displayBits & sp.DISPLAY_Z) == sp.DISPLAY_X )
|
||||
{
|
||||
ori = ForgeDirection.EAST;
|
||||
if ( (displayBits & sp.DISPLAY_MIDDLE) == sp.DISPLAY_ENDMAX )
|
||||
{
|
||||
renderer.uvRotateEast = 1;
|
||||
renderer.uvRotateWest = 2;
|
||||
renderer.uvRotateTop = 2;
|
||||
renderer.uvRotateBottom = 1;
|
||||
}
|
||||
else if ( (displayBits & sp.DISPLAY_MIDDLE) == sp.DISPLAY_ENDMIN )
|
||||
{
|
||||
renderer.uvRotateEast = 2;
|
||||
renderer.uvRotateWest = 1;
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer.uvRotateEast = 1;
|
||||
renderer.uvRotateWest = 1;
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
}
|
||||
}
|
||||
|
||||
else if ( (displayBits & sp.DISPLAY_Z) == sp.DISPLAY_Y )
|
||||
{
|
||||
ori = ForgeDirection.UP;
|
||||
if ( (displayBits & sp.DISPLAY_MIDDLE) == sp.DISPLAY_ENDMAX )
|
||||
{
|
||||
renderer.uvRotateNorth = 3;
|
||||
renderer.uvRotateSouth = 3;
|
||||
renderer.uvRotateEast = 3;
|
||||
renderer.uvRotateWest = 3;
|
||||
}
|
||||
}
|
||||
|
||||
else if ( (displayBits & sp.DISPLAY_Z) == sp.DISPLAY_Z )
|
||||
{
|
||||
ori = ForgeDirection.NORTH;
|
||||
if ( (displayBits & sp.DISPLAY_MIDDLE) == sp.DISPLAY_ENDMAX )
|
||||
{
|
||||
renderer.uvRotateSouth = 1;
|
||||
renderer.uvRotateNorth = 2;
|
||||
}
|
||||
else if ( (displayBits & sp.DISPLAY_MIDDLE) == sp.DISPLAY_ENDMIN )
|
||||
{
|
||||
renderer.uvRotateNorth = 1;
|
||||
renderer.uvRotateSouth = 2;
|
||||
renderer.uvRotateTop = 3;
|
||||
renderer.uvRotateBottom = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer.uvRotateNorth = 1;
|
||||
renderer.uvRotateSouth = 2;
|
||||
}
|
||||
}
|
||||
|
||||
BlockRenderInfo bri = imb.getRendererInstance();
|
||||
bri.setTemporaryRenderIcon( null );
|
||||
bri.setTemporaryRenderIcons( getBlockTextureFromSideOutside( imb, sp, displayBits, ori, ForgeDirection.UP ),
|
||||
getBlockTextureFromSideOutside( imb, sp, displayBits, ori, ForgeDirection.DOWN ),
|
||||
getBlockTextureFromSideOutside( imb, sp, displayBits, ori, ForgeDirection.SOUTH ),
|
||||
getBlockTextureFromSideOutside( imb, sp, displayBits, ori, ForgeDirection.NORTH ),
|
||||
getBlockTextureFromSideOutside( imb, sp, displayBits, ori, ForgeDirection.EAST ),
|
||||
getBlockTextureFromSideOutside( imb, sp, displayBits, ori, ForgeDirection.WEST ) );
|
||||
|
||||
boolean r = renderer.renderStandardBlock( imb, x, y, z );
|
||||
|
||||
if ( (displayBits & sp.DISPLAY_POWEREDENABLED) == sp.DISPLAY_POWEREDENABLED )
|
||||
{
|
||||
int bn = 15;
|
||||
Tessellator.instance.setBrightness( bn << 20 | bn << 4 );
|
||||
Tessellator.instance.setColorOpaque_I( 0xffffff );
|
||||
|
||||
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS)
|
||||
renderFace( x, y, z, imb, getBlockTextureFromSideInside( imb, sp, displayBits, ori, d ), renderer, d );
|
||||
}
|
||||
else
|
||||
{
|
||||
bri.setTemporaryRenderIcon( null );
|
||||
bri.setTemporaryRenderIcons( getBlockTextureFromSideInside( imb, sp, displayBits, ori, ForgeDirection.UP ),
|
||||
getBlockTextureFromSideInside( imb, sp, displayBits, ori, ForgeDirection.DOWN ),
|
||||
getBlockTextureFromSideInside( imb, sp, displayBits, ori, ForgeDirection.SOUTH ),
|
||||
getBlockTextureFromSideInside( imb, sp, displayBits, ori, ForgeDirection.NORTH ),
|
||||
getBlockTextureFromSideInside( imb, sp, displayBits, ori, ForgeDirection.EAST ),
|
||||
getBlockTextureFromSideInside( imb, sp, displayBits, ori, ForgeDirection.WEST ) );
|
||||
|
||||
renderer.renderStandardBlock( imb, x, y, z );
|
||||
}
|
||||
|
||||
bri.setTemporaryRenderIcon( null );
|
||||
renderer.uvRotateEast = renderer.uvRotateWest = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateBottom = 0;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
renderer.overrideBlockTexture = imb.getIcon( 0, 0 );
|
||||
boolean result = renderer.renderStandardBlock( imb, x, y, z );
|
||||
|
||||
renderer.overrideBlockTexture = ExtraTextures.BlockSpatialPylon_dim.getIcon();
|
||||
result = renderer.renderStandardBlock( imb, x, y, z );
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
private Icon getBlockTextureFromSideOutside(AEBaseBlock blk, TileSpatialPylon sp, int displayBits, ForgeDirection ori, ForgeDirection dir)
|
||||
{
|
||||
|
||||
if ( ori.equals( dir ) || ori.getOpposite().equals( dir ) )
|
||||
return blk.getRendererInstance().getTexture( dir );
|
||||
|
||||
if ( (displayBits & sp.DISPLAY_MIDDLE) == sp.DISPLAY_MIDDLE )
|
||||
return ExtraTextures.BlockSpatialPylonC.getIcon();
|
||||
|
||||
else if ( (displayBits & sp.DISPLAY_MIDDLE) == sp.DISPLAY_ENDMIN )
|
||||
return ExtraTextures.BlockSpatialPylonE.getIcon();
|
||||
|
||||
else if ( (displayBits & sp.DISPLAY_MIDDLE) == sp.DISPLAY_ENDMAX )
|
||||
return ExtraTextures.BlockSpatialPylonE.getIcon();
|
||||
|
||||
return blk.getIcon( 0, 0 );
|
||||
}
|
||||
|
||||
private Icon getBlockTextureFromSideInside(AEBaseBlock blk, TileSpatialPylon sp, int displayBits, ForgeDirection ori, ForgeDirection dir)
|
||||
{
|
||||
boolean good = (displayBits & sp.DISPLAY_ENABLED) == sp.DISPLAY_ENABLED;
|
||||
|
||||
if ( ori.equals( dir ) || ori.getOpposite().equals( dir ) )
|
||||
return good ? ExtraTextures.BlockSpatialPylon_dim.getIcon() : ExtraTextures.BlockSpatialPylon_red.getIcon();
|
||||
|
||||
if ( (displayBits & sp.DISPLAY_MIDDLE) == sp.DISPLAY_MIDDLE )
|
||||
return good ? ExtraTextures.BlockSpatialPylonC_dim.getIcon() : ExtraTextures.BlockSpatialPylonC_red.getIcon();
|
||||
|
||||
else if ( (displayBits & sp.DISPLAY_MIDDLE) == sp.DISPLAY_ENDMIN )
|
||||
return good ? ExtraTextures.BlockSpatialPylonE_dim.getIcon() : ExtraTextures.BlockSpatialPylonE_red.getIcon();
|
||||
|
||||
else if ( (displayBits & sp.DISPLAY_MIDDLE) == sp.DISPLAY_ENDMAX )
|
||||
return good ? ExtraTextures.BlockSpatialPylonE_dim.getIcon() : ExtraTextures.BlockSpatialPylonE_red.getIcon();
|
||||
|
||||
return blk.getIcon( 0, 0 );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import appeng.api.implementations.IPartStorageMonitor;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
public class RenderStorageMonitor extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderStorageMonitor() {
|
||||
super( true, 30 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile(AEBaseBlock blk, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f,
|
||||
RenderBlocks rinstance)
|
||||
{
|
||||
IPartStorageMonitor monitor = (IPartStorageMonitor) tile;
|
||||
IAEItemStack is = ((IAEItemStack) monitor.getDisplayed());
|
||||
|
||||
if ( is != null && monitor.isPowered() )
|
||||
{
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
||||
|
||||
// applyTESRRotation( x, y, z, monitor.getForward(), monitor.getUp()
|
||||
// );
|
||||
|
||||
GL11.glPushMatrix();
|
||||
try
|
||||
{
|
||||
ItemStack sis = is.getItemStack();
|
||||
sis.stackSize = 1;
|
||||
|
||||
GL11.glTranslatef( 0.0f, -0.05f, -0.25f );
|
||||
GL11.glScalef( 1.0f / 1.5f, 1.0f / 1.5f, 1.0f / 1.5f );
|
||||
GL11.glScalef( 1.0f, -1.0f, 0.005f );
|
||||
|
||||
int k = sis.itemID;
|
||||
Block block = (k < Block.blocksList.length ? Block.blocksList[k] : null);
|
||||
if ( sis.getItemSpriteNumber() == 0 && block != null
|
||||
&& RenderBlocks.renderItemIn3d( Block.blocksList[k].getRenderType() ) )
|
||||
{
|
||||
GL11.glRotatef( 25.0f, 1.0f, 0.0f, 0.0f );
|
||||
GL11.glRotatef( 15.0f, 0.0f, 1.0f, 0.0f );
|
||||
GL11.glRotatef( 30.0f, 0.0f, 1.0f, 0.0f );
|
||||
}
|
||||
int br = 16 << 20 | 16 << 4;
|
||||
int var11 = br % 65536;
|
||||
int var12 = br / 65536;
|
||||
OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11 * 0.8F, var12 * 0.8F );
|
||||
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
GL11.glDisable( GL12.GL_RESCALE_NORMAL );
|
||||
tess.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
|
||||
|
||||
doRenderItem( sis, tile );
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
err.printStackTrace();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glTranslatef( 0.0f, 0.14f, -0.24f );
|
||||
GL11.glScalef( 1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f );
|
||||
|
||||
long qty = is.getStackSize();
|
||||
if ( qty > 999999999999L )
|
||||
qty = 999999999999L;
|
||||
|
||||
String msg = Long.toString( qty );
|
||||
if ( qty > 1000000000 )
|
||||
msg = Long.toString( qty / 1000000000 ) + "B";
|
||||
else if ( qty > 1000000 )
|
||||
msg = Long.toString( qty / 1000000 ) + "M";
|
||||
else if ( qty > 9999 )
|
||||
msg = Long.toString( qty / 1000 ) + "K";
|
||||
|
||||
int width = fr.getStringWidth( msg );
|
||||
GL11.glTranslatef( -0.5f * width, 0.0f, -1.0f );
|
||||
fr.drawString( msg, 0, 0, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
|
||||
public class RenderTinyTNT extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderTinyTNT() {
|
||||
super( false, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer)
|
||||
{
|
||||
renderer.setRenderBounds( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
|
||||
super.renderInventory( block, is, renderer );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
renderer.renderAllFaces = true;
|
||||
renderer.setRenderBounds( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
|
||||
boolean out = super.renderInWorld( imb, world, x, y, z, renderer );
|
||||
renderer.renderAllFaces = false;
|
||||
return out;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package appeng.client.render.blocks;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BusRenderer;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
|
||||
public class RendererCableBus extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RendererCableBus() {
|
||||
super( true, 30 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer)
|
||||
{
|
||||
// nothin.
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
{
|
||||
AEBaseTile t = block.getTileEntity( world, x, y, z );
|
||||
|
||||
if ( t instanceof TileCableBus )
|
||||
{
|
||||
BusRenderer.instance.renderer.renderAllFaces = true;
|
||||
BusRenderer.instance.renderer.blockAccess = renderer.blockAccess;
|
||||
((TileCableBus) t).cb.renderStatic( x, y, z );
|
||||
BusRenderer.instance.renderer.renderAllFaces = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile(AEBaseBlock block, AEBaseTile t, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer)
|
||||
{
|
||||
if ( t instanceof TileCableBus )
|
||||
{
|
||||
((TileCableBus) t).cb.renderDynamic( x, y, z );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package appeng.client.render.effects;
|
||||
|
||||
import net.minecraft.client.particle.EntityReddustFX;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ChargedOreEffect extends EntityReddustFX
|
||||
{
|
||||
|
||||
public ChargedOreEffect(World w, double x, double y, double z, float r, float g, float b) {
|
||||
super( w, x, y, z, 0.21f, 0.61f, 1.0f );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBrightnessForRender(float par1)
|
||||
{
|
||||
int j1 = super.getBrightnessForRender( par1 );
|
||||
j1 = Math.max( j1 >> 20, j1 >> 4 );
|
||||
j1 += 3;
|
||||
if ( j1 > 15 )
|
||||
j1 = 15;
|
||||
return j1 << 20 | j1 << 4;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,199 @@
|
|||
package appeng.client.render.effects;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class LightningEffect extends EntityFX
|
||||
{
|
||||
|
||||
final int steps = 5;
|
||||
static Random rng = new Random();
|
||||
double[][] Steps;
|
||||
|
||||
public LightningEffect(World w, double x, double y, double z, double r, double g, double b) {
|
||||
super( w, x, y, z, r, g, b );
|
||||
Steps = new double[steps][3];
|
||||
motionX = 0;
|
||||
motionY = 0;
|
||||
motionZ = 0;
|
||||
particleMaxAge = 6;
|
||||
|
||||
// particleMaxAge = 269;
|
||||
double lastDirectionX = (rng.nextDouble() - 0.5) * 0.9;
|
||||
double lastDirectionY = (rng.nextDouble() - 0.5) * 0.9;
|
||||
double lastDirectionZ = (rng.nextDouble() - 0.5) * 0.9;
|
||||
for (int s = 0; s < steps; s++)
|
||||
{
|
||||
Steps[s][0] = lastDirectionX = (lastDirectionX + (rng.nextDouble() - 0.5) * 0.9) / 2.0;
|
||||
Steps[s][1] = lastDirectionY = (lastDirectionY + (rng.nextDouble() - 0.5) * 0.9) / 2.0;
|
||||
Steps[s][2] = lastDirectionZ = (lastDirectionZ + (rng.nextDouble() - 0.5) * 0.9) / 2.0;
|
||||
}
|
||||
}
|
||||
|
||||
float currentPoint = 0;
|
||||
|
||||
@Override
|
||||
public int getBrightnessForRender(float par1)
|
||||
{
|
||||
int j1 = 13;
|
||||
return j1 << 20 | j1 << 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(Tessellator tess, float l, float rX, float rY, float rZ, float rYZ, float rXY)
|
||||
{
|
||||
float j = 1.0f;
|
||||
tess.setColorRGBA_F( this.particleRed * j * 0.9f, this.particleGreen * j * 0.95f, this.particleBlue * j, this.particleAlpha );
|
||||
if ( particleAge == 3 )
|
||||
{
|
||||
double lastDirectionX = (rng.nextDouble() - 0.5) * 0.9;
|
||||
double lastDirectionY = (rng.nextDouble() - 0.5) * 0.9;
|
||||
double lastDirectionZ = (rng.nextDouble() - 0.5) * 0.9;
|
||||
for (int s = 0; s < steps; s++)
|
||||
{
|
||||
Steps[s][0] = lastDirectionX = (lastDirectionX + (rng.nextDouble() - 0.5) * 0.9) / 2.0;
|
||||
Steps[s][1] = lastDirectionY = (lastDirectionY + (rng.nextDouble() - 0.5) * 0.9) / 2.0;
|
||||
Steps[s][2] = lastDirectionZ = (lastDirectionZ + (rng.nextDouble() - 0.5) * 0.9) / 2.0;
|
||||
}
|
||||
}
|
||||
double f6 = this.particleTextureIndexX / 16.0;
|
||||
double f7 = f6 + 0.0324375F;
|
||||
double f8 = this.particleTextureIndexY / 16.0;
|
||||
double f9 = f8 + 0.0324375F;
|
||||
|
||||
f6 = f7;
|
||||
f8 = f9;
|
||||
|
||||
double scale = 0.02;// 0.02F * this.particleScale;
|
||||
|
||||
double a[] = new double[3];
|
||||
double b[] = new double[3];
|
||||
|
||||
double ox = 0;
|
||||
double oy = 0;
|
||||
double oz = 0;
|
||||
|
||||
EntityClientPlayerMP p = Minecraft.getMinecraft().thePlayer;
|
||||
double offX = -rZ;
|
||||
double offY = MathHelper.cos( (float) (Math.PI / 2.0f + p.rotationPitch * 0.017453292F) );
|
||||
double offZ = rX;
|
||||
|
||||
for (int layer = 0; layer < 2; layer++)
|
||||
{
|
||||
if ( layer == 0 )
|
||||
{
|
||||
scale = 0.04;
|
||||
offX *= 0.001;
|
||||
offY *= 0.001;
|
||||
offZ *= 0.001;
|
||||
tess.setColorRGBA_F( this.particleRed * j * 0.4f, this.particleGreen * j * 0.25f, this.particleBlue * j * 0.45f, this.particleAlpha );
|
||||
}
|
||||
else
|
||||
{
|
||||
offX = 0;
|
||||
offY = 0;
|
||||
offZ = 0;
|
||||
scale = 0.02;
|
||||
tess.setColorRGBA_F( this.particleRed * j * 0.9f, this.particleGreen * j * 0.65f, this.particleBlue * j * 0.85f, this.particleAlpha );
|
||||
}
|
||||
|
||||
for (int cycle = 0; cycle < 3; cycle++)
|
||||
{
|
||||
clear();
|
||||
|
||||
double x = (this.prevPosX + (this.posX - this.prevPosX) * (double) l - interpPosX) - offX;
|
||||
double y = (this.prevPosY + (this.posY - this.prevPosY) * (double) l - interpPosY) - offY;
|
||||
double z = (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) l - interpPosZ) - offZ;
|
||||
|
||||
for (int s = 0; s < steps; s++)
|
||||
{
|
||||
double xN = x + Steps[s][0];
|
||||
double yN = y + Steps[s][1];
|
||||
double zN = z + Steps[s][2];
|
||||
|
||||
double xD = xN - x;
|
||||
double yD = yN - y;
|
||||
double zD = zN - z;
|
||||
|
||||
if ( cycle == 0 )
|
||||
{
|
||||
ox = (yD * 0) - (1 * zD);
|
||||
oy = (zD * 0) - (0 * xD);
|
||||
oz = (xD * 1) - (0 * yD);
|
||||
}
|
||||
if ( cycle == 1 )
|
||||
{
|
||||
ox = (yD * 1) - (0 * zD);
|
||||
oy = (zD * 0) - (1 * xD);
|
||||
oz = (xD * 0) - (0 * yD);
|
||||
}
|
||||
if ( cycle == 2 )
|
||||
{
|
||||
ox = (yD * 0) - (0 * zD);
|
||||
oy = (zD * 1) - (0 * xD);
|
||||
oz = (xD * 0) - (1 * yD);
|
||||
}
|
||||
|
||||
double ss = Math.sqrt( ox * ox + oy * oy + oz * oz ) / ((((double) steps - (double) s) / (double) steps) * scale);
|
||||
ox /= ss;
|
||||
oy /= ss;
|
||||
oz /= ss;
|
||||
|
||||
a[0] = x + ox;
|
||||
a[1] = y + oy;
|
||||
a[2] = z + oz;
|
||||
|
||||
b[0] = x;
|
||||
b[1] = y;
|
||||
b[2] = z;
|
||||
|
||||
draw( tess, a, b, f6, f8 );
|
||||
|
||||
x = xN;
|
||||
y = yN;
|
||||
z = zN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
GL11.glDisable( GL11.GL_CULL_FACE );
|
||||
tess.draw();
|
||||
GL11.glPopAttrib();
|
||||
tess.startDrawingQuads();
|
||||
}
|
||||
|
||||
boolean hasData = false;
|
||||
double[] I = new double[3];
|
||||
double[] K = new double[3];
|
||||
|
||||
private void draw(Tessellator tess, double[] a, double[] b, double f6, double f8)
|
||||
{
|
||||
if ( hasData )
|
||||
{
|
||||
tess.addVertexWithUV( a[0], a[1], a[2], f6, f8 );
|
||||
tess.addVertexWithUV( I[0], I[1], I[2], f6, f8 );
|
||||
tess.addVertexWithUV( K[0], K[1], K[2], f6, f8 );
|
||||
tess.addVertexWithUV( b[0], b[1], b[2], f6, f8 );
|
||||
}
|
||||
hasData = true;
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
I[x] = a[x];
|
||||
K[x] = b[x];
|
||||
}
|
||||
}
|
||||
|
||||
private void clear()
|
||||
{
|
||||
hasData = false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package appeng.client.render.effects;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityBreakingFX;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.client.texture.ExtraTextures;
|
||||
|
||||
public class MatterCannonEffect extends EntityBreakingFX
|
||||
{
|
||||
|
||||
private Icon particleTextureIndex;
|
||||
|
||||
public MatterCannonEffect(World par1World, double par2, double par4, double par6, Item par8Item) {
|
||||
super( par1World, par2, par4, par6, par8Item );
|
||||
particleGravity = 0;
|
||||
this.particleBlue = 255;
|
||||
this.particleGreen = 255;
|
||||
this.particleRed = 255;
|
||||
this.particleAlpha = 1.4f;
|
||||
this.particleScale = 1.1f;
|
||||
this.motionX = 0.0f;
|
||||
this.motionY = 0.0f;
|
||||
this.motionZ = 0.0f;
|
||||
this.particleTextureIndex = ExtraTextures.BlockMatterCannonParticle.getIcon();
|
||||
}
|
||||
|
||||
public void fromItem(ForgeDirection d)
|
||||
{
|
||||
this.particleScale *= 1.2f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onUpdate();
|
||||
this.particleScale *= 1.19f;
|
||||
this.particleAlpha *= 0.59f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.locationBlocksTexture );
|
||||
|
||||
float f6 = this.particleTextureIndex.getMinU();
|
||||
float f7 = this.particleTextureIndex.getMaxU();
|
||||
float f8 = this.particleTextureIndex.getMinV();
|
||||
float f9 = this.particleTextureIndex.getMaxV();
|
||||
float f10 = 0.05F * this.particleScale;
|
||||
|
||||
float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) par2 - interpPosX);
|
||||
float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) par2 - interpPosY);
|
||||
float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ);
|
||||
float f14 = 1.0F;
|
||||
|
||||
par1Tessellator.setColorRGBA_F( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha );
|
||||
par1Tessellator.addVertexWithUV( (double) (f11 - par3 * f10 - par6 * f10), (double) (f12 - par4 * f10), (double) (f13 - par5 * f10 - par7 * f10),
|
||||
(double) f7, (double) f9 );
|
||||
par1Tessellator.addVertexWithUV( (double) (f11 - par3 * f10 + par6 * f10), (double) (f12 + par4 * f10), (double) (f13 - par5 * f10 + par7 * f10),
|
||||
(double) f7, (double) f8 );
|
||||
par1Tessellator.addVertexWithUV( (double) (f11 + par3 * f10 + par6 * f10), (double) (f12 + par4 * f10), (double) (f13 + par5 * f10 + par7 * f10),
|
||||
(double) f6, (double) f8 );
|
||||
par1Tessellator.addVertexWithUV( (double) (f11 + par3 * f10 - par6 * f10), (double) (f12 - par4 * f10), (double) (f13 + par5 * f10 - par7 * f10),
|
||||
(double) f6, (double) f9 );
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package appeng.client.render.effects;
|
||||
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class VibrantEffect extends EntityFX
|
||||
{
|
||||
|
||||
public VibrantEffect(World par1World, double x, double y, double z, double par8, double par10, double par12) {
|
||||
super( par1World, x, y, z, par8, par10, par12 );
|
||||
float f = this.rand.nextFloat() * 0.1F + 0.8F;
|
||||
this.particleRed = f * 0.7f;
|
||||
this.particleGreen = f * 0.89f;
|
||||
this.particleBlue = f * 0.9f;
|
||||
this.setParticleTextureIndex( 0 );
|
||||
this.setSize( 0.04F, 0.04F );
|
||||
this.particleScale *= this.rand.nextFloat() * 0.6F + 1.9F;
|
||||
this.motionX = 0.0D;
|
||||
this.motionY = 0.0D;
|
||||
this.motionZ = 0.0D;
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
this.particleMaxAge = (int) (20.0D / (Math.random() * 0.8D + 0.1D));
|
||||
this.noClip = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBrightness(float par1)
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
// this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
this.particleScale *= 0.95;
|
||||
|
||||
if ( this.particleMaxAge-- <= 0 || this.particleScale < 0.1 )
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package appeng.client.render.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import appeng.entity.EntityChargedQuartz;
|
||||
import appeng.entity.EntitySingularity;
|
||||
import appeng.entity.EntityTinyTNTPrimed;
|
||||
|
||||
public class EntityIds
|
||||
{
|
||||
|
||||
public static final int TINY_TNT = 10;
|
||||
public static final int SINGULARITY = 11;
|
||||
public static final int CHARGED_QUARTZ = 12;
|
||||
|
||||
public static int get(Class<? extends Entity> droppedEntity)
|
||||
{
|
||||
if ( droppedEntity == EntityTinyTNTPrimed.class )
|
||||
return TINY_TNT;
|
||||
if ( droppedEntity == EntitySingularity.class )
|
||||
return SINGULARITY;
|
||||
if ( droppedEntity == EntityChargedQuartz.class )
|
||||
return CHARGED_QUARTZ;
|
||||
|
||||
throw new RuntimeException( "Missing entity id: " + droppedEntity.getName() );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package appeng.client.render.entity;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.entity.EntityTinyTNTPrimed;
|
||||
|
||||
public class RenderTinyTNTPrimed extends Render
|
||||
{
|
||||
|
||||
private RenderBlocks blockRenderer = new RenderBlocks();
|
||||
|
||||
public RenderTinyTNTPrimed() {
|
||||
this.shadowSize = 0.5F;
|
||||
this.renderManager = RenderManager.instance;
|
||||
}
|
||||
|
||||
public void renderPrimedTNT(EntityTinyTNTPrimed tnt, double x, double y, double z, float var1, float life)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef( (float) x, (float) y - 0.25f, (float) z );
|
||||
float f2;
|
||||
|
||||
if ( (float) tnt.fuse - life + 1.0F < 10.0F )
|
||||
{
|
||||
f2 = 1.0F - ((float) tnt.fuse - life + 1.0F) / 10.0F;
|
||||
|
||||
if ( f2 < 0.0F )
|
||||
{
|
||||
f2 = 0.0F;
|
||||
}
|
||||
|
||||
if ( f2 > 1.0F )
|
||||
{
|
||||
f2 = 1.0F;
|
||||
}
|
||||
|
||||
f2 *= f2;
|
||||
f2 *= f2;
|
||||
float f3 = 1.0F + f2 * 0.3F;
|
||||
GL11.glScalef( f3, f3, f3 );
|
||||
}
|
||||
|
||||
GL11.glScalef( 0.5f, 0.5f, 0.5f );
|
||||
f2 = (1.0F - ((float) tnt.fuse - life + 1.0F) / 100.0F) * 0.8F;
|
||||
this.bindEntityTexture( tnt );
|
||||
this.blockRenderer.renderBlockAsItem( Block.tnt, 0, tnt.getBrightness( life ) );
|
||||
|
||||
if ( tnt.fuse / 5 % 2 == 0 )
|
||||
{
|
||||
GL11.glDisable( GL11.GL_TEXTURE_2D );
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
GL11.glEnable( GL11.GL_BLEND );
|
||||
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, f2 );
|
||||
this.blockRenderer.renderBlockAsItem( Block.tnt, 0, 1.0F );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
GL11.glDisable( GL11.GL_BLEND );
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
GL11.glEnable( GL11.GL_TEXTURE_2D );
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
this.renderPrimedTNT( (EntityTinyTNTPrimed) par1Entity, par2, par4, par6, par8, par9 );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity)
|
||||
{
|
||||
return TextureMap.locationBlocksTexture;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
package appeng.client.texture;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public enum CableBusTextures
|
||||
{
|
||||
|
||||
Channels00("MECableSmart00"), Channels01("MECableSmart01"), Channels02("MECableSmart02"), Channels03("MECableSmart03"), Channels10("MECableSmart10"), Channels11(
|
||||
"MECableSmart11"), Channels12("MECableSmart12"), Channels13("MECableSmart13"), Channels14("MECableSmart14"), Channels04("MECableSmart04"),
|
||||
|
||||
LevelEmitterTorchOn("ItemPart.LevelEmitterOn"), BlockWirelessOn("BlockWirelessOn"),
|
||||
|
||||
BlockTransPlane("BlockTransPlaneOn"),
|
||||
|
||||
BlockP2PTunnel2("ItemPart.P2PTunnel2"), BlockP2PTunnel3("ItemPart.P2PTunnel3"),
|
||||
|
||||
MEWaiting("MEWaiting"),
|
||||
|
||||
PartMonitorSides("PartMonitorSides"), PartMonitorBack("PartMonitorBack"),
|
||||
|
||||
Transparent("Transparent"), PartMonitorSidesStatus("PartMonitorSidesStatus"), PartMonitorSidesStatusLights("PartMonitorSidesStatusLights"),
|
||||
|
||||
PartMonitor_Solid("PartMonitor_Solid"), PartMonitor_Colored("PartMonitor_Colored"), PartMonitor_Bright("PartMonitor_Bright"),
|
||||
|
||||
PartPatternTerm_Bright("PartPatternTerm_Bright"), PartPatternTerm_Colored("PartPatternTerm_Colored"), PartPatternTerm_Dark("PartPatternTerm_Dark"), PartPatternTerm_Solid(
|
||||
"PartPatternTerm_Solid"),
|
||||
|
||||
PartConvMonitor_Bright("PartConvMonitor_Bright"), PartConvMonitor_Colored("PartConvMonitor_Colored"), PartConvMonitor_Dark("PartConvMonitor_Dark"), PartConvMonitor_Solid(
|
||||
"PartConvMonitor_Solid"),
|
||||
|
||||
PartCraftingMonitor_Bright("PartCraftingMonitor_Bright"), PartCraftingMonitor_Colored("PartCraftingMonitor_Colored"), PartCraftingMonitor_Dark(
|
||||
"PartCraftingMonitor_Dark"), PartCraftingMonitor_Solid("PartCraftingMonitor_Solid"),
|
||||
|
||||
PartCraftingTerm_Bright("PartCraftingTerm_Bright"), PartCraftingTerm_Colored("PartCraftingTerm_Colored"), PartCraftingTerm_Dark("PartCraftingTerm_Dark"), PartCraftingTerm_Solid(
|
||||
"PartCraftingTerm_Solid"),
|
||||
|
||||
PartStorageMonitor_Bright("PartStorageMonitor_Bright"), PartStorageMonitor_Colored("PartStorageMonitor_Colored"), PartStorageMonitor_Dark(
|
||||
"PartStorageMonitor_Dark"), PartStorageMonitor_Solid("PartStorageMonitor_Solid"),
|
||||
|
||||
PartTerminal_Bright("PartTerminal_Bright"), PartTerminal_Colored("PartTerminal_Colored"), PartTerminal_Dark("PartTerminal_Dark"), PartTerminal_Solid(
|
||||
"PartTerminal_Solid"),
|
||||
|
||||
MECable_Green("MECable_Green"), MECable_Grey("MECable_Grey"), MECable_LightBlue("MECable_LightBlue"), MECable_LightGrey("MECable_LightGrey"), MECable_Lime(
|
||||
"MECable_Lime"), MECable_Magenta("MECable_Magenta"), MECable_Orange("MECable_Orange"), MECable_Pink("MECable_Pink"), MECable_Purple(
|
||||
"MECable_Purple"), MECable_Red("MECable_Red"), MECable_White("MECable_White"), MECable_Yellow("MECable_Yellow"), MECable_Black("MECable_Black"), MECable_Blue(
|
||||
"MECable_Blue"), MECable_Brown("MECable_Brown"), MECable_Cyan("MECable_Cyan"),
|
||||
|
||||
MESmart_Black("MESmart_Black"), MESmart_Blue("MESmart_Blue"), MESmart_Brown("MESmart_Brown"), MESmart_Cyan("MESmart_Cyan"), MESmart_Gray("MESmart_Gray"), MESmart_Green(
|
||||
"MESmart_Green"), MESmart_LightBlue("MESmart_LightBlue"), MESmart_LightGrey("MESmart_LightGrey"), MESmart_Lime("MESmart_Lime"), MESmart_Magenta(
|
||||
"MESmart_Magenta"), MESmart_Orange("MESmart_Orange"), MESmart_Pink("MESmart_Pink"), MESmart_Purple("MESmart_Purple"), MESmart_Red("MESmart_Red"), MESmart_White(
|
||||
"MESmart_White"), MESmart_Yellow("MESmart_Yellow"),
|
||||
|
||||
MECovered_Black("MECovered_Black"), MECovered_Blue("MECovered_Blue"), MECovered_Brown("MECovered_Brown"), MECovered_Cyan("MECovered_Cyan"), MECovered_Gray(
|
||||
"MECovered_Gray"), MECovered_Green("MECovered_Green"), MECovered_LightBlue("MECovered_LightBlue"), MECovered_LightGrey("MECovered_LightGrey"), MECovered_Lime(
|
||||
"MECovered_Lime"), MECovered_Magenta("MECovered_Magenta"), MECovered_Orange("MECovered_Orange"), MECovered_Pink("MECovered_Pink"), MECovered_Purple(
|
||||
"MECovered_Purple"), MECovered_Red("MECovered_Red"), MECovered_White("MECovered_White"), MECovered_Yellow("MECovered_Yellow"),
|
||||
|
||||
BlockAnnihilationPlaneOn("BlockAnnihilationPlaneOn"),
|
||||
|
||||
BlockFormPlaneOn("BlockFormPlaneOn"),
|
||||
|
||||
ItemPartLevelEmitterOn("ItemPart.LevelEmitterOn.png"), PartTransitionPlaneBack("PartTransitionPlaneBack");
|
||||
|
||||
final private String name;
|
||||
public Icon icon;
|
||||
|
||||
public static ResourceLocation GuiTexture(String string)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
private CableBusTextures(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Icon getIcon()
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void registerIcon(TextureMap map)
|
||||
{
|
||||
icon = map.registerIcon( "appliedenergistics2:" + name );
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static Icon getMissing()
|
||||
{
|
||||
return ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture( TextureMap.locationBlocksTexture )).getAtlasSprite( "missingno" );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package appeng.client.texture;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public enum ExtraTextures
|
||||
{
|
||||
BlockVibrationChamberFrontOn("BlockVibrationChamberFrontOn"),
|
||||
|
||||
OreQuartzStone("OreQuartzStone"),
|
||||
|
||||
MEChest("BlockMEChest"), BlockMEChestItems("BlockMEChestItems"),
|
||||
|
||||
BlockControllerPowered("BlockControllerPowered"), BlockControllerColumnPowered("BlockControllerColumnPowered"), BlockControllerColumn(
|
||||
"BlockControllerColumn"), BlockControllerLights("BlockControllerLights"), BlockControllerColumnLights("BlockControllerColumnLights"), BlockControllerColumnConflict(
|
||||
"BlockControllerColumnConflict"), BlockControllerConflict("BlockControllerConflict"), BlockControllerInsideA("BlockControllerInsideA"), BlockControllerInsideB(
|
||||
"BlockControllerInsideB"),
|
||||
|
||||
BlockChargerInside("BlockChargerInside"),
|
||||
|
||||
BlockContainmentWallMerged("BlockContainmentWallMerged"), BlockHeatVentMerged("BlockHeatVentMerged"),
|
||||
|
||||
MEStorageCellTextures("MEStorageCellTextures"), White("White"),
|
||||
|
||||
BlockInterfaceAlternate("BlockInterfaceAlternate"), BlockInterfaceAlternateArrow("BlockInterfaceAlternateArrow"),
|
||||
|
||||
BlockMatterCannonParticle("BlockMatterCannonParticle"), BlockEnergyParticle("BlockEnergyParticle"),
|
||||
|
||||
GlassFrame("BlockQuartzGlassFrame"),
|
||||
|
||||
MEDenseEnergyCell0("BlockDenseEnergyCell0"), MEDenseEnergyCell1("BlockDenseEnergyCell1"), MEDenseEnergyCell2("BlockDenseEnergyCell2"), MEDenseEnergyCell3(
|
||||
"BlockDenseEnergyCell3"), MEDenseEnergyCell4("BlockDenseEnergyCell4"), MEDenseEnergyCell5("BlockDenseEnergyCell5"), MEDenseEnergyCell6(
|
||||
"BlockDenseEnergyCell6"), MEDenseEnergyCell7("BlockDenseEnergyCell7"),
|
||||
|
||||
MEEnergyCell0("BlockEnergyCell0"), MEEnergyCell1("BlockEnergyCell1"), MEEnergyCell2("BlockEnergyCell2"), MEEnergyCell3("BlockEnergyCell3"), MEEnergyCell4(
|
||||
"BlockEnergyCell4"), MEEnergyCell5("BlockEnergyCell5"), MEEnergyCell6("BlockEnergyCell6"), MEEnergyCell7("BlockEnergyCell7"),
|
||||
|
||||
BlockSpatialPylon_dim("BlockSpatialPylon_dim"), BlockSpatialPylon_red("BlockSpatialPylon_red"),
|
||||
|
||||
BlockSpatialPylonC("BlockSpatialPylon_spanned"), BlockSpatialPylonC_dim("BlockSpatialPylon_spanned_dim"), BlockSpatialPylonC_red(
|
||||
"BlockSpatialPylon_spanned_red"),
|
||||
|
||||
BlockSpatialPylonE("BlockSpatialPylon_end"), BlockSpatialPylonE_dim("BlockSpatialPylon_end_dim"), BlockSpatialPylonE_red("BlockSpatialPylon_end_red");
|
||||
|
||||
final private String name;
|
||||
public Icon icon;
|
||||
|
||||
public static ResourceLocation GuiTexture(String string)
|
||||
{
|
||||
return new ResourceLocation( "appliedenergistics2", "textures/" + string );
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
private ExtraTextures(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Icon getIcon()
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void registerIcon(TextureMap map)
|
||||
{
|
||||
icon = map.registerIcon( "appliedenergistics2:" + name );
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static Icon getMissing()
|
||||
{
|
||||
return ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture( TextureMap.locationBlocksTexture )).getAtlasSprite( "missingno" );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
package appeng.client.texture;
|
||||
|
||||
import net.minecraft.util.Icon;
|
||||
|
||||
public class FlipableIcon implements Icon
|
||||
{
|
||||
|
||||
protected Icon original;
|
||||
boolean flip_u;
|
||||
boolean flip_v;
|
||||
|
||||
public FlipableIcon(Icon o) {
|
||||
original = o;
|
||||
flip_u = false;
|
||||
flip_v = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconWidth()
|
||||
{
|
||||
return original.getIconWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight()
|
||||
{
|
||||
return original.getIconHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMinU()
|
||||
{
|
||||
if ( flip_u )
|
||||
return original.getMaxU();
|
||||
return original.getMinU();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMaxU()
|
||||
{
|
||||
if ( flip_u )
|
||||
return original.getMinU();
|
||||
return original.getMaxU();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getInterpolatedU(double px)
|
||||
{
|
||||
if ( flip_u )
|
||||
return original.getInterpolatedU( 16 - px );
|
||||
return original.getInterpolatedU( px );
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMinV()
|
||||
{
|
||||
if ( flip_v )
|
||||
return original.getMaxV();
|
||||
return original.getMinV();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMaxV()
|
||||
{
|
||||
if ( flip_v )
|
||||
return original.getMinV();
|
||||
return original.getMaxV();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getInterpolatedV(double px)
|
||||
{
|
||||
if ( flip_v )
|
||||
return original.getInterpolatedV( 16 - px );
|
||||
return original.getInterpolatedV( px );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconName()
|
||||
{
|
||||
return original.getIconName();
|
||||
}
|
||||
|
||||
public Icon getOriginal()
|
||||
{
|
||||
return original;
|
||||
}
|
||||
|
||||
public void setFlip(boolean u, boolean v)
|
||||
{
|
||||
flip_u = u;
|
||||
flip_v = v;
|
||||
}
|
||||
|
||||
public int setFlip(int orientation)
|
||||
{
|
||||
flip_u = (orientation & 8) == 8;
|
||||
flip_v = (orientation & 16) == 16;
|
||||
return orientation & 7;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package appeng.client.texture;
|
||||
|
||||
import net.minecraft.util.Icon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class FullIcon implements Icon
|
||||
{
|
||||
|
||||
private Icon p;
|
||||
|
||||
public FullIcon(Icon o) {
|
||||
p = o;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMinU()
|
||||
{
|
||||
return p.getMinU();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMaxU()
|
||||
{
|
||||
return p.getMaxU();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getInterpolatedU(double d0)
|
||||
{
|
||||
if ( d0 > 8.0 )
|
||||
return p.getMaxU();
|
||||
return p.getMinU();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMinV()
|
||||
{
|
||||
return p.getMinV();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getMaxV()
|
||||
{
|
||||
return p.getMaxV();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getInterpolatedV(double d0)
|
||||
{
|
||||
if ( d0 > 8.0 )
|
||||
return p.getMaxV();
|
||||
return p.getMinV();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getIconName()
|
||||
{
|
||||
return p.getIconName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconWidth()
|
||||
{
|
||||
return p.getIconWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight()
|
||||
{
|
||||
return p.getIconHeight();
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue