1.8.8 + deleted all integration can be recovered later or something.

This commit is contained in:
AlgorithmX2 2015-12-31 17:19:44 -06:00
parent 2e51ea5f78
commit 71afa9bf53
142 changed files with 386 additions and 7919 deletions

View File

@ -41,7 +41,7 @@ buildscript {
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.0-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
}
}
@ -83,8 +83,7 @@ minecraft {
// used when launching minecraft in dev env
runDir = "run"
mappings = "snapshot_20150928"
mappings = "snapshot_20151227"
}
sourceSets {

View File

@ -7,8 +7,8 @@ aebasename=appliedenergistics2
#########################################################
# Versions #
#########################################################
minecraft_version=1.8
forge_version=11.14.3.1516
minecraft_version=1.8.8
forge_version=11.15.0.1634-1.8.8
#########################################################
# Installable #

Binary file not shown.

View File

@ -1,6 +1,6 @@
#Mon Sep 28 22:02:24 CEST 2015
#Mon Sep 14 12:28:28 PDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip

2
gradlew.bat vendored
View File

@ -9,7 +9,7 @@
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx4g"
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.

View File

@ -1,137 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.block;
import java.util.EnumSet;
import java.util.Random;
import net.minecraft.block.BlockSlab;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import appeng.client.texture.IAESprite;
import appeng.core.features.AEFeature;
import appeng.core.features.IAEFeature;
import appeng.core.features.IFeatureHandler;
public class AEBaseSlabBlock extends BlockSlab implements IAEFeature
{
private final IFeatureHandler features;
private final AEBaseBlock block;
private final int meta;
private AEBaseSlabBlock slabs;
private AEBaseSlabBlock doubleSlabs;
private final String name;
public AEBaseSlabBlock( final AEBaseBlock block, final int meta, final EnumSet<AEFeature> features, final boolean isDoubleSlab, final String name )
{
super( isDoubleSlab, block.getMaterial() );
this.block = block;
this.meta = meta;
this.name = name;
this.setBlockName( "appliedenergistics2." + name );
this.setHardness( block.getBlockHardness( null, 0, 0, 0 ) );
this.setResistance( block.getExplosionResistance( null ) * 5.0F / 3.0F );
this.setStepSound( block.stepSound );
this.useNeighborBrightness = true;
if( !this.field_150004_a )
{
this.doubleSlabs = new AEBaseSlabBlock( block, meta, features, true, name + ".double" ).setSlabs( this );
}
this.features = !this.field_150004_a ? new SlabBlockFeatureHandler( features, this ) : null;
}
private AEBaseSlabBlock setSlabs( final AEBaseSlabBlock slabs )
{
this.slabs = slabs;
return this;
}
public AEBaseSlabBlock slabs()
{
return this.slabs;
}
public AEBaseSlabBlock doubleSlabs()
{
return this.doubleSlabs;
}
@Override
public IFeatureHandler handler()
{
return this.features;
}
@Override
public void postInit()
{
// Override to do stuff
}
@Override
public IAESprite getIcon( final int dir, final int meta )
{
return this.block.getIcon( dir, this.meta );
}
@Override
public String func_150002_b( final int p_150002_1_ )
{
return this.getUnlocalizedName();
}
@Override
public void registerBlockIcons( final IIconRegister reg )
{
}
@Override
public Item getItemDropped( final int meta, final Random rand, final int fortune )
{
return this.field_150004_a ? Item.getItemFromBlock( this.slabs ) : Item.getItemFromBlock( this );
}
@Override
public ItemStack getPickBlock( final MovingObjectPosition target, final World world, final int x, final int y, final int z )
{
AEBaseSlabBlock block = (AEBaseSlabBlock) world.getBlock( x, y, z );
if( block == null )
{
return null;
}
if( block.field_150004_a )
{
block = this.slabs;
}
final int meta = world.getBlockMetadata( x, y, z ) & 7;
return new ItemStack( block, 1, meta );
}
public String name()
{
return this.name;
}
}

View File

@ -18,12 +18,19 @@
package appeng.block.misc;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseTileBlock;
import appeng.client.render.blocks.RenderQuartzTorch;
import appeng.core.features.AEFeature;
import appeng.helpers.ICustomCollision;
import appeng.helpers.MetaRotation;
import appeng.tile.misc.TileLightDetector;
import net.minecraft.block.Block;
import net.minecraft.block.BlockTorch;
import net.minecraft.block.material.Material;
@ -36,16 +43,6 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseTileBlock;
import appeng.client.render.blocks.RenderQuartzTorch;
import appeng.core.features.AEFeature;
import appeng.helpers.ICustomCollision;
import appeng.helpers.MetaRotation;
import appeng.tile.misc.TileLightDetector;
public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBlock, ICustomCollision
{
@ -53,12 +50,12 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
{
super( Material.circuits );
this.setLightOpacity( 0 );
this.setFullSize( false );
this.setOpaque( false );
setLightOpacity( 0 );
setFullSize( false );
setOpaque( false );
this.setTileEntity( TileLightDetector.class );
this.setFeature( EnumSet.of( AEFeature.LightDetector ) );
setTileEntity( TileLightDetector.class );
setFeature( EnumSet.of( AEFeature.LightDetector ) );
}
@Override
@ -72,7 +69,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
public IBlockState getStateFromMeta(
final int meta )
{
return this.getDefaultState();
return getDefaultState();
}
@Override
@ -82,13 +79,13 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
}
@Override
public int isProvidingWeakPower(
public int getWeakPower(
final IBlockAccess w,
final BlockPos pos,
final IBlockState state,
final EnumFacing side )
{
if( w instanceof World && ( (TileLightDetector) this.getTileEntity( w, pos ) ).isReady() )
if ( w instanceof World && ( (TileLightDetector) this.getTileEntity( w, pos ) ).isReady() )
{
return ( (World) w ).getLightFromNeighbors( pos ) - 6;
}
@ -105,7 +102,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
super.onNeighborChange( world, pos, neighbor );
final TileLightDetector tld = this.getTileEntity( world, pos );
if( tld != null )
if ( tld != null )
{
tld.updateLight();
}
@ -134,10 +131,13 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
final EnumFacing forward,
final EnumFacing up )
{
return this.canPlaceAt( w, pos, up.getOpposite() );
return canPlaceAt( w, pos, up.getOpposite() );
}
private boolean canPlaceAt( final World w, final BlockPos pos, final EnumFacing dir )
private boolean canPlaceAt(
final World w,
final BlockPos pos,
final EnumFacing dir )
{
return w.isSideSolid( pos.offset( dir ), dir.getOpposite(), false );
}
@ -149,7 +149,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
final Entity thePlayer,
final boolean b )
{
final EnumFacing up = this.getOrientable( w, pos ).getUp();
final EnumFacing up = getOrientable( w, pos ).getUp();
final double xOff = -0.3 * up.getFrontOffsetX();
final double yOff = -0.3 * up.getFrontOffsetY();
final double zOff = -0.3 * up.getFrontOffsetZ();
@ -164,10 +164,12 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
final List<AxisAlignedBB> out,
final Entity e )
{/*
* double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 * getUp().offsetY; double zOff = -0.15 *
* getUp().offsetZ; out.add( AxisAlignedBB.getBoundingBox( 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 ) );
*/
* double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 *
* getUp().offsetY; double zOff = -0.15 * getUp().offsetZ; out.add(
* AxisAlignedBB.getBoundingBox( 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
@ -177,14 +179,16 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
final IBlockState state,
final Block neighborBlock )
{
final EnumFacing up = this.getOrientable( w, pos ).getUp();
if( !this.canPlaceAt( w, pos, up.getOpposite() ) )
final EnumFacing up = getOrientable( w, pos ).getUp();
if ( !canPlaceAt( w, pos, up.getOpposite() ) )
{
this.dropTorch( w, pos );
dropTorch( w, pos );
}
}
private void dropTorch( final World w, final BlockPos pos )
private void dropTorch(
final World w,
final BlockPos pos )
{
w.destroyBlock( pos, true );
w.markBlockForUpdate( pos );
@ -195,9 +199,9 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
final World w,
final BlockPos pos )
{
for( final EnumFacing dir : EnumFacing.VALUES )
for ( final EnumFacing dir : EnumFacing.VALUES )
{
if( this.canPlaceAt( w, pos, dir ) )
if ( canPlaceAt( w, pos, dir ) )
{
return true;
}
@ -212,7 +216,9 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
}
@Override
public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
public IOrientable getOrientable(
final IBlockAccess w,
final BlockPos pos )
{
return new MetaRotation( w, pos, true );
}

View File

@ -18,33 +18,10 @@
package appeng.block.networking;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.parts.IPartHost;
import appeng.api.parts.PartItemStack;
import appeng.api.parts.SelectedPart;
@ -68,11 +45,32 @@ import appeng.tile.AEBaseTile;
import appeng.tile.networking.TileCableBus;
import appeng.tile.networking.TileCableBusTESR;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
// TODO: MFR INTEGRATION
//@Interface( iface = "powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection", iname = IntegrationType.MFR )
public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnection
public class BlockCableBus extends AEBaseTileBlock // implements
// IRedNetConnection
{
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
@ -82,8 +80,10 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
/**
* Immibis MB Support.
*
* It will look for a field named ImmibisMicroblocks_TransformableBlockMarker or
* ImmibisMicroblocks_TransformableTileEntityMarker, modifiers, type, etc can be ignored.
* It will look for a field named
* ImmibisMicroblocks_TransformableBlockMarker or
* ImmibisMicroblocks_TransformableTileEntityMarker, modifiers, type, etc
* can be ignored.
*/
@Reflected
private static final boolean ImmibisMicroblocks_TransformableBlockMarker = true;
@ -91,12 +91,13 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
public BlockCableBus()
{
super( AEGlassMaterial.INSTANCE );
this.setLightOpacity( 0 );
this.setFullSize( this.setOpaque( false ) );
setLightOpacity( 0 );
setFullSize( setOpaque( false ) );
// this will actually be overwritten later through setupTile and the combined layers
this.setTileEntity( TileCableBus.class );
this.setFeature( EnumSet.of( AEFeature.Core ) );
// this will actually be overwritten later through setupTile and the
// combined layers
setTileEntity( TileCableBus.class );
setFeature( EnumSet.of( AEFeature.Core ) );
}
@Override
@ -106,7 +107,7 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
final IBlockState state,
final Random rand )
{
this.cb( worldIn, pos ).randomDisplayTick( worldIn, pos, rand );
cb( worldIn, pos ).randomDisplayTick( worldIn, pos, rand );
}
@Override
@ -115,7 +116,7 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
final BlockPos pos,
final BlockPos neighbor )
{
this.cb( w, pos ).onNeighborChanged();
cb( w, pos ).onNeighborChanged();
}
@Override
@ -128,13 +129,15 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
}
@Override
public int isProvidingWeakPower(
public int getWeakPower(
final IBlockAccess w,
final BlockPos pos,
final IBlockState state,
final EnumFacing side )
{
return this.cb( w, pos ).isProvidingWeakPower( side.getOpposite() ); // TODO: IS OPPOSITE!?
return cb( w, pos ).isProvidingWeakPower( side.getOpposite() ); // TODO:
// IS
// OPPOSITE!?
}
@Override
@ -150,17 +153,19 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
final IBlockState state,
final Entity entityIn )
{
this.cb( w, pos ).onEntityCollision( entityIn );
cb( w, pos ).onEntityCollision( entityIn );
}
@Override
public int isProvidingStrongPower(
public int getStrongPower(
final IBlockAccess w,
final BlockPos pos,
final IBlockState state,
final EnumFacing side )
{
return this.cb( w, pos ).isProvidingStrongPower( side.getOpposite() ); // TODO: IS OPPOSITE!?
return cb( w, pos ).isProvidingStrongPower( side.getOpposite() ); // TODO:
// IS
// OPPOSITE!?
}
@Override
@ -169,27 +174,33 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
final BlockPos pos )
{
final IBlockState block = world.getBlockState( pos );
if( block != null && block.getBlock() != this )
if ( block != null && block.getBlock() != this )
{
return block.getBlock().getLightValue( world, pos );
}
if( block == null )
if ( block == null )
{
return 0;
}
return this.cb( world, pos ).getLightValue();
return cb( world, pos ).getLightValue();
}
@Override
public boolean isLadder( final IBlockAccess world, final BlockPos pos, final EntityLivingBase entity )
public boolean isLadder(
final IBlockAccess world,
final BlockPos pos,
final EntityLivingBase entity )
{
return this.cb( world, pos ).isLadder( entity );
return cb( world, pos ).isLadder( entity );
}
@Override
public boolean isSideSolid( final IBlockAccess w, final BlockPos pos, final EnumFacing side )
public boolean isSideSolid(
final IBlockAccess w,
final BlockPos pos,
final EnumFacing side )
{
return this.cb( w, pos ).isSolidOnSide( side );
return cb( w, pos ).isSolidOnSide( side );
}
@Override
@ -197,7 +208,7 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
final World w,
final BlockPos pos )
{
return this.cb( w, pos ).isEmpty();
return cb( w, pos ).isEmpty();
}
@Override
@ -207,10 +218,10 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
final EntityPlayer player,
final boolean willHarvest )
{
if( player.capabilities.isCreativeMode )
if ( player.capabilities.isCreativeMode )
{
final AEBaseTile tile = this.getTileEntity( world, pos );
if( tile != null )
if ( tile != null )
{
tile.disableDrops();
}
@ -225,19 +236,19 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
final BlockPos pos,
EnumFacing side )
{
if( side == null )
if ( side == null )
{
side = EnumFacing.UP;
}
return this.cb( w, pos ).canConnectRedstone( EnumSet.of( side ) );
return cb( w, pos ).canConnectRedstone( EnumSet.of( side ) );
}
@Override
public boolean canRenderInLayer(
final EnumWorldBlockLayer layer )
{
if( AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) )
if ( AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) )
{
return layer == EnumWorldBlockLayer.CUTOUT || layer == EnumWorldBlockLayer.TRANSLUCENT;
}
@ -252,13 +263,13 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
final BlockPos pos )
{
final Vec3 v3 = target.hitVec.subtract( pos.getX(), pos.getY(), pos.getZ() );
final SelectedPart sp = this.cb( world, pos ).selectPart( v3 );
final SelectedPart sp = cb( world, pos ).selectPart( v3 );
if( sp.part != null )
if ( sp.part != null )
{
return sp.part.getItemStack( PartItemStack.Pick );
}
else if( sp.facade != null )
else if ( sp.facade != null )
{
return sp.facade.getItemStack();
}
@ -268,45 +279,33 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
@Override
@SideOnly( Side.CLIENT )
public boolean addHitEffects( final World world, final MovingObjectPosition target, final EffectRenderer effectRenderer )
public boolean addHitEffects(
final World world,
final MovingObjectPosition target,
final EffectRenderer effectRenderer )
{
final Object object = this.cb( world, target.getBlockPos() );
if( object instanceof IPartHost )
final Object object = cb( world, target.getBlockPos() );
if ( object instanceof IPartHost )
{
final IPartHost host = (IPartHost) object;
// TODO HIT EFFECTS
/*
* for( AEPartLocation side : AEPartLocation.values() )
* {
* IPart p = host.getPart( side );
* TextureAtlasSprite ico = this.getIcon( p );
* if( ico == null )
* {
* continue;
* }
* byte b0 = (byte) ( Platform.getRandomInt() % 2 == 0 ? 1 : 0 );
* for( int i1 = 0; i1 < b0; ++i1 )
* {
* for( int j1 = 0; j1 < b0; ++j1 )
* {
* for( int k1 = 0; k1 < b0; ++k1 )
* {
* double d0 = target.blockX + ( i1 + 0.5D ) / b0;
* double d1 = target.blockY + ( j1 + 0.5D ) / b0;
* double d2 = target.blockZ + ( k1 + 0.5D ) / b0;
* double dd0 = target.hitVec.xCoord;
* double dd1 = target.hitVec.yCoord;
* double dd2 = target.hitVec.zCoord;
* EntityDiggingFX fx = ( new EntityDiggingFX( world, dd0, dd1, dd2, d0 - target.blockX - 0.5D, d1 -
* target.blockY - 0.5D, d2 - target.blockZ - 0.5D, this, 0 ) ).applyColourMultiplier( target.blockX,
* target.blockY, target.blockZ );
* fx.setParticleIcon( ico );
* effectRenderer.addEffect( fx );
* }
* }
* }
* }
* for( AEPartLocation side : AEPartLocation.values() ) { IPart p =
* host.getPart( side ); TextureAtlasSprite ico = this.getIcon( p );
* if( ico == null ) { continue; } byte b0 = (byte) (
* Platform.getRandomInt() % 2 == 0 ? 1 : 0 ); for( int i1 = 0; i1 <
* b0; ++i1 ) { for( int j1 = 0; j1 < b0; ++j1 ) { for( int k1 = 0;
* k1 < b0; ++k1 ) { double d0 = target.blockX + ( i1 + 0.5D ) / b0;
* double d1 = target.blockY + ( j1 + 0.5D ) / b0; double d2 =
* target.blockZ + ( k1 + 0.5D ) / b0; double dd0 =
* target.hitVec.xCoord; double dd1 = target.hitVec.yCoord; double
* dd2 = target.hitVec.zCoord; EntityDiggingFX fx = ( new
* EntityDiggingFX( world, dd0, dd1, dd2, d0 - target.blockX - 0.5D,
* d1 - target.blockY - 0.5D, d2 - target.blockZ - 0.5D, this, 0 )
* ).applyColourMultiplier( target.blockX, target.blockY,
* target.blockZ ); fx.setParticleIcon( ico );
* effectRenderer.addEffect( fx ); } } } }
*/
}
@ -319,39 +318,23 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
final BlockPos pos,
final EffectRenderer effectRenderer )
{
final Object object = this.cb( world, pos );
if( object instanceof IPartHost )
final Object object = cb( world, pos );
if ( object instanceof IPartHost )
{
final IPartHost host = (IPartHost) object;
// TODO DESTROY EFFECTS
/*
* for( AEPartLocation side : AEPartLocation.values() )
* {
* IPart p = host.getPart( side );
* TextureAtlasSprite ico = this.getIcon( p );
* if( ico == null )
* {
* continue;
* }
* byte b0 = 3;
* for( int i1 = 0; i1 < b0; ++i1 )
* {
* for( int j1 = 0; j1 < b0; ++j1 )
* {
* for( int k1 = 0; k1 < b0; ++k1 )
* {
* double d0 = x + ( i1 + 0.5D ) / b0;
* double d1 = y + ( j1 + 0.5D ) / b0;
* double d2 = z + ( k1 + 0.5D ) / b0;
* EntityDiggingFX fx = ( new EntityDiggingFX( world, d0, d1, d2, d0 - x - 0.5D, d1 - y - 0.5D, d2 - z -
* 0.5D, this, meta ) ).applyColourMultiplier( x, y, z );
* fx.setParticleIcon( ico );
* effectRenderer.addEffect( fx );
* }
* }
* }
* }
* for( AEPartLocation side : AEPartLocation.values() ) { IPart p =
* host.getPart( side ); TextureAtlasSprite ico = this.getIcon( p );
* if( ico == null ) { continue; } byte b0 = 3; for( int i1 = 0; i1
* < b0; ++i1 ) { for( int j1 = 0; j1 < b0; ++j1 ) { for( int k1 =
* 0; k1 < b0; ++k1 ) { double d0 = x + ( i1 + 0.5D ) / b0; double
* d1 = y + ( j1 + 0.5D ) / b0; double d2 = z + ( k1 + 0.5D ) / b0;
* EntityDiggingFX fx = ( new EntityDiggingFX( world, d0, d1, d2, d0
* - x - 0.5D, d1 - y - 0.5D, d2 - z - 0.5D, this, meta )
* ).applyColourMultiplier( x, y, z ); fx.setParticleIcon( ico );
* effectRenderer.addEffect( fx ); } } } }
*/
}
@ -365,22 +348,24 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
final IBlockState state,
final Block neighborBlock )
{
if( Platform.isServer() )
if ( Platform.isServer() )
{
this.cb( w, pos ).onNeighborChanged();
cb( w, pos ).onNeighborChanged();
}
}
private ICableBusContainer cb( final IBlockAccess w, final BlockPos pos )
private ICableBusContainer cb(
final IBlockAccess w,
final BlockPos pos )
{
final TileEntity te = w.getTileEntity( pos );
ICableBusContainer out = null;
if( te instanceof TileCableBus )
if ( te instanceof TileCableBus )
{
out = ( (TileCableBus) te ).getCableBus();
}
else if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) )
else if ( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.FMP ) )
{
out = ( (IFMP) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.FMP ) ).getCableContainer( te );
}
@ -404,7 +389,7 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
final float hitY,
final float hitZ )
{
return this.cb( w, pos ).activate( player, new Vec3( hitX, hitY, hitZ ) );
return cb( w, pos ).activate( player, new Vec3( hitX, hitY, hitZ ) );
}
@Override
@ -426,9 +411,9 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
{
try
{
return this.cb( world, pos ).recolourBlock( side, AEColor.values()[color.ordinal()], who );
return cb( world, pos ).recolourBlock( side, AEColor.values()[color.ordinal()], who );
}
catch( final Throwable ignored )
catch ( final Throwable ignored )
{
}
return false;
@ -436,22 +421,27 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
@Override
@SideOnly( Side.CLIENT )
public void getCheckedSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
public void getCheckedSubBlocks(
final Item item,
final CreativeTabs tabs,
final List<ItemStack> itemStacks )
{
// do nothing
}
@Override
public <T extends AEBaseTile> T getTileEntity( final IBlockAccess w, final BlockPos pos )
public <T extends AEBaseTile> T getTileEntity(
final IBlockAccess w,
final BlockPos pos )
{
final TileEntity te = w.getTileEntity( pos );
if( noTesrTile.isInstance( te ) )
if ( noTesrTile.isInstance( te ) )
{
return (T) te;
}
if( tesrTile != null && tesrTile.isInstance( te ) )
if ( tesrTile != null && tesrTile.isInstance( te ) )
{
return (T) te;
}
@ -460,18 +450,19 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
}
@Override
protected void setFeature( final EnumSet<AEFeature> f )
protected void setFeature(
final EnumSet<AEFeature> f )
{
final AECableBusFeatureHandler featureHandler = new AECableBusFeatureHandler( f, this, this.getFeatureSubName() );
this.setHandler( featureHandler );
final AECableBusFeatureHandler featureHandler = new AECableBusFeatureHandler( f, this, getFeatureSubName() );
setHandler( featureHandler );
}
public void setupTile()
{
noTesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBus.class.getName() );
this.setTileEntity( noTesrTile );
setTileEntity( noTesrTile );
GameRegistry.registerTileEntity( noTesrTile, "BlockCableBus" );
if( Platform.isClient() )
if ( Platform.isClient() )
{
tesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBusTESR.class.getName() );
GameRegistry.registerTileEntity( tesrTile, "ClientOnly_TESR_CableBus" );
@ -492,9 +483,11 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
// TODO MFR Integration
// @Override
// @Method( iname = IntegrationType.MFR )
// public RedNetConnectionType getConnectionType( World world, int x, int y, int z, ForgeDirection side )
// public RedNetConnectionType getConnectionType( World world, int x, int y,
// int z, ForgeDirection side )
// {
// return this.cb( world, x, y, z ).canConnectRedstone( EnumSet.allOf( ForgeDirection.class ) ) ?
// return this.cb( world, x, y, z ).canConnectRedstone( EnumSet.allOf(
// ForgeDirection.class ) ) ?
// RedNetConnectionType.CableSingle : RedNetConnectionType.None;
// }
//

View File

@ -100,8 +100,6 @@ import appeng.util.Platform;
public class ClientHelper extends ServerHelper
{
private static final RenderItem ITEM_RENDERER = Minecraft.getMinecraft().getRenderItem();
private static final ModelGenerator BLOCK_RENDERER = new ModelGenerator();
private final ModelResourceLocation partRenderer = new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, "DynamicPartRenderer" ), "inventory" );
private final Map<Object, List<IconReg>> iconRegistrations = new HashMap<>();

View File

@ -0,0 +1,7 @@
package appeng.client;
public enum ItemRenderType
{
INVENTORY, ENTITY
}

View File

@ -1,10 +1,14 @@
package appeng.client;
import java.util.Collections;
import java.util.List;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseBlock;
import appeng.client.render.BlockRenderInfo;
import appeng.client.render.ModelGenerator;
import appeng.client.texture.MissingIcon;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
@ -14,44 +18,20 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import net.minecraftforge.client.model.IModelPart;
import net.minecraftforge.client.model.IModelState;
import net.minecraftforge.client.model.ISmartBlockModel;
import net.minecraftforge.client.model.ISmartItemModel;
import net.minecraftforge.client.model.TRSRTransformation;
import net.minecraftforge.common.property.IExtendedBlockState;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseBlock;
import appeng.block.AEBaseTileBlock;
import appeng.client.render.BlockRenderInfo;
import appeng.client.render.ModelGenerator;
import appeng.client.texture.MissingIcon;
// net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer
public class SmartModel implements IBakedModel, ISmartBlockModel, ISmartItemModel
{
private final BlockRenderInfo aeRenderer;
private class DefState implements IModelState
{
@Override
public TRSRTransformation apply(
final IModelPart part )
{
return TRSRTransformation.identity();
}
};
public SmartModel(
final BlockRenderInfo rendererInstance )
{
this.aeRenderer = rendererInstance;
aeRenderer = rendererInstance;
}
@Override
@ -84,11 +64,11 @@ public class SmartModel implements IBakedModel, ISmartBlockModel, ISmartItemMode
{
return false;
}
@Override
public TextureAtlasSprite getTexture()
public TextureAtlasSprite getParticleTexture()
{
return this.aeRenderer != null ? this.aeRenderer.getTexture( AEPartLocation.UP ).getAtlas() : MissingIcon.getMissing();
return aeRenderer != null ? aeRenderer.getTexture( AEPartLocation.UP ).getAtlas() : MissingIcon.getMissing();
}
@Override
@ -104,7 +84,7 @@ public class SmartModel implements IBakedModel, ISmartBlockModel, ISmartItemMode
final ModelGenerator helper = new ModelGenerator();
final Block blk = Block.getBlockFromItem( stack.getItem() );
helper.setRenderBoundsFromBlock( blk );
this.aeRenderer.getRendererInstance().renderInventory( blk instanceof AEBaseBlock ? (AEBaseBlock) blk : null, stack, helper, ItemRenderType.INVENTORY, null );
aeRenderer.getRendererInstance().renderInventory( blk instanceof AEBaseBlock ? (AEBaseBlock) blk : null, stack, helper, ItemRenderType.INVENTORY, null );
helper.finalizeModel( true );
return helper.getOutput();
}
@ -115,12 +95,12 @@ public class SmartModel implements IBakedModel, ISmartBlockModel, ISmartItemMode
{
final ModelGenerator helper = new ModelGenerator();
final Block blk = state.getBlock();
final BlockPos pos = ( (IExtendedBlockState) state ).getValue( AEBaseTileBlock.AE_BLOCK_POS );
final IBlockAccess world = ( (IExtendedBlockState) state ).getValue( AEBaseTileBlock.AE_BLOCK_ACCESS );
final BlockPos pos = ( (IExtendedBlockState) state ).getValue( AEBaseBlock.AE_BLOCK_POS );
final IBlockAccess world = ( (IExtendedBlockState) state ).getValue( AEBaseBlock.AE_BLOCK_ACCESS );
helper.setTranslation( -pos.getX(), -pos.getY(), -pos.getZ() );
helper.setRenderBoundsFromBlock( blk );
helper.setBlockAccess( world );
this.aeRenderer.getRendererInstance().renderInWorld( blk instanceof AEBaseBlock ? (AEBaseBlock) blk : null, world, pos, helper );
aeRenderer.getRendererInstance().renderInWorld( blk instanceof AEBaseBlock ? (AEBaseBlock) blk : null, world, pos, helper );
helper.finalizeModel( false );
return helper.getOutput();
}

View File

@ -45,6 +45,7 @@ import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
@ -817,17 +818,16 @@ public abstract class AEBaseGui extends GuiContainer
final Tessellator tessellator = Tessellator.getInstance();
final WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.startDrawingQuads();
worldrenderer.setColorRGBA_F( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() );
worldrenderer.begin( GL11.GL_QUADS, DefaultVertexFormats.ITEM );
;
final float f1 = 0.00390625F;
final float f = 0.00390625F;
final float par6 = 16;
worldrenderer.addVertexWithUV( par1 + 0, par2 + par6, this.zLevel, ( par3 + 0 ) * f, ( par4 + par6 ) * f1 );
worldrenderer.color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).pos( par1 + 0, par2 + par6, this.zLevel).tex( ( par3 + 0 ) * f, ( par4 + par6 ) * f1 ).endVertex();
final float par5 = 16;
worldrenderer.addVertexWithUV( par1 + par5, par2 + par6, this.zLevel, ( par3 + par5 ) * f, ( par4 + par6 ) * f1 );
worldrenderer.addVertexWithUV( par1 + par5, par2 + 0, this.zLevel, ( par3 + par5 ) * f, ( par4 + 0 ) * f1 );
worldrenderer.addVertexWithUV( par1 + 0, par2 + 0, this.zLevel, ( par3 + 0 ) * f, ( par4 + 0 ) * f1 );
worldrenderer.setColorRGBA_F( 1.0f, 1.0f, 1.0f, 1.0f );
worldrenderer.color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).pos( par1 + par5, par2 + par6, this.zLevel).tex( ( par3 + par5 ) * f, ( par4 + par6 ) * f1 ).endVertex();
worldrenderer.color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).pos( par1 + par5, par2 + 0, this.zLevel).tex( ( par3 + par5 ) * f, ( par4 + 0 ) * f1 ).endVertex();
worldrenderer.color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).pos( par1 + 0, par2 + 0, this.zLevel).tex( ( par3 + 0 ) * f, ( par4 + 0 ) * f1 ).endVertex();
tessellator.draw();
}
catch( final Exception err )

View File

@ -34,6 +34,7 @@ import com.google.common.collect.HashMultimap;
import org.lwjgl.opengl.GL11;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@ -103,7 +104,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
final int ex = this.getScrollBar().getCurrentScroll();
final Iterator<Object> o = this.inventorySlots.inventorySlots.iterator();
final Iterator<Slot> o = this.inventorySlots.inventorySlots.iterator();
while( o.hasNext() )
{
if( o.next() instanceof SlotDisconnected )

View File

@ -28,6 +28,7 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.model.ModelManager;
import net.minecraft.item.ItemStack;
@ -140,12 +141,13 @@ public class AppEngRenderItem extends RenderItem
{
final WorldRenderer wr = par1Tessellator.getWorldRenderer();
wr.startDrawingQuads();
wr.setColorOpaque_I( par6 );
wr.addVertex( par2, par3, 0.0D );
wr.addVertex( par2, par3 + par5, 0.0D );
wr.addVertex( par2 + par4, par3 + par5, 0.0D );
wr.addVertex( par2 + par4, par3, 0.0D );
wr.begin( GL11.GL_QUADS, DefaultVertexFormats.ITEM);
wr.color( (par6>>16)&0xff,(par6>>8)&0xff,(par6)&0xff,(par6>>24)&0xff ).pos( par2, par3, 0.0D ).endVertex();
wr.color( (par6>>16)&0xff,(par6>>8)&0xff,(par6)&0xff,(par6>>24)&0xff ).pos(par2, par3 + par5, 0.0D ).endVertex();
wr.color( (par6>>16)&0xff,(par6>>8)&0xff,(par6)&0xff,(par6>>24)&0xff ).pos( par2 + par4, par3 + par5, 0.0D ).endVertex();
wr.color( (par6>>16)&0xff,(par6>>8)&0xff,(par6)&0xff,(par6>>24)&0xff ).pos( par2 + par4, par3, 0.0D ).endVertex();
par1Tessellator.draw();
}

View File

@ -39,7 +39,6 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -284,7 +283,7 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
return this.renderDistance;
}
public void renderInventory( final B block, final ItemStack item, final ModelGenerator renderer, final ItemRenderType type, final Object[] data )
public void renderInventory( final B block, final ItemStack item, final ModelGenerator renderer, final appeng.client.ItemRenderType type, final Object[] data )
{
final BlockRenderInfo info = block.getRendererInstance();
if( info.isValid() )

View File

@ -1,194 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.render;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nullable;
import org.lwjgl.opengl.GL11;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.parts.IAlphaPassItem;
import appeng.api.parts.IFacadePart;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartItem;
import appeng.api.util.AEPartLocation;
import appeng.client.ClientHelper;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import appeng.facade.IFacadeItem;
import appeng.util.Platform;
@SideOnly( Side.CLIENT )
public class BusRenderer implements IItemRenderer
{
public static final BusRenderer INSTANCE = new BusRenderer();
private static final Map<Integer, IPart> RENDER_PART = new HashMap<Integer, IPart>();
private ModelGenerator renderer;
@Override
public boolean handleRenderType( final ItemStack item, final ItemRenderType type )
{
return true;
}
@Override
public boolean shouldUseRenderHelper( final ItemRenderType type, final ItemStack item, final ItemRendererHelper helper )
{
return true;
}
@Override
public void renderItem( final ItemRenderType type, final ItemStack item, final Object... data )
{
if( item == null )
{
return;
}
GL11.glPushMatrix();
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
GL11.glEnable( GL11.GL_DEPTH_TEST );
GL11.glEnable( GL11.GL_TEXTURE_2D );
GL11.glEnable( GL11.GL_LIGHTING );
if( AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) && item.getItem() instanceof IAlphaPassItem && ( (IAlphaPassItem) item.getItem() ).useAlphaPass( item ) )
{
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
GL11.glDisable( GL11.GL_ALPHA_TEST );
GL11.glEnable( GL11.GL_BLEND );
}
else
{
GL11.glAlphaFunc( GL11.GL_GREATER, 0.4f );
GL11.glEnable( GL11.GL_ALPHA_TEST );
GL11.glDisable( GL11.GL_BLEND );
}
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
{
GL11.glTranslatef( -0.2f, -0.1f, -0.3f );
}
if( type == ItemRenderType.ENTITY )
{
GL11.glRotatef( 90.0f, 0.0f, 1.0f, 0.0f );
GL11.glScalef( 0.8f, 0.8f, 0.8f );
GL11.glTranslatef( -0.8f, -0.87f, -0.7f );
}
if( type == ItemRenderType.INVENTORY )
{
GL11.glTranslatef( 0.0f, -0.1f, 0.0f );
}
GL11.glTranslated( 0.2, 0.3, 0.1 );
GL11.glScaled( 1.2, 1.2, 1. );
GL11.glColor4f( 1, 1, 1, 1 );
this.getRenderer().setColorOpaque_F( 1, 1, 1 );
this.getRenderer().setBrightness( 14 << 20 | 14 << 4 );
BusRenderHelper.INSTANCE.setBounds( 0, 0, 0, 1, 1, 1 );
BusRenderHelper.INSTANCE.setTexture( null );
BusRenderHelper.INSTANCE.setInvColor( 0xffffff );
this.getRenderer().setBlockAccess( ClientHelper.proxy.getWorld() );
BusRenderHelper.INSTANCE.setOrientation( EnumFacing.EAST, EnumFacing.UP, EnumFacing.SOUTH );
this.getRenderer().setUvRotateBottom( this.getRenderer().setUvRotateEast( this.getRenderer().setUvRotateNorth( this.getRenderer().setUvRotateSouth( this.getRenderer().setUvRotateTop( this.getRenderer().setUvRotateWest( 0 ) ) ) ) ) );
this.getRenderer().setOverrideBlockTexture( null );
if( item.getItem() instanceof IFacadeItem )
{
final IFacadeItem fi = (IFacadeItem) item.getItem();
final IFacadePart fp = fi.createPartFromItemStack( item, AEPartLocation.SOUTH );
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
{
GL11.glRotatef( 160.0f, 0.0f, 1.0f, 0.0f );
GL11.glTranslated( -0.4, 0.1, -1.6 );
}
if( fp != null )
{
fp.renderInventory( BusRenderHelper.INSTANCE, this.getRenderer() );
}
}
else
{
final IPart ip = this.getRenderer( item, (IPartItem) item.getItem() );
if( ip != null )
{
if( type == ItemRenderType.ENTITY )
{
final int depth = ip.cableConnectionRenderTo();
GL11.glTranslatef( 0.0f, 0.0f, -0.04f * ( 8 - depth ) - 0.06f );
}
ip.renderInventory( BusRenderHelper.INSTANCE, this.getRenderer() );
}
}
this.getRenderer().setUvRotateBottom( this.getRenderer().setUvRotateEast( this.getRenderer().setUvRotateNorth( this.getRenderer().setUvRotateSouth( this.getRenderer().setUvRotateTop( this.getRenderer().setUvRotateWest( 0 ) ) ) ) ) );
GL11.glPopAttrib();
GL11.glPopMatrix();
}
@Nullable
private IPart getRenderer( final ItemStack is, final IPartItem c )
{
final int id = ( Item.getIdFromItem( is.getItem() ) << Platform.DEF_OFFSET ) | is.getItemDamage();
IPart part = RENDER_PART.get( id );
if( part == null )
{
part = c.createPartFromItemStack( is );
if( part != null )
{
RENDER_PART.put( id, part );
}
}
return part;
}
public ModelGenerator getRenderer()
{
return this.renderer;
}
public void setRenderer( final ModelGenerator renderer )
{
this.renderer = renderer;
}
}

View File

@ -6,7 +6,7 @@ import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import javax.vecmath.Vector3f;
import org.lwjgl.util.vector.Vector3f;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
@ -72,9 +72,9 @@ public class ModelGenerator
}
@Override
public TextureAtlasSprite getTexture()
public TextureAtlasSprite getParticleTexture()
{
return null;
return Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
}
@Override

View File

@ -2,7 +2,8 @@
package appeng.client.render;
import javax.vecmath.Vector3f;
import org.lwjgl.util.vector.Vector3f;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.EnumFacing;

View File

@ -23,6 +23,8 @@ import java.util.Random;
import org.lwjgl.opengl.GL11;
import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory.Default;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.GLAllocation;
@ -30,6 +32,7 @@ import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraftforge.client.IRenderHandler;
@ -107,12 +110,11 @@ public class SpatialSkyRender extends IRenderHandler
GL11.glRotatef( -90.0F, 0.0F, 0.0F, 1.0F );
}
worldrenderer.startDrawingQuads();
worldrenderer.setColorOpaque_I( 0 );
worldrenderer.addVertexWithUV( -100.0D, -100.0D, -100.0D, 0.0D, 0.0D );
worldrenderer.addVertexWithUV( -100.0D, -100.0D, 100.0D, 0.0D, 16.0D );
worldrenderer.addVertexWithUV( 100.0D, -100.0D, 100.0D, 16.0D, 16.0D );
worldrenderer.addVertexWithUV( 100.0D, -100.0D, -100.0D, 16.0D, 0.0D );
worldrenderer.begin( GL11.GL_QUADS, DefaultVertexFormats.ITEM );
worldrenderer.color(0f,0f,0f,1f).pos( -100.0D, -100.0D, -100.0D).tex( 0.0D, 0.0D ).endVertex();
worldrenderer.color(0f,0f,0f,1f).pos( -100.0D, -100.0D, 100.0D).tex( 0.0D, 16.0D ).endVertex();
worldrenderer.color(0f,0f,0f,1f).pos( 100.0D, -100.0D, 100.0D).tex( 16.0D, 16.0D ).endVertex();
worldrenderer.color(0f,0f,0f,1f).pos( 100.0D, -100.0D, -100.0D).tex( 16.0D, 0.0D ).endVertex();
tessellator.draw();
GL11.glPopMatrix();
}
@ -146,7 +148,7 @@ public class SpatialSkyRender extends IRenderHandler
{
final Tessellator tessellator = Tessellator.getInstance();
final WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.startDrawingQuads();
worldrenderer.begin( GL11.GL_QUADS, DefaultVertexFormats.ITEM );
for( int i = 0; i < 50; ++i )
{
@ -186,7 +188,7 @@ public class SpatialSkyRender extends IRenderHandler
final double d23 = d17 * d12 - d20 * d13;
final double d24 = d23 * d9 - d21 * d10;
final double d25 = d21 * d9 + d23 * d10;
worldrenderer.addVertex( x + d24, y + d22, z + d25 );
worldrenderer.pos( x + d24, y + d22, z + d25 ).endVertex();
}
}
}

View File

@ -25,11 +25,11 @@ import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.block.AEBaseBlock;
import appeng.client.ItemRenderType;
import appeng.core.AELog;

View File

@ -26,7 +26,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.api.networking.IGridHost;
import appeng.api.parts.IBoxProvider;
@ -36,6 +35,7 @@ import appeng.api.parts.IPartHost;
import appeng.api.util.AEPartLocation;
import appeng.api.util.IOrientable;
import appeng.block.crafting.BlockMolecularAssembler;
import appeng.client.ItemRenderType;
import appeng.client.render.BaseBlockRender;
import appeng.client.render.BusRenderer;
import appeng.client.render.ModelGenerator;

View File

@ -31,7 +31,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.api.util.AEPartLocation;
import appeng.api.util.IOrientable;
@ -159,7 +159,6 @@ public class RenderBlockCharger extends BaseBlockRender<BlockCharger, TileCharge
GL11.glDisable( GL11.GL_LIGHTING );
GL11.glDisable( GL12.GL_RESCALE_NORMAL );
tess.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
this.doRenderItem( sis, tile );
}

View File

@ -166,7 +166,6 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU<BlockC
GL11.glDisable( GL11.GL_LIGHTING );
GL11.glDisable( GL12.GL_RESCALE_NORMAL );
// RenderHelper.enableGUIStandardItemLighting();
tess.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
ClientHelper.proxy.doRenderItem( sis, cmt.getWorld() );
}

View File

@ -30,7 +30,7 @@ import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.block.grindstone.BlockCrank;
import appeng.client.render.BaseBlockRender;

View File

@ -22,7 +22,7 @@ package appeng.client.render.blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.block.networking.BlockEnergyCell;

View File

@ -30,11 +30,12 @@ import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.api.features.IInscriberRecipe;
import appeng.api.util.AEPartLocation;
@ -191,32 +192,32 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
press -= progress / 5.0f;
final IAESprite ic = ExtraBlockTextures.BlockInscriberInside.getIcon();
tess.startDrawingQuads();
tess.begin( GL11.GL_QUADS, DefaultVertexFormats.ITEM );
float middle = 0.5f;
middle += 0.02f;
final float TwoPx = 2.0f / 16.0f;
tess.addVertexWithUV( TwoPx, middle + press, TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 2 ) );
tess.addVertexWithUV( 1.0 - TwoPx, middle + press, TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 2 ) );
tess.addVertexWithUV( 1.0 - TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 13 ) );
tess.addVertexWithUV( TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 13 ) );
tess.pos( TwoPx, middle + press, TwoPx).tex( ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 2 ) ).endVertex();
tess.pos( 1.0 - TwoPx, middle + press, TwoPx ).tex( ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 2 ) ).endVertex();
tess.pos( 1.0 - TwoPx, middle + press, 1.0 - TwoPx).tex( ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 13 ) ).endVertex();
tess.pos( TwoPx, middle + press, 1.0 - TwoPx).tex( ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 13 ) ).endVertex();
tess.addVertexWithUV( TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 ) );
tess.addVertexWithUV( 1.0 - TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 ) );
tess.pos( TwoPx, middle + press, 1.0 - TwoPx).tex( ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 ) ).endVertex();
tess.pos( 1.0 - TwoPx, middle + press, 1.0 - TwoPx).tex( ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 ) ).endVertex();
final float base = 0.4f;
tess.addVertexWithUV( 1.0 - TwoPx, middle + base, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) );
tess.addVertexWithUV( TwoPx, middle + base, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) );
tess.pos( 1.0 - TwoPx, middle + base, 1.0 - TwoPx).tex( ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) ).endVertex();
tess.pos( TwoPx, middle + base, 1.0 - TwoPx).tex( ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) ).endVertex();
middle -= 2.0f * 0.02f;
tess.addVertexWithUV( 1.0 - TwoPx, middle - press, TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 2 ) );
tess.addVertexWithUV( TwoPx, middle - press, TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 2 ) );
tess.addVertexWithUV( TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 13 ) );
tess.addVertexWithUV( 1.0 - TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 13 ) );
tess.pos( 1.0 - TwoPx, middle - press, TwoPx).tex( ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 2 ) ).endVertex();
tess.pos( TwoPx, middle - press, TwoPx).tex( ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 2 ) ).endVertex();
tess.pos( TwoPx, middle - press, 1.0 - TwoPx).tex( ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 13 ) ).endVertex();
tess.pos( 1.0 - TwoPx, middle - press, 1.0 - TwoPx).tex( ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 13 ) ).endVertex();
tess.addVertexWithUV( 1.0 - TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 ) );
tess.addVertexWithUV( TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 ) );
tess.addVertexWithUV( TwoPx, middle - base, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) );
tess.addVertexWithUV( 1.0 - TwoPx, middle + -base, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) );
tess.pos( 1.0 - TwoPx, middle - press, 1.0 - TwoPx).tex( ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 ) ).endVertex();
tess.pos( TwoPx, middle - press, 1.0 - TwoPx).tex( ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 ) ).endVertex();
tess.pos( TwoPx, middle - base, 1.0 - TwoPx).tex( ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) ).endVertex();
tess.pos( 1.0 - TwoPx, middle + -base, 1.0 - TwoPx).tex( ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) ).endVertex();
Tessellator.getInstance().draw();
@ -301,7 +302,6 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
GL11.glDisable( GL11.GL_LIGHTING );
GL11.glDisable( GL12.GL_RESCALE_NORMAL );
tess.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
this.doRenderItem( sis, tile );
}

View File

@ -25,7 +25,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.block.misc.BlockPaint;
import appeng.client.render.BaseBlockRender;

View File

@ -30,7 +30,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.block.storage.BlockSkyChest;
import appeng.block.storage.BlockSkyChest.SkyChestType;

View File

@ -29,7 +29,7 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.block.misc.BlockSkyCompass;
import appeng.client.render.BaseBlockRender;

View File

@ -25,7 +25,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;

View File

@ -25,7 +25,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.api.util.AEPartLocation;
import appeng.block.storage.BlockDrive;

View File

@ -25,7 +25,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.api.AEApi;
import appeng.api.storage.ICellHandler;

View File

@ -22,7 +22,7 @@ package appeng.client.render.blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender;

View File

@ -28,7 +28,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.api.AEApi;
import appeng.api.definitions.IBlocks;

View File

@ -24,7 +24,7 @@ import java.util.Random;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.api.AEApi;
import appeng.api.util.AEPartLocation;

View File

@ -22,7 +22,7 @@ package appeng.client.render.blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.client.render.BaseBlockRender;
import appeng.client.render.ModelGenerator;

View File

@ -25,7 +25,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.api.util.AEPartLocation;
import appeng.api.util.IOrientable;

View File

@ -23,7 +23,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.api.util.AEPartLocation;
import appeng.block.spatial.BlockSpatialPylon;

View File

@ -24,7 +24,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.block.misc.BlockTinyTNT;
import appeng.client.render.BaseBlockRender;

View File

@ -28,7 +28,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.api.parts.IFacadePart;
import appeng.api.parts.IPart;

View File

@ -25,7 +25,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import appeng.client.ItemRenderType;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;

View File

@ -97,11 +97,10 @@ public class CraftingFx extends EntityBreakingFX
// AELog.info( "" + partialTick );
final float f14 = 1.0F;
par1Tessellator.setColorRGBA_F( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha );
par1Tessellator.addVertexWithUV( offX - x * scale - rx * scale, offY - y * scale, offZ - z * scale - rz * scale, f7, f9 );
par1Tessellator.addVertexWithUV( offX - x * scale + rx * scale, offY + y * scale, offZ - z * scale + rz * scale, f7, f8 );
par1Tessellator.addVertexWithUV( offX + x * scale + rx * scale, offY + y * scale, offZ + z * scale + rz * scale, f6, f8 );
par1Tessellator.addVertexWithUV( offX + x * scale - rx * scale, offY - y * scale, offZ + z * scale - rz * scale, f6, f9 );
par1Tessellator.color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha ).pos( offX - x * scale - rx * scale, offY - y * scale, offZ - z * scale - rz * scale).tex( f7, f9 ).endVertex();
par1Tessellator.color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha ).pos( offX - x * scale + rx * scale, offY + y * scale, offZ - z * scale + rz * scale).tex( f7, f8 ).endVertex();
par1Tessellator.color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha ).pos( offX + x * scale + rx * scale, offY + y * scale, offZ + z * scale + rz * scale).tex( f6, f8 ).endVertex();
par1Tessellator.color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha ).pos( offX + x * scale - rx * scale, offY - y * scale, offZ + z * scale - rz * scale).tex( f6, f9 ).endVertex();
}
}

View File

@ -87,11 +87,10 @@ public class EnergyFx extends EntityBreakingFX
if( blkX == this.startBlkX && blkY == this.startBlkY && blkZ == this.startBlkZ )
{
final float f14 = 1.0F;
par1Tessellator.setColorRGBA_F( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha );
par1Tessellator.addVertexWithUV( f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10, f7, f9 );
par1Tessellator.addVertexWithUV( f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10, f7, f8 );
par1Tessellator.addVertexWithUV( f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10, f6, f8 );
par1Tessellator.addVertexWithUV( f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10, f6, f9 );
par1Tessellator.color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha ).pos( f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10).tex( f7, f9 ).endVertex();
par1Tessellator.color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha ).pos( f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10).tex( f7, f8 ).endVertex();
par1Tessellator.color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha ).pos( f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10).tex( f6, f8 ).endVertex();
par1Tessellator.color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha ).pos( f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10).tex( f6, f9 ).endVertex();
}
}

View File

@ -87,7 +87,11 @@ public class LightningFX extends EntityFX
public void renderParticle( final WorldRenderer tess, final Entity p_180434_2_, final float l, final float rX, final float rY, final float rZ, final float rYZ, final float rXY )
{
final float j = 1.0f;
tess.setColorRGBA_F( this.particleRed * j * 0.9f, this.particleGreen * j * 0.95f, this.particleBlue * j, this.particleAlpha );
float red = this.particleRed * j * 0.9f;
float green = this.particleGreen * j * 0.95f;
float blue = this.particleBlue * j;
float alpha = this.particleAlpha;
if( this.particleAge == 3 )
{
this.regen();
@ -122,7 +126,9 @@ public class LightningFX extends EntityFX
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 );
red=this.particleRed * j * 0.4f;
green=this.particleGreen * j * 0.25f;
blue= this.particleBlue * j * 0.45f;
}
else
{
@ -130,7 +136,9 @@ public class LightningFX extends EntityFX
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 );
red= this.particleRed * j * 0.9f;
green = this.particleGreen * j * 0.65f;
blue = this.particleBlue * j * 0.85f;
}
for( int cycle = 0; cycle < 3; cycle++ )
@ -183,7 +191,7 @@ public class LightningFX extends EntityFX
b[1] = y;
b[2] = z;
this.draw( tess, a, b, f6, f8 );
this.draw( red,green,blue,tess, a, b, f6, f8 );
x = xN;
y = yN;
@ -202,14 +210,14 @@ public class LightningFX extends EntityFX
this.hasData = false;
}
private void draw( final WorldRenderer tess, final double[] a, final double[] b, final double f6, final double f8 )
private void draw( float red,float green, float blue, final WorldRenderer tess, final double[] a, final double[] b, final double f6, final double f8 )
{
if( this.hasData )
{
tess.addVertexWithUV( a[0], a[1], a[2], f6, f8 );
tess.addVertexWithUV( this.vertices[0], this.vertices[1], this.vertices[2], f6, f8 );
tess.addVertexWithUV( this.verticesWithUV[0], this.verticesWithUV[1], this.verticesWithUV[2], f6, f8 );
tess.addVertexWithUV( b[0], b[1], b[2], f6, f8 );
tess.color(red,green,blue,particleAlpha).pos( a[0], a[1], a[2]).tex( f6, f8 ).endVertex();
tess.color(red,green,blue,particleAlpha).pos( this.vertices[0], this.vertices[1], this.vertices[2]).tex( f6, f8 ).endVertex();
tess.color(red,green,blue,particleAlpha).pos( this.verticesWithUV[0], this.verticesWithUV[1], this.verticesWithUV[2]).tex( f6, f8 ).endVertex();
tess.color(red,green,blue,particleAlpha).pos( b[0], b[1], b[2]).tex( f6, f8 ).endVertex();
}
this.hasData = true;
for( int x = 0; x < 3; x++ )

View File

@ -84,10 +84,9 @@ public class MatterCannonFX extends EntityBreakingFX
final float f13 = (float) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * par2 - interpPosZ );
final float f14 = 1.0F;
par1Tessellator.setColorRGBA_F( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha );
par1Tessellator.addVertexWithUV( f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10, f7, f9 );
par1Tessellator.addVertexWithUV( f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10, f7, f8 );
par1Tessellator.addVertexWithUV( f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10, f6, f8 );
par1Tessellator.addVertexWithUV( f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10, f6, f9 );
}
par1Tessellator.color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha ).pos( f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10).tex( f7, f9 );
par1Tessellator.color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha ).pos( f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10).tex( f7, f8 );
par1Tessellator.color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha ).pos( f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10).tex( f6, f8 );
par1Tessellator.color( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha ).pos( f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10).tex( f6, f9 );
}
}

View File

@ -19,26 +19,27 @@
package appeng.client.render.items;
import appeng.client.ItemRenderType;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
public class ToolBiometricCardRender implements IItemRenderer // TileEntityItemStackRenderer
// TODO - PORT
public class ToolBiometricCardRender // TileEntityItemStackRenderer
{
@Override
public boolean handleRenderType( final ItemStack item, final ItemRenderType type )
{
return true;
}
@Override
public boolean shouldUseRenderHelper( final ItemRenderType type, final ItemStack item, final ItemRendererHelper helper )
public boolean shouldUseRenderHelper( final ItemRenderType type, final ItemStack item )//, final ItemRendererHelper helper )
{
return helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION;
return false;//return helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION;
}
@Override
public void renderItem( final ItemRenderType type, final ItemStack item, final Object... data )
{
/*

View File

@ -19,26 +19,23 @@
package appeng.client.render.items;
import appeng.client.ItemRenderType;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
public class ToolColorApplicatorRender implements IItemRenderer
public class ToolColorApplicatorRender
{
@Override
public boolean handleRenderType( final ItemStack item, final ItemRenderType type )
{
return true;
}
@Override
public boolean shouldUseRenderHelper( final ItemRenderType type, final ItemStack item, final ItemRendererHelper helper )
public boolean shouldUseRenderHelper( final ItemRenderType type, final ItemStack item )
{
return helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION;
return false;//return helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION;
}
@Override
public void renderItem( final ItemRenderType type, final ItemStack item, final Object... data )
{
/*

View File

@ -287,10 +287,10 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
}
@Override
public ItemStack getStackInSlotOnClosing( final int i )
public ItemStack removeStackFromSlot( final int i )
{
final IInventory inv = ContainerCellWorkbench.this.getCellUpgradeInventory();
final ItemStack is = inv.getStackInSlotOnClosing( i );
final ItemStack is = inv.removeStackFromSlot( i );
inv.markDirty();
return is;
}
@ -304,7 +304,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
}
@Override
public String getCommandSenderName()
public String getName()
{
return "Upgrades";
}

View File

@ -183,7 +183,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
}
@Override
public ItemStack getStackInSlotOnClosing( final int var1 )
public ItemStack removeStackFromSlot( final int var1 )
{
return null;
}
@ -198,7 +198,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
}
@Override
public String getCommandSenderName()
public String getName()
{
return "Quartz Knife Output";
}

View File

@ -61,7 +61,7 @@ import appeng.services.version.VersionCheckerConfig;
import appeng.util.Platform;
@Mod( modid = AppEng.MOD_ID, acceptedMinecraftVersions = "[1.8]", name = AppEng.MOD_NAME, version = AEConfig.VERSION, dependencies = AppEng.MOD_DEPENDENCIES, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" )
@Mod( modid = AppEng.MOD_ID, acceptedMinecraftVersions = "[1.8.8,1.8.9]", name = AppEng.MOD_NAME, version = AEConfig.VERSION, dependencies = AppEng.MOD_DEPENDENCIES, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" )
public final class AppEng
{
public static final String MOD_ID = "appliedenergistics2";

View File

@ -23,8 +23,8 @@ import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ITickable;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.Ticket;
@ -39,7 +39,7 @@ import appeng.tile.events.TileEventType;
import appeng.util.Platform;
public class TileChunkLoader extends AEBaseTile implements IUpdatePlayerListBox
public class TileChunkLoader extends AEBaseTile implements ITickable
{
private boolean requestTicket = true;

View File

@ -22,11 +22,10 @@ package appeng.debug;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import appeng.core.CommonHelper;
import appeng.tile.AEBaseTile;
import appeng.tile.TileEvent;
@ -34,7 +33,7 @@ import appeng.tile.events.TileEventType;
import appeng.util.Platform;
public class TileCubeGenerator extends AEBaseTile implements IUpdatePlayerListBox
public class TileCubeGenerator extends AEBaseTile implements ITickable
{
private int size = 3;

View File

@ -92,7 +92,7 @@ public class TileItemGen extends AEBaseTile implements IInventory
}
@Override
public ItemStack getStackInSlotOnClosing( final int i )
public ItemStack removeStackFromSlot( final int i )
{
return null;
}
@ -105,7 +105,7 @@ public class TileItemGen extends AEBaseTile implements IInventory
}
@Override
public String getCommandSenderName()
public String getName()
{
return null;
}

View File

@ -25,6 +25,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderEntityItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -42,7 +43,7 @@ public class RenderFloatingItem extends RenderEntityItem
@Override
public void doRender(
final Entity entityItem,
final EntityItem entityItem,
final double x,
final double y,
final double z,

View File

@ -1,175 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.BCHelpers;
import java.util.Set;
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.Vec3;
import buildcraft.api.blueprints.IBuilderContext;
import appeng.api.parts.IFacadeContainer;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartHost;
import appeng.api.parts.LayerFlags;
import appeng.api.parts.SelectedPart;
import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord;
import appeng.api.util.ForgeDirection;
import appeng.parts.CableBusContainer;
public class AECableSchematicTile extends AEGenericSchematicTile implements IPartHost
{
@Override
public void rotateLeft( IBuilderContext context )
{
CableBusContainer cbc = new CableBusContainer( this );
cbc.readFromNBT( this.tileNBT );
cbc.rotateLeft();
this.tileNBT = new NBTTagCompound();
cbc.writeToNBT( this.tileNBT );
}
@Override
public IFacadeContainer getFacadeContainer()
{
return null;
}
@Override
public boolean canAddPart( ItemStack part, ForgeDirection side )
{
return false;
}
@Override
public ForgeDirection addPart( ItemStack is, ForgeDirection side, EntityPlayer owner )
{
return null;
}
@Override
public IPart getPart( ForgeDirection side )
{
return null;
}
@Override
public void removePart( ForgeDirection side, boolean suppressUpdate )
{
}
@Override
public void markForUpdate()
{
}
@Override
public DimensionalCoord getLocation()
{
return null;
}
@Override
public TileEntity getTile()
{
return null;
}
@Override
public AEColor getColor()
{
return null;
}
@Override
public void clearContainer()
{
}
@Override
public boolean isBlocked( ForgeDirection side )
{
return false;
}
@Override
public SelectedPart selectPart( Vec3 pos )
{
return null;
}
@Override
public void markForSave()
{
}
@Override
public void partChanged()
{
}
@Override
public boolean hasRedstone( ForgeDirection side )
{
return false;
}
@Override
public boolean isEmpty()
{
return false;
}
@Override
public Set<LayerFlags> getLayerFlags()
{
return null;
}
@Override
public void cleanup()
{
}
@Override
public void notifyNeighbors()
{
}
@Override
public boolean isInWorld()
{
return false;
}
}

View File

@ -1,79 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.BCHelpers;
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.SchematicTile;
import appeng.api.util.ForgeDirection;
import appeng.api.util.ICommonTile;
import appeng.tile.AEBaseTile;
import appeng.util.Platform;
public class AEGenericSchematicTile extends SchematicTile
{
@Override
public void storeRequirements( IBuilderContext context, int x, int y, int z )
{
TileEntity tile = context.world().getTileEntity( x, y, z );
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
if( tile instanceof AEBaseTile )
{
ICommonTile tcb = (ICommonTile) tile;
tcb.getDrops( tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, list );
}
this.storedRequirements = list.toArray( new ItemStack[list.size()] );
}
@Override
public void rotateLeft( IBuilderContext context )
{
if( this.tileNBT.hasKey( "orientation_forward" ) && this.tileNBT.hasKey( "orientation_up" ) )
{
String forward = this.tileNBT.getString( "orientation_forward" );
String up = this.tileNBT.getString( "orientation_up" );
if( forward != null && up != null )
{
try
{
ForgeDirection fdForward = ForgeDirection.valueOf( forward );
ForgeDirection fdUp = ForgeDirection.valueOf( up );
fdForward = Platform.rotateAround( fdForward, ForgeDirection.DOWN );
fdUp = Platform.rotateAround( fdUp, ForgeDirection.DOWN );
this.tileNBT.setString( "orientation_forward", fdForward.name() );
this.tileNBT.setString( "orientation_up", fdUp.name() );
}
catch( Throwable ignored )
{
}
}
}
}
}

View File

@ -1,40 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.BCHelpers;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.SchematicBlock;
import appeng.api.util.ForgeDirection;
import appeng.util.Platform;
public class AERotatableBlockSchematic extends SchematicBlock
{
@Override
public void rotateLeft( IBuilderContext context )
{
if( this.meta < 6 )
{
ForgeDirection d = Platform.rotateAround( ForgeDirection.values()[this.meta], ForgeDirection.DOWN );
this.meta = d.ordinal();
}
}
}

View File

@ -1,58 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.BCHelpers;
import net.minecraft.tileentity.TileEntity;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IExternalStorageHandler;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.StorageChannel;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.api.util.ForgeDirection;
import appeng.integration.abstraction.IBuildCraftTransport;
public class BCPipeHandler implements IExternalStorageHandler
{
@Override
public boolean canHandle( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc )
{
if ( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
return chan == StorageChannel.ITEMS && bc.isPipe( te, d );
}
return false;
}
@Override
public IMEInventory getInventory( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource src )
{
if( chan == StorageChannel.ITEMS )
{
return new BCPipeInventory( te, d );
}
return null;
}
}

View File

@ -1,89 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.BCHelpers;
import net.minecraft.tileentity.TileEntity;
import appeng.api.config.Actionable;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.ForgeDirection;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBuildCraftTransport;
public class BCPipeInventory implements IMEInventory<IAEItemStack>
{
private final TileEntity te;
private final ForgeDirection direction;
public BCPipeInventory( TileEntity te, ForgeDirection direction )
{
this.te = te;
this.direction = direction;
}
@Override
public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src )
{
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
final IBuildCraftTransport registry = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
if( mode == Actionable.SIMULATE )
{
if( registry.canAddItemsToPipe( this.te, input.getItemStack(), this.direction ) )
{
return null;
}
return input;
}
if( registry.addItemsToPipe( this.te, input.getItemStack(), this.direction ) )
{
return null;
}
}
return input;
}
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
{
return null;
}
@Override
public IItemList<IAEItemStack> getAvailableItems( IItemList<IAEItemStack> out )
{
return out;
}
@Override
public StorageChannel getChannel()
{
return StorageChannel.ITEMS;
}
}

View File

@ -1,70 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
import appeng.api.AEApi;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import appeng.integration.abstraction.IBetterStorage;
import appeng.integration.modules.helpers.BSCrateHandler;
import appeng.integration.modules.helpers.BSCrateStorageAdaptor;
import appeng.util.InventoryAdaptor;
public class BetterStorage implements IIntegrationModule, IBetterStorage
{
@Reflected
public static BetterStorage instance;
@Reflected
public BetterStorage()
{
IntegrationHelper.testClassExistence( this, net.mcft.copy.betterstorage.api.crate.ICrateStorage.class );
}
@Override
public boolean isStorageCrate( Object te )
{
return te instanceof ICrateStorage;
}
@Override
public InventoryAdaptor getAdaptor( Object te, ForgeDirection d )
{
if( te instanceof ICrateStorage )
{
return new BSCrateStorageAdaptor( te );
}
return null;
}
@Override
public void init()
{
}
@Override
public void postInit()
{
AEApi.instance().registries().externalStorage().addExternalStorageInterface( new BSCrateHandler() );
}
}

View File

@ -1,130 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import com.google.common.base.Optional;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.BuilderAPI;
import buildcraft.api.blueprints.ISchematicRegistry;
import appeng.api.AEApi;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IBlocks;
import appeng.api.definitions.ITileDefinition;
import appeng.api.util.IOrientableBlock;
import appeng.core.AELog;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import appeng.integration.modules.BCHelpers.AECableSchematicTile;
import appeng.integration.modules.BCHelpers.AEGenericSchematicTile;
import appeng.integration.modules.BCHelpers.AERotatableBlockSchematic;
/**
* The builder has no interface, because it provides no functionality
*
* @author thatsIch
* @version rv3 - 12.06.2015
* @since rv3 12.06.2015
*/
@Reflected
public class BuildCraftBuilder implements IIntegrationModule
{
@Reflected
public static BuildCraftBuilder instance;
@Reflected
public BuildCraftBuilder()
{
IntegrationHelper.testClassExistence( this, buildcraft.api.blueprints.BuilderAPI.class );
IntegrationHelper.testClassExistence( this, buildcraft.api.blueprints.IBuilderContext.class );
IntegrationHelper.testClassExistence( this, buildcraft.api.blueprints.ISchematicRegistry.class );
IntegrationHelper.testClassExistence( this, buildcraft.api.blueprints.SchematicTile.class );
IntegrationHelper.testClassExistence( this, buildcraft.api.blueprints.SchematicBlock.class );
}
@Override
public void init() throws Throwable
{
try
{
this.initBuilderSupport();
}
catch( Exception builderSupport )
{
// not supported?
}
}
@Override
public void postInit()
{
}
private void initBuilderSupport()
{
final ISchematicRegistry schematicRegistry = BuilderAPI.schematicRegistry;
final IBlocks blocks = AEApi.instance().definitions().blocks();
final IBlockDefinition maybeMultiPart = blocks.multiPart();
for( Method blockDefinition : blocks.getClass().getMethods() )
{
try
{
final IBlockDefinition def = (IBlockDefinition) blockDefinition.invoke( blocks );
final Optional<Block> maybeBlock = def.maybeBlock();
if( !maybeBlock.isPresent() )
{
continue;
}
final Block block = maybeBlock.get();
if( block instanceof IOrientableBlock && ( (IOrientableBlock) block ).usesMetadata() && !( def instanceof ITileDefinition ) )
{
schematicRegistry.registerSchematicBlock( block, AERotatableBlockSchematic.class );
}
else if( maybeMultiPart.isSameAs( new ItemStack( block ) ) )
{
schematicRegistry.registerSchematicBlock( block, AECableSchematicTile.class );
}
else if( def instanceof ITileDefinition )
{
schematicRegistry.registerSchematicBlock( block, AEGenericSchematicTile.class );
}
}
catch( InvocationTargetException ignore )
{
AELog.warning( "Encountered problems while initializing the BuildCraft Builder support. Can not invoke the method %s", blockDefinition );
}
catch( IllegalAccessException ignore )
{
AELog.warning( "Encountered problems while initializing the BuildCraft Builder support. Can not access the method %s", blockDefinition );
}
}
}
}

View File

@ -1,90 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import buildcraft.api.tools.IToolWrench;
import appeng.api.AEApi;
import appeng.api.config.TunnelType;
import appeng.api.features.IP2PTunnelRegistry;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import appeng.integration.abstraction.IBuildCraftCore;
@Reflected
public final class BuildCraftCore implements IBuildCraftCore, IIntegrationModule
{
@Reflected
public static BuildCraftCore instance;
@Reflected
public BuildCraftCore()
{
IntegrationHelper.testClassExistence( this, buildcraft.BuildCraftCore.class );
IntegrationHelper.testClassExistence( this, buildcraft.BuildCraftTransport.class );
IntegrationHelper.testClassExistence( this, buildcraft.api.tools.IToolWrench.class );
}
@Override
public boolean isWrench( Item eq )
{
return eq instanceof IToolWrench;
}
@Override
public boolean canWrench( @Nonnull Item wrench, EntityPlayer wrencher, int x, int y, int z )
{
return ( (IToolWrench) wrench ).canWrench( wrencher, x, y, z );
}
@Override
public void wrenchUsed( @Nonnull Item wrench, EntityPlayer wrencher, int x, int y, int z )
{
( (IToolWrench) wrench ).wrenchUsed( wrencher, x, y, z );
}
@Override
public void init()
{
}
@Override
public void postInit()
{
this.registerPowerP2P();
}
private void registerPowerP2P()
{
final IP2PTunnelRegistry registry = AEApi.instance().registries().p2pTunnel();
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftCore.engineBlock, 1, 0 ), TunnelType.RF_POWER );
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftCore.engineBlock, 1, 1 ), TunnelType.RF_POWER );
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftCore.engineBlock, 1, 2 ), TunnelType.RF_POWER );
}
}

View File

@ -1,302 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.event.FMLInterModComms;
import buildcraft.api.facades.IFacadeItem;
import buildcraft.api.transport.IInjectable;
import buildcraft.api.transport.IPipeTile;
import buildcraft.transport.ItemFacade;
import buildcraft.transport.PipeIconProvider;
import appeng.api.AEApi;
import appeng.api.IAppEngApi;
import appeng.api.config.TunnelType;
import appeng.api.definitions.IBlocks;
import appeng.api.definitions.IItemDefinition;
import appeng.api.features.IP2PTunnelRegistry;
import appeng.api.parts.IFacadePart;
import appeng.facade.FacadePart;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import appeng.integration.abstraction.IBuildCraftTransport;
import appeng.integration.modules.BCHelpers.BCPipeHandler;
/**
* @author thatsIch
* @version rv3 - 12.06.2015
* @since rv3 12.06.2015
*/
@Reflected
public class BuildCraftTransport implements IBuildCraftTransport, IIntegrationModule
{
@Reflected
public static BuildCraftTransport instance;
@Reflected
public BuildCraftTransport()
{
IntegrationHelper.testClassExistence( this, buildcraft.BuildCraftTransport.class );
IntegrationHelper.testClassExistence( this, buildcraft.api.facades.IFacadeItem.class );
IntegrationHelper.testClassExistence( this, buildcraft.api.transport.IInjectable.class );
IntegrationHelper.testClassExistence( this, buildcraft.api.transport.IPipeConnection.class );
IntegrationHelper.testClassExistence( this, buildcraft.api.transport.IPipeTile.class );
IntegrationHelper.testClassExistence( this, buildcraft.api.transport.IPipeTile.PipeType.class );
IntegrationHelper.testClassExistence( this, buildcraft.transport.ItemFacade.class );
IntegrationHelper.testClassExistence( this, buildcraft.transport.PipeIconProvider.class );
}
@Override
public boolean isFacade( ItemStack is )
{
if( is == null )
{
return false;
}
return is.getItem() instanceof IFacadeItem;
}
@Nullable
@Override
public IFacadePart createFacadePart( Block blk, int meta, @Nonnull ForgeDirection side )
{
try
{
final ItemFacade.FacadeState state = ItemFacade.FacadeState.create( blk, meta );
final ItemStack facade = ItemFacade.getFacade( state );
return new FacadePart( facade, side );
}
catch( Exception ignored )
{
}
return null;
}
@Override
public IFacadePart createFacadePart( @Nonnull ItemStack fs, @Nonnull ForgeDirection side )
{
return new FacadePart( fs, side );
}
@Nullable
@Override
public ItemStack getTextureForFacade( @Nonnull ItemStack facade )
{
final Item maybeFacadeItem = facade.getItem();
if( maybeFacadeItem instanceof IFacadeItem )
{
final IFacadeItem facadeItem = (IFacadeItem) maybeFacadeItem;
final Block[] blocks = facadeItem.getBlocksForFacade( facade );
final int[] metas = facadeItem.getMetaValuesForFacade( facade );
if( blocks.length > 0 && metas.length > 0 )
{
return new ItemStack( blocks[0], 1, metas[0] );
}
}
return null;
}
@Nullable
@Override
public IIcon getCobbleStructurePipeTexture()
{
try
{
return buildcraft.BuildCraftTransport.instance.pipeIconProvider.getIcon( PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal() ); // Structure
}
catch( Exception ignored )
{
}
return null;
// Pipe
}
@Override
public boolean isPipe( TileEntity te, @Nonnull ForgeDirection dir )
{
if( te instanceof IPipeTile )
{
final IPipeTile pipeTile = (IPipeTile) te;
return !pipeTile.hasPipePluggable( dir.getOpposite() );
}
return false;
}
@Override
public boolean canAddItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir )
{
if( is != null && te != null && te instanceof IInjectable )
{
IInjectable pt = (IInjectable) te;
if( pt.canInjectItems( dir ) )
{
int amt = pt.injectItem( is, false, dir, null );
if( amt == is.stackSize )
{
return true;
}
}
}
return false;
}
@Override
public boolean addItemsToPipe( @Nullable TileEntity te, @Nullable ItemStack is, @Nonnull ForgeDirection dir )
{
if( is != null && te != null && te instanceof IInjectable )
{
IInjectable pt = (IInjectable) te;
if( pt.canInjectItems( dir ) )
{
int amt = pt.injectItem( is, false, dir, null );
if( amt == is.stackSize )
{
pt.injectItem( is, true, dir, null );
return true;
}
}
}
return false;
}
private void addFacade( ItemStack item )
{
if( item != null )
{
FMLInterModComms.sendMessage( "BuildCraft|Transport", "add-facade", item );
}
}
private void registerPowerP2P()
{
final IP2PTunnelRegistry registry = AEApi.instance().registries().p2pTunnel();
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerCobblestone ), TunnelType.RF_POWER );
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerDiamond ), TunnelType.RF_POWER );
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerGold ), TunnelType.RF_POWER );
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerQuartz ), TunnelType.RF_POWER );
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerStone ), TunnelType.RF_POWER );
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipePowerWood ), TunnelType.RF_POWER );
}
private void registerItemP2P()
{
final IP2PTunnelRegistry registry = AEApi.instance().registries().p2pTunnel();
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsWood ), TunnelType.ITEM );
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsVoid ), TunnelType.ITEM );
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsSandstone ), TunnelType.ITEM );
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsQuartz ), TunnelType.ITEM );
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsObsidian ), TunnelType.ITEM );
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsIron ), TunnelType.ITEM );
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsGold ), TunnelType.ITEM );
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsEmerald ), TunnelType.ITEM );
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsDiamond ), TunnelType.ITEM );
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsStone ), TunnelType.ITEM );
registry.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeItemsCobblestone ), TunnelType.ITEM );
}
private void registerLiquidsP2P()
{
IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsCobblestone ), TunnelType.FLUID );
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsEmerald ), TunnelType.FLUID );
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsGold ), TunnelType.FLUID );
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsIron ), TunnelType.FLUID );
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsSandstone ), TunnelType.FLUID );
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsStone ), TunnelType.FLUID );
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsVoid ), TunnelType.FLUID );
reg.addNewAttunement( new ItemStack( buildcraft.BuildCraftTransport.pipeFluidsWood ), TunnelType.FLUID );
}
@Override
public void init() throws Throwable
{
this.initPipeConnection();
this.initFacades();
}
@Override
public void postInit()
{
this.registerPowerP2P();
this.registerItemP2P();
this.registerLiquidsP2P();
}
private void initPipeConnection()
{
final IAppEngApi api = AEApi.instance();
api.partHelper().registerNewLayer( "appeng.parts.layers.LayerIPipeConnection", "buildcraft.api.transport.IPipeConnection" );
api.registries().externalStorage().addExternalStorageInterface( new BCPipeHandler() );
}
private void initFacades()
{
final IAppEngApi api = AEApi.instance();
final IBlocks blocks = api.definitions().blocks();
this.addFacadeStack( blocks.fluix() );
this.addFacadeStack( blocks.quartz() );
this.addFacadeStack( blocks.quartzChiseled() );
this.addFacadeStack( blocks.quartzPillar() );
for( Block skyStoneBlock : blocks.skyStone().maybeBlock().asSet() )
{
this.addFacade( new ItemStack( skyStoneBlock, 1, 0 ) );
this.addFacade( new ItemStack( skyStoneBlock, 1, 1 ) );
this.addFacade( new ItemStack( skyStoneBlock, 1, 2 ) );
this.addFacade( new ItemStack( skyStoneBlock, 1, 3 ) );
}
}
private void addFacadeStack( IItemDefinition definition )
{
for( ItemStack facadeStack : definition.maybeStack( 1 ).asSet() )
{
this.addFacade( facadeStack );
}
}
}

View File

@ -1,62 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import appeng.api.util.AEColor;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import appeng.integration.abstraction.ICLApi;
public class CLApi implements ICLApi, IIntegrationModule
{
@Reflected
public static CLApi instance;
@Reflected
public CLApi()
{
IntegrationHelper.testClassExistence( this, coloredlightscore.src.api.CLApi.class );
}
@Override
public void init() throws Throwable
{
}
@Override
public void postInit()
{
// :P
}
@Override
public int colorLight( AEColor color, int light )
{
int mv = color.mediumVariant;
float r = ( mv >> 16 ) & 0xff;
float g = ( mv >> 8 ) & 0xff;
float b = ( mv ) & 0xff;
return coloredlightscore.src.api.CLApi.makeRGBLightValue( r / 255.0f, g / 255.0f, b / 255.0f, light / 15.0f );
}
}

View File

@ -1,459 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Nullable;
import com.google.common.base.Optional;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import cpw.mods.fml.relauncher.ReflectionHelper;
import uristqwerty.CraftGuide.CraftGuideLog;
import uristqwerty.CraftGuide.DefaultRecipeTemplate;
import uristqwerty.CraftGuide.RecipeGeneratorImplementation;
import uristqwerty.CraftGuide.api.ChanceSlot;
import uristqwerty.CraftGuide.api.CraftGuideAPIObject;
import uristqwerty.CraftGuide.api.ItemSlot;
import uristqwerty.CraftGuide.api.RecipeGenerator;
import uristqwerty.CraftGuide.api.RecipeProvider;
import uristqwerty.CraftGuide.api.RecipeTemplate;
import uristqwerty.CraftGuide.api.Slot;
import uristqwerty.CraftGuide.api.SlotType;
import uristqwerty.gui_craftguide.texture.DynamicTexture;
import uristqwerty.gui_craftguide.texture.TextureClip;
import appeng.api.AEApi;
import appeng.api.IAppEngApi;
import appeng.api.definitions.IBlocks;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RegistrationError;
import appeng.api.features.IGrinderEntry;
import appeng.api.features.IInscriberRecipe;
import appeng.api.recipes.IIngredient;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import appeng.recipes.game.ShapedRecipe;
import appeng.recipes.game.ShapelessRecipe;
public final class CraftGuide extends CraftGuideAPIObject implements IIntegrationModule, RecipeProvider
{
private static final int SLOT_SIZE = 16;
private static final int TEXTURE_WIDTH = 79;
private static final int TEXTURE_HEIGHT = 58;
private static final int GRINDER_RATIO = 10000;
private static final Slot[] GRINDER_SLOTS = {
new ItemSlot( 3, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 41, 21, SLOT_SIZE, SLOT_SIZE, true ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ),
new ChanceSlot( 59, 12, SLOT_SIZE, SLOT_SIZE, true ).setRatio( GRINDER_RATIO ).setFormatString( " (%1$.2f%% chance)" ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ),
new ChanceSlot( 59, 30, SLOT_SIZE, SLOT_SIZE, true ).setRatio( GRINDER_RATIO ).setFormatString( " (%1$.2f%% chance)" ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ),
new ItemSlot( 22, 12, SLOT_SIZE, SLOT_SIZE ).setSlotType( SlotType.MACHINE_SLOT ),
new ItemSlot( 22, 30, SLOT_SIZE, SLOT_SIZE ).setSlotType( SlotType.MACHINE_SLOT )
};
private static final Slot[] INSCRIBER_SLOTS = {
new ItemSlot( 12, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 21, 3, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 21, 39, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 50, 21, SLOT_SIZE, SLOT_SIZE, true ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ),
new ItemSlot( 31, 21, SLOT_SIZE, SLOT_SIZE ).setSlotType( SlotType.MACHINE_SLOT )
};
private static final Slot[] SHAPELESS_CRAFTING_SLOTS = {
new ItemSlot( 3, 3, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 21, 3, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 39, 3, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 3, 21, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 21, 21, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 39, 21, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 3, 39, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 21, 39, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 39, 39, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ),
};
private static final Slot[] CRAFTING_SLOTS_OWN_BG = {
new ItemSlot( 3, 3, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 21, 3, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 39, 3, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 3, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 21, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 39, 21, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 3, 39, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 21, 39, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 39, 39, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ).drawOwnBackground(),
};
private static final Slot[] SMALL_CRAFTING_SLOTS_OWN_BG = {
new ItemSlot( 12, 12, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 30, 12, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 12, 30, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 30, 30, SLOT_SIZE, SLOT_SIZE ).drawOwnBackground(),
new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ).drawOwnBackground(),
};
private static final Slot[] CRTAFTING_SLOTS = {
new ItemSlot( 3, 3, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 21, 3, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 39, 3, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 3, 21, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 21, 21, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 39, 21, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 3, 39, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 21, 39, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 39, 39, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ),
};
private static final Slot[] SMALL_CRAFTING_SLOTS = {
new ItemSlot( 12, 12, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 30, 12, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 12, 30, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 30, 30, SLOT_SIZE, SLOT_SIZE ),
new ItemSlot( 59, 21, SLOT_SIZE, SLOT_SIZE, true ).setSlotType( SlotType.OUTPUT_SLOT ),
};
@Reflected
public static CraftGuide instance;
public CraftGuide()
{
IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.CraftGuideLog.class );
IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.DefaultRecipeTemplate.class );
IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.RecipeGeneratorImplementation.class );
IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.api.ChanceSlot.class );
IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.api.CraftGuideAPIObject.class );
IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.api.ItemSlot.class );
IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.api.RecipeGenerator.class );
IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.api.RecipeProvider.class );
IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.api.RecipeTemplate.class );
IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.api.Slot.class );
IntegrationHelper.testClassExistence( this, uristqwerty.CraftGuide.api.SlotType.class );
IntegrationHelper.testClassExistence( this, uristqwerty.gui_craftguide.texture.DynamicTexture.class );
IntegrationHelper.testClassExistence( this, uristqwerty.gui_craftguide.texture.TextureClip.class );
}
@Override
public void init() throws Throwable
{
}
@Override
public void postInit()
{
}
@Override
public void generateRecipes( RecipeGenerator generator )
{
final RecipeTemplate craftingTemplate;
final RecipeTemplate smallTemplate;
if( uristqwerty.CraftGuide.CraftGuide.newerBackgroundStyle )
{
craftingTemplate = generator.createRecipeTemplate( CRAFTING_SLOTS_OWN_BG, null );
smallTemplate = generator.createRecipeTemplate( SMALL_CRAFTING_SLOTS_OWN_BG, null );
}
else
{
final TextureClip craftingBG = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 1, TEXTURE_WIDTH, TEXTURE_HEIGHT );
final TextureClip craftingSelected = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 1, TEXTURE_WIDTH, TEXTURE_HEIGHT );
craftingTemplate = new DefaultRecipeTemplate( CRTAFTING_SLOTS, RecipeGeneratorImplementation.workbench, craftingBG, craftingSelected );
final TextureClip smallBG = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 61, TEXTURE_WIDTH, TEXTURE_HEIGHT );
final TextureClip smallSelected = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 61, TEXTURE_WIDTH, TEXTURE_HEIGHT );
smallTemplate = new DefaultRecipeTemplate( SMALL_CRAFTING_SLOTS, RecipeGeneratorImplementation.workbench, smallBG, smallSelected );
}
final TextureClip shapelessBG = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 1, 121, TEXTURE_WIDTH, TEXTURE_HEIGHT );
final TextureClip shapelessSelected = new TextureClip( DynamicTexture.instance( "recipe_backgrounds" ), 82, 121, TEXTURE_WIDTH, TEXTURE_HEIGHT );
final RecipeTemplate shapelessTemplate = new DefaultRecipeTemplate( SHAPELESS_CRAFTING_SLOTS, RecipeGeneratorImplementation.workbench, shapelessBG, shapelessSelected );
this.addCraftingRecipes( craftingTemplate, smallTemplate, shapelessTemplate, generator );
final IAppEngApi api = AEApi.instance();
final IBlocks aeBlocks = api.definitions().blocks();
final Optional<ItemStack> grindstone = aeBlocks.grindStone().maybeStack( 1 );
final Optional<ItemStack> inscriber = aeBlocks.inscriber().maybeStack( 1 );
if( grindstone.isPresent() )
{
this.addGrinderRecipes( api, grindstone.get(), generator );
}
if( inscriber.isPresent() )
{
this.addInscriberRecipes( api, inscriber.get(), generator );
}
}
@SuppressWarnings( "unchecked" )
private List<IRecipe> getUncheckedRecipes()
{
return (List<IRecipe>) CraftingManager.getInstance().getRecipeList();
}
private void addCraftingRecipes( RecipeTemplate template, RecipeTemplate templateSmall, RecipeTemplate templateShapeless, RecipeGenerator generator )
{
final List<IRecipe> recipes = this.getUncheckedRecipes();
int errCount = 0;
for( IRecipe recipe : recipes )
{
try
{
final Object[] items = this.getCraftingRecipe( recipe, true );
if( items == null )
{
continue;
}
if( items.length == 5 )
{
generator.addRecipe( templateSmall, items );
}
else if( recipe instanceof ShapelessRecipe )
{
generator.addRecipe( templateShapeless, items );
}
else
{
generator.addRecipe( template, items );
}
}
catch( Exception e )
{
if( errCount >= 5 )
{
CraftGuideLog.log( "AppEng CraftGuide integration: Stack trace limit reached, further stack traces from this invocation will not be logged to the console. They will still be logged to (.minecraft)/config/CraftGuide/CraftGuide.log", true );
}
else
{
e.printStackTrace();
}
errCount++;
CraftGuideLog.log( e );
}
}
}
private void addGrinderRecipes( IAppEngApi api, ItemStack grindstone, RecipeGenerator generator )
{
final ItemStack handle = api.definitions().blocks().crankHandle().maybeStack( 1 ).orNull();
final RecipeTemplate grinderTemplate = generator.createRecipeTemplate( GRINDER_SLOTS, grindstone );
for( IGrinderEntry recipe : api.registries().grinder().getRecipes() )
{
generator.addRecipe( grinderTemplate, new Object[] {
recipe.getInput(),
recipe.getOutput(),
new Object[] {
recipe.getOptionalOutput(),
(int) ( recipe.getOptionalChance() * GRINDER_RATIO )
},
new Object[] {
recipe.getSecondOptionalOutput(),
(int) ( recipe.getOptionalChance() * GRINDER_RATIO )
},
handle,
grindstone
} );
}
}
private void addInscriberRecipes( IAppEngApi api, ItemStack inscriber, RecipeGenerator generator )
{
final RecipeTemplate inscriberTemplate = generator.createRecipeTemplate( INSCRIBER_SLOTS, inscriber );
for( IInscriberRecipe recipe : api.registries().inscriber().getRecipes() )
{
generator.addRecipe( inscriberTemplate, new Object[] {
recipe.getInputs(),
recipe.getTopOptional().orNull(),
recipe.getBottomOptional().orNull(),
recipe.getOutput(),
inscriber
} );
}
}
private Object[] getCraftingShapelessRecipe( List<?> items, ItemStack recipeOutput )
{
final Object[] output = new Object[10];
for( int i = 0; i < items.size(); i++ )
{
output[i] = items.get( i );
if( output[i] instanceof ItemStack[] )
{
output[i] = Arrays.asList( (ItemStack[]) output[i] );
}
if( output[i] instanceof IIngredient )
{
try
{
output[i] = this.toCG( ( (IIngredient) output[i] ).getItemStackSet() );
}
catch( RegistrationError ignored )
{
}
catch( MissingIngredientError ignored )
{
}
}
}
output[9] = recipeOutput;
return output;
}
private Object[] getSmallShapedRecipe( int width, int height, Object[] items, ItemStack recipeOutput )
{
final Object[] output = new Object[5];
for( int y = 0; y < height; y++ )
{
for( int x = 0; x < width; x++ )
{
final int i = y * 2 + x;
output[i] = items[y * width + x];
if( output[i] instanceof ItemStack[] )
{
output[i] = Arrays.asList( (ItemStack[]) output[i] );
}
if( output[i] instanceof IIngredient )
{
try
{
output[i] = this.toCG( ( (IIngredient) output[i] ).getItemStackSet() );
}
catch( RegistrationError ignored )
{
}
catch( MissingIngredientError ignored )
{
}
}
}
}
output[4] = recipeOutput;
return output;
}
private Object[] getCraftingShapedRecipe( int width, int height, Object[] items, ItemStack recipeOutput )
{
final Object[] output = new Object[10];
for( int y = 0; y < height; y++ )
{
for( int x = 0; x < width; x++ )
{
final int i = y * 3 + x;
output[i] = items[y * width + x];
if( output[i] instanceof ItemStack[] )
{
output[i] = Arrays.asList( (ItemStack[]) output[i] );
}
if( output[i] instanceof IIngredient )
{
try
{
output[i] = this.toCG( ( (IIngredient) output[i] ).getItemStackSet() );
}
catch( RegistrationError ignored )
{
}
catch( MissingIngredientError ignored )
{
}
}
}
}
output[9] = recipeOutput;
return output;
}
private Object toCG( ItemStack[] itemStackSet )
{
final List<ItemStack> list = Arrays.asList( itemStackSet );
for( int x = 0; x < list.size(); x++ )
{
list.set( x, list.get( x ).copy() );
if( list.get( x ).stackSize == 0 )
{
list.get( x ).stackSize = 1;
}
}
return list;
}
@Nullable
private Object[] getCraftingRecipe( IRecipe recipe, boolean allowSmallGrid )
{
if( recipe instanceof ShapelessRecipe )
{
final List<Object> items = ReflectionHelper.getPrivateValue( ShapelessRecipe.class, (ShapelessRecipe) recipe, "input" );
return this.getCraftingShapelessRecipe( items, recipe.getRecipeOutput() );
}
else if( recipe instanceof ShapedRecipe )
{
final int width = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "width" );
final int height = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "height" );
final Object[] items = ReflectionHelper.getPrivateValue( ShapedRecipe.class, (ShapedRecipe) recipe, "input" );
if( allowSmallGrid && width < 3 && height < 3 )
{
return this.getSmallShapedRecipe( width, height, items, recipe.getRecipeOutput() );
}
else
{
return this.getCraftingShapedRecipe( width, height, items, recipe.getRecipeOutput() );
}
}
return null;
}
}

View File

@ -1,69 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import net.minecraft.tileentity.TileEntity;
import powercrystals.minefactoryreloaded.api.IDeepStorageUnit;
import appeng.api.AEApi;
import appeng.api.storage.IMEInventory;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import appeng.integration.abstraction.IDSU;
import appeng.integration.modules.helpers.MFRDSUHandler;
import appeng.integration.modules.helpers.MinefactoryReloadedDeepStorageUnit;
public class DSU implements IDSU, IIntegrationModule
{
@Reflected
public static DSU instance;
@Reflected
public DSU()
{
IntegrationHelper.testClassExistence( this, powercrystals.minefactoryreloaded.api.IDeepStorageUnit.class );
}
@Override
public IMEInventory getDSU( TileEntity te )
{
return new MinefactoryReloadedDeepStorageUnit( te );
}
@Override
public boolean isDSU( TileEntity te )
{
return te instanceof IDeepStorageUnit;
}
@Override
public void init()
{
}
@Override
public void postInit()
{
AEApi.instance().registries().externalStorage().addExternalStorageInterface( new MFRDSUHandler() );
}
}

View File

@ -1,221 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import java.util.Collection;
import java.util.List;
import com.google.common.collect.Lists;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Event;
import codechicken.lib.vec.BlockCoord;
import codechicken.microblock.BlockMicroMaterial;
import codechicken.multipart.MultiPartRegistry;
import codechicken.multipart.MultiPartRegistry.IPartConverter;
import codechicken.multipart.MultiPartRegistry.IPartFactory;
import codechicken.multipart.MultipartGenerator;
import codechicken.multipart.TMultiPart;
import codechicken.multipart.TileMultipart;
import appeng.api.AEApi;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IBlocks;
import appeng.api.parts.IPartHost;
import appeng.core.AELog;
import appeng.fmp.CableBusPart;
import appeng.fmp.FMPEvent;
import appeng.fmp.FMPPlacementHelper;
import appeng.fmp.PartRegistry;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.abstraction.IFMP;
import appeng.integration.modules.helpers.FMPPacketEvent;
import appeng.parts.CableBusContainer;
public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IFMP
{
@Reflected
public static FMP instance;
@Override
public TMultiPart createPart( String name, boolean client )
{
for( PartRegistry pr : PartRegistry.values() )
{
if( pr.getName().equals( name ) )
{
return pr.construct( 0 );
}
}
return null;
}
@Override
public TMultiPart convert( World world, BlockCoord pos )
{
Block blk = world.getBlock( pos.x, pos.y, pos.z );
int meta = world.getBlockMetadata( pos.x, pos.y, pos.z );
TMultiPart part = PartRegistry.getPartByBlock( blk, meta );
if( part instanceof CableBusPart )
{
CableBusPart cbp = (CableBusPart) part;
cbp.convertFromTile( world.getTileEntity( pos.x, pos.y, pos.z ) );
}
return part;
}
@Override
public Iterable<Block> blockTypes()
{
final IBlocks blocks = AEApi.instance().definitions().blocks();
final List<Block> blockTypes = Lists.newArrayListWithCapacity( 2 );
this.addBlockTypes( blockTypes, blocks.multiPart() );
this.addBlockTypes( blockTypes, blocks.quartzTorch() );
return blockTypes;
}
private void addBlockTypes( Collection<Block> blockTypes, IBlockDefinition definition )
{
for( Block block : definition.maybeBlock().asSet() )
{
blockTypes.add( block );
}
}
@Override
public void init() throws Throwable
{
final IBlocks blocks = AEApi.instance().definitions().blocks();
this.createAndRegister( blocks.quartz(), 0 );
this.createAndRegister( blocks.quartzPillar(), 0 );
this.createAndRegister( blocks.quartzChiseled(), 0 );
this.createAndRegister( blocks.skyStone(), 0 );
this.createAndRegister( blocks.skyStone(), 1 );
this.createAndRegister( blocks.skyStone(), 2 );
this.createAndRegister( blocks.skyStone(), 3 );
PartRegistry[] reg = PartRegistry.values();
String[] data = new String[reg.length];
for( int x = 0; x < data.length; x++ )
{
data[x] = reg[x].getName();
}
MultiPartRegistry.registerConverter( this );
MultiPartRegistry.registerParts( this, data );
MultipartGenerator.registerPassThroughInterface( "appeng.helpers.AEMultiTile" );
}
private void createAndRegister( IBlockDefinition definition, int i )
{
for( Block block : definition.maybeBlock().asSet() )
{
BlockMicroMaterial.createAndRegister( block, i );
}
}
@Override
public void postInit()
{
MinecraftForge.EVENT_BUS.register( new FMPEvent() );
}
@Override
public IPartHost getOrCreateHost( TileEntity tile )
{
try
{
BlockCoord loc = new BlockCoord( tile.xCoord, tile.yCoord, tile.zCoord );
TileMultipart mp = TileMultipart.getOrConvertTile( tile.getWorldObj(), loc );
if( mp != null )
{
scala.collection.Iterator<TMultiPart> i = mp.partList().iterator();
while( i.hasNext() )
{
TMultiPart p = i.next();
if( p instanceof CableBusPart )
{
return (IPartHost) p;
}
}
return new FMPPlacementHelper( mp );
}
}
catch( Throwable t )
{
AELog.error( t );
}
return null;
}
@Override
public CableBusContainer getCableContainer( TileEntity te )
{
if( te instanceof TileMultipart )
{
TileMultipart mp = (TileMultipart) te;
scala.collection.Iterator<TMultiPart> i = mp.partList().iterator();
while( i.hasNext() )
{
TMultiPart p = i.next();
if( p instanceof CableBusPart )
{
return ( (CableBusPart) p ).getCableBus();
}
}
}
return null;
}
@Override
public void registerPassThrough( Class<?> layerInterface )
{
try
{
MultipartGenerator.registerPassThroughInterface( layerInterface.getName() );
}
catch( Throwable t )
{
AELog.severe( "Failed to register " + layerInterface.getName() + " with FMP, some features may not work with MultiParts." );
AELog.error( t );
}
}
@Override
public Event newFMPPacketEvent( EntityPlayerMP sender )
{
return new FMPPacketEvent( sender );
}
}

View File

@ -1,214 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import appeng.api.AEApi;
import appeng.api.storage.IMEInventory;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.abstraction.IFZ;
import appeng.integration.modules.helpers.FactorizationBarrel;
import appeng.integration.modules.helpers.FactorizationHandler;
import appeng.util.Platform;
/**
* 100% Hacks.
*/
public class FZ implements IFZ, IIntegrationModule
{
@Reflected
public static FZ instance;
private static Class<?> day_BarrelClass;
private static Method day_getItemCount;
private static Method day_setItemCount;
private static Method day_getMaxSize;
private static Field day_item;
@Override
public ItemStack barrelGetItem( TileEntity te )
{
try
{
ItemStack i = null;
if( day_BarrelClass.isInstance( te ) )
{
i = (ItemStack) day_item.get( te );
}
if( i != null )
{
i = Platform.cloneItemStack( i );
}
return i;
}
catch( IllegalArgumentException ignored )
{
}
catch( IllegalAccessException ignored )
{
}
return null;
}
@Override
public int barrelGetMaxItemCount( TileEntity te )
{
try
{
if( day_BarrelClass.isInstance( te ) )
{
return (Integer) day_getMaxSize.invoke( te );
}
}
catch( IllegalAccessException ignored )
{
}
catch( IllegalArgumentException ignored )
{
}
catch( InvocationTargetException ignored )
{
}
return 0;
}
@Override
public int barrelGetItemCount( TileEntity te )
{
try
{
if( day_BarrelClass.isInstance( te ) )
{
return (Integer) day_getItemCount.invoke( te );
}
}
catch( IllegalAccessException ignored )
{
}
catch( IllegalArgumentException ignored )
{
}
catch( InvocationTargetException ignored )
{
}
return 0;
}
@Override
public void setItemType( TileEntity te, ItemStack input )
{
try
{
if( day_BarrelClass.isInstance( te ) )
{
day_item.set( te, input == null ? null : input.copy() );
}
}
catch( IllegalArgumentException ignored )
{
}
catch( IllegalAccessException ignored )
{
}
}
@Override
public void barrelSetCount( TileEntity te, int max )
{
try
{
if( day_BarrelClass.isInstance( te ) )
{
day_setItemCount.invoke( te, max );
}
te.markDirty();
}
catch( IllegalAccessException ignored )
{
}
catch( IllegalArgumentException ignored )
{
}
catch( InvocationTargetException ignored )
{
}
}
@Override
public IMEInventory getFactorizationBarrel( TileEntity te )
{
return new FactorizationBarrel( this, te );
}
@Override
public boolean isBarrel( TileEntity te )
{
return day_BarrelClass.isAssignableFrom( te.getClass() );
}
@Override
public void grinderRecipe( ItemStack in, ItemStack out )
{
try
{
Class<?> c = Class.forName( "factorization.oreprocessing.TileEntityGrinder" );
Method m = c.getMethod( "addRecipe", Object.class, ItemStack.class, float.class );
float amt = out.stackSize;
out.stackSize = 1;
m.invoke( c, in, out, amt );
}
catch( Throwable t )
{
// AELog.info( "" );
// throw new RuntimeException( t );
}
}
@Override
public void init() throws Throwable
{
day_BarrelClass = Class.forName( "factorization.weird.TileEntityDayBarrel" );
day_getItemCount = day_BarrelClass.getDeclaredMethod( "getItemCount" );
day_setItemCount = day_BarrelClass.getDeclaredMethod( "setItemCount", int.class );
day_getMaxSize = day_BarrelClass.getDeclaredMethod( "getMaxSize" );
day_item = day_BarrelClass.getDeclaredField( "item" );
}
@Override
public void postInit()
{
AEApi.instance().registries().externalStorage().addExternalStorageInterface( new FactorizationHandler() );
}
}

View File

@ -1,110 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.MinecraftForge;
import ic2.api.energy.tile.IEnergyTile;
import ic2.api.recipe.RecipeInputItemStack;
import appeng.api.AEApi;
import appeng.api.IAppEngApi;
import appeng.api.config.TunnelType;
import appeng.api.features.IP2PTunnelRegistry;
import appeng.api.parts.IPartHelper;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IIC2;
public class IC2 implements IIC2, IIntegrationModule
{
@Reflected
public static IC2 instance;
@Reflected
public IC2()
{
IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.class );
IntegrationHelper.testClassExistence( this, ic2.api.recipe.RecipeInputItemStack.class );
}
@Override
public void init()
{
final IAppEngApi api = AEApi.instance();
final IPartHelper partHelper = api.partHelper();
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.IC2 ) )
{
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySink", "ic2.api.energy.tile.IEnergySink" );
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergySource", "ic2.api.energy.tile.IEnergySource" );
}
}
@Override
public void postInit()
{
IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
reg.addNewAttunement( this.getItem( "copperCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "insulatedCopperCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "goldCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "insulatedGoldCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "ironCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "insulatedIronCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "insulatedTinCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "glassFiberCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "tinCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "detectorCableItem" ), TunnelType.IC2_POWER );
reg.addNewAttunement( this.getItem( "splitterCableItem" ), TunnelType.IC2_POWER );
// this is gone?
// AEApi.INSTANCE().registries().matterCannon().registerAmmo( getItem( "uraniumDrop" ), 238.0289 );
}
@Override
public void addToEnergyNet( TileEntity appEngTile )
{
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) appEngTile ) );
}
@Override
public void removeFromEnergyNet( TileEntity appEngTile )
{
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) appEngTile ) );
}
@Override
public ItemStack getItem( String name )
{
return ic2.api.item.IC2Items.getItem( name );
}
@Override
public void maceratorRecipe( ItemStack in, ItemStack out )
{
ic2.api.recipe.Recipes.macerator.addRecipe( new RecipeInputItemStack( in, in.stackSize ), null, out );
}
}

View File

@ -1,145 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import java.lang.reflect.Method;
import com.google.common.base.Optional;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mods.immibis.core.api.multipart.ICoverSystem;
import mods.immibis.core.api.multipart.IMultipartTile;
import appeng.api.AEApi;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartItem;
import appeng.core.AELog;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import appeng.integration.abstraction.IImmibisMicroblocks;
public class ImmibisMicroblocks implements IImmibisMicroblocks, IIntegrationModule
{
@Reflected
public static ImmibisMicroblocks instance;
private boolean canConvertTiles = false;
private Class<?> MicroblockAPIUtils;
private Method mergeIntoMicroblockContainer;
@Reflected
public ImmibisMicroblocks()
{
IntegrationHelper.testClassExistence( this, mods.immibis.core.api.multipart.IMultipartTile.class );
IntegrationHelper.testClassExistence( this, mods.immibis.core.api.multipart.ICoverSystem.class );
IntegrationHelper.testClassExistence( this, mods.immibis.core.api.multipart.IPartContainer.class );
}
@Override
public void init() throws Throwable
{
try
{
this.MicroblockAPIUtils = Class.forName( "mods.immibis.microblocks.api.MicroblockAPIUtils" );
this.mergeIntoMicroblockContainer = this.MicroblockAPIUtils.getMethod( "mergeIntoMicroblockContainer", ItemStack.class, EntityPlayer.class, World.class, int.class, int.class, int.class, int.class, Block.class, int.class );
this.canConvertTiles = true;
}
catch( Throwable t )
{
AELog.error( t );
}
}
@Override
public void postInit()
{
}
@Override
public IPartHost getOrCreateHost( EntityPlayer player, int side, TileEntity te )
{
final World w = te.getWorldObj();
final int x = te.xCoord;
final int y = te.yCoord;
final int z = te.zCoord;
final boolean isPartItem = player != null && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IPartItem;
if( te instanceof IMultipartTile && this.canConvertTiles && isPartItem )
{
final IBlockDefinition multiPart = AEApi.instance().definitions().blocks().multiPart();
final Optional<Block> maybeMultiPartBlock = multiPart.maybeBlock();
final Optional<ItemStack> maybeMultiPartStack = multiPart.maybeStack( 1 );
final boolean multiPartPresent = maybeMultiPartBlock.isPresent() && maybeMultiPartStack.isPresent();
if( multiPartPresent )
{
final Block multiPartBlock = maybeMultiPartBlock.get();
final ItemStack multiPartStack = maybeMultiPartStack.get();
try
{
// ItemStack.class, EntityPlayer.class, World.class,
// int.class, int.class, int.class, int.class, Block.class, int.class );
this.mergeIntoMicroblockContainer.invoke( null, multiPartStack, player, w, x, y, z, side, multiPartBlock, 0 );
}
catch( Throwable e )
{
this.canConvertTiles = false;
return null;
}
}
}
final TileEntity tx = w.getTileEntity( x, y, z );
if( tx instanceof IPartHost )
{
return (IPartHost) tx;
}
return null;
}
@Override
public boolean leaveParts( TileEntity te )
{
if( te instanceof IMultipartTile )
{
ICoverSystem ci = ( (IMultipartTile) te ).getCoverSystem();
if( ci != null )
{
ci.convertToContainerBlock();
}
return true;
}
return false;
}
}

View File

@ -1,65 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.Loader;
import invtweaks.api.InvTweaksAPI;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import appeng.integration.abstraction.IInvTweaks;
public class InvTweaks implements IInvTweaks, IIntegrationModule
{
@Reflected
public static InvTweaks instance;
static InvTweaksAPI api;
@Reflected
public InvTweaks()
{
IntegrationHelper.testClassExistence( this, invtweaks.api.InvTweaksAPI.class );
}
@Override
public void init()
{
api = (InvTweaksAPI) Loader.instance().getIndexedModList().get( "inventorytweaks" ).getMod();
}
@Override
public void postInit()
{
if( api == null )
{
throw new IllegalStateException( "InvTweaks API Instance Failed." );
}
}
@Override
public int compareItems( ItemStack i, ItemStack j )
{
return api.compareItems( i, j );
}
}

View File

@ -1,47 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
public class MFR implements IIntegrationModule
{
@Reflected
public static MFR instance;
@Reflected
public MFR()
{
IntegrationHelper.testClassExistence( this, powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection.class );
}
@Override
public void init() throws Throwable
{
}
@Override
public void postInit()
{
}
}

View File

@ -1,84 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import cpw.mods.fml.common.event.FMLInterModComms;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import appeng.integration.abstraction.IMekanism;
public final class Mekanism implements IMekanism, IIntegrationModule
{
@Reflected
public static Mekanism instance;
@Reflected
public Mekanism()
{
IntegrationHelper.testClassExistence( this, mekanism.api.energy.IStrictEnergyAcceptor.class );
}
@Override
public void init() throws Throwable
{
}
@Override
public void postInit()
{
}
@Override
public void addCrusherRecipe( ItemStack in, ItemStack out )
{
final NBTTagCompound sendTag = this.convertToSimpleRecipe( in, out );
FMLInterModComms.sendMessage( "mekanism", "CrusherRecipe", sendTag );
}
@Override
public void addEnrichmentChamberRecipe( ItemStack in, ItemStack out )
{
final NBTTagCompound sendTag = this.convertToSimpleRecipe( in, out );
FMLInterModComms.sendMessage( "mekanism", "EnrichmentChamberRecipe", sendTag );
}
private NBTTagCompound convertToSimpleRecipe( ItemStack in, ItemStack out )
{
final NBTTagCompound sendTag = new NBTTagCompound();
final NBTTagCompound inputTagDummy = new NBTTagCompound();
final NBTTagCompound outputTagDummy = new NBTTagCompound();
final NBTTagCompound inputTag = in.writeToNBT( inputTagDummy );
final NBTTagCompound outputTag = out.writeToNBT( outputTagDummy );
sendTag.setTag( "input", inputTag );
sendTag.setTag( "output", outputTag );
return sendTag;
}
}

View File

@ -1,188 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import codechicken.nei.api.IStackPositioner;
import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.guihook.IContainerTooltipHandler;
import appeng.client.gui.AEBaseMEGui;
import appeng.client.gui.implementations.GuiCraftingTerm;
import appeng.client.gui.implementations.GuiPatternTerm;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import appeng.integration.abstraction.INEI;
import appeng.integration.modules.NEIHelpers.NEIAEShapedRecipeHandler;
import appeng.integration.modules.NEIHelpers.NEIAEShapelessRecipeHandler;
import appeng.integration.modules.NEIHelpers.NEICraftingHandler;
import appeng.integration.modules.NEIHelpers.NEIFacadeRecipeHandler;
import appeng.integration.modules.NEIHelpers.NEIGrinderRecipeHandler;
import appeng.integration.modules.NEIHelpers.NEIInscriberRecipeHandler;
import appeng.integration.modules.NEIHelpers.NEIWorldCraftingHandler;
import appeng.integration.modules.NEIHelpers.TerminalCraftingSlotFinder;
public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule
{
@Reflected
public static NEI instance;
private final Class<?> apiClass;
// recipe handler...
private Method registerRecipeHandler;
private Method registerUsageHandler;
@Reflected
public NEI() throws ClassNotFoundException
{
IntegrationHelper.testClassExistence( this, codechicken.nei.api.API.class );
IntegrationHelper.testClassExistence( this, codechicken.nei.api.IStackPositioner.class );
IntegrationHelper.testClassExistence( this, codechicken.nei.guihook.GuiContainerManager.class );
IntegrationHelper.testClassExistence( this, codechicken.nei.guihook.IContainerTooltipHandler.class );
IntegrationHelper.testClassExistence( this, codechicken.nei.recipe.ICraftingHandler.class );
IntegrationHelper.testClassExistence( this, codechicken.nei.recipe.IUsageHandler.class );
this.apiClass = Class.forName( "codechicken.nei.api.API" );
}
@Override
public void init() throws Throwable
{
this.registerRecipeHandler = this.apiClass.getDeclaredMethod( "registerRecipeHandler", codechicken.nei.recipe.ICraftingHandler.class );
this.registerUsageHandler = this.apiClass.getDeclaredMethod( "registerUsageHandler", codechicken.nei.recipe.IUsageHandler.class );
this.registerRecipeHandler( new NEIAEShapedRecipeHandler() );
this.registerRecipeHandler( new NEIAEShapelessRecipeHandler() );
this.registerRecipeHandler( new NEIInscriberRecipeHandler() );
this.registerRecipeHandler( new NEIWorldCraftingHandler() );
this.registerRecipeHandler( new NEIGrinderRecipeHandler() );
if( AEConfig.instance.isFeatureEnabled( AEFeature.Facades ) && AEConfig.instance.isFeatureEnabled( AEFeature.EnableFacadeCrafting ) )
{
this.registerRecipeHandler( new NEIFacadeRecipeHandler() );
}
// large stack tooltips
GuiContainerManager.addTooltipHandler( this );
// crafting terminal...
Method registerGuiOverlay = this.apiClass.getDeclaredMethod( "registerGuiOverlay", Class.class, String.class, IStackPositioner.class );
Class overlayHandler = Class.forName( "codechicken.nei.api.IOverlayHandler" );
Class<NEICraftingHandler> defaultHandler = NEICraftingHandler.class;
Method registrar = this.apiClass.getDeclaredMethod( "registerGuiOverlayHandler", Class.class, overlayHandler, String.class );
registerGuiOverlay.invoke( this.apiClass, GuiCraftingTerm.class, "crafting", new TerminalCraftingSlotFinder() );
registerGuiOverlay.invoke( this.apiClass, GuiPatternTerm.class, "crafting", new TerminalCraftingSlotFinder() );
Constructor defaultConstructor = defaultHandler.getConstructor( int.class, int.class );
registrar.invoke( this.apiClass, GuiCraftingTerm.class, defaultConstructor.newInstance( 6, 75 ), "crafting" );
registrar.invoke( this.apiClass, GuiPatternTerm.class, defaultConstructor.newInstance( 6, 75 ), "crafting" );
}
public void registerRecipeHandler( Object o ) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
{
this.registerRecipeHandler.invoke( this.apiClass, o );
this.registerUsageHandler.invoke( this.apiClass, o );
}
@Override
public void postInit()
{
}
@Override
public void drawSlot( Slot s )
{
if( s == null )
{
return;
}
ItemStack stack = s.getStack();
if( stack == null )
{
return;
}
Minecraft mc = Minecraft.getMinecraft();
FontRenderer fontRenderer = mc.fontRenderer;
int x = s.xDisplayPosition;
int y = s.yDisplayPosition;
GuiContainerManager.drawItems.renderItemAndEffectIntoGUI( fontRenderer, mc.getTextureManager(), stack, x, y );
GuiContainerManager.drawItems.renderItemOverlayIntoGUI( fontRenderer, mc.getTextureManager(), stack, x, y, String.valueOf( stack.stackSize ) );
}
@Override
public RenderItem setItemRender( RenderItem renderItem )
{
try
{
RenderItem ri = GuiContainerManager.drawItems;
GuiContainerManager.drawItems = renderItem;
return ri;
}
catch( Throwable t )
{
throw new IllegalStateException( "Invalid version of NEI, please update", t );
}
}
@Override
public List<String> handleTooltip( GuiContainer arg0, int arg1, int arg2, List<String> current )
{
return current;
}
@Override
public List<String> handleItemDisplayName( GuiContainer arg0, ItemStack arg1, List<String> current )
{
return current;
}
@Override
public List<String> handleItemTooltip( GuiContainer guiScreen, ItemStack stack, int mouseX, int mouseY, List<String> currentToolTip )
{
if( guiScreen instanceof AEBaseMEGui )
{
return ( (AEBaseMEGui) guiScreen ).handleItemTooltip( stack, mouseX, mouseY, currentToolTip );
}
return currentToolTip;
}
}

View File

@ -1,263 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.NEIHelpers;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiCrafting;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.api.DefaultOverlayRenderer;
import codechicken.nei.api.IOverlayHandler;
import codechicken.nei.api.IRecipeOverlayRenderer;
import codechicken.nei.api.IStackPositioner;
import codechicken.nei.recipe.RecipeInfo;
import codechicken.nei.recipe.TemplateRecipeHandler;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RegistrationError;
import appeng.api.recipes.IIngredient;
import appeng.core.AEConfig;
import appeng.recipes.game.ShapedRecipe;
import appeng.util.Platform;
public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
{
@Override
public void loadTransferRects()
{
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "crafting" ) );
}
@Override
public void loadCraftingRecipes( String outputId, Object... results )
{
if( ( outputId.equals( "crafting" ) ) && ( this.getClass() == NEIAEShapedRecipeHandler.class ) )
{
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for( IRecipe recipe : recipes )
{
if( ( recipe instanceof ShapedRecipe ) )
{
if( ( (ShapedRecipe) recipe ).isEnabled() )
{
CachedShapedRecipe cachedRecipe = new CachedShapedRecipe( (ShapedRecipe) recipe );
cachedRecipe.computeVisuals();
this.arecipes.add( cachedRecipe );
}
}
}
}
else
{
super.loadCraftingRecipes( outputId, results );
}
}
@Override
public void loadCraftingRecipes( ItemStack result )
{
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for( IRecipe recipe : recipes )
{
if( ( recipe instanceof ShapedRecipe ) )
{
if( ( (ShapedRecipe) recipe ).isEnabled() && NEIServerUtils.areStacksSameTypeCrafting( recipe.getRecipeOutput(), result ) )
{
CachedShapedRecipe cachedRecipe = new CachedShapedRecipe( (ShapedRecipe) recipe );
cachedRecipe.computeVisuals();
this.arecipes.add( cachedRecipe );
}
}
}
}
@Override
public void loadUsageRecipes( ItemStack ingredient )
{
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for( IRecipe recipe : recipes )
{
if( ( recipe instanceof ShapedRecipe ) )
{
CachedShapedRecipe cachedRecipe = new CachedShapedRecipe( (ShapedRecipe) recipe );
if( ( (ShapedRecipe) recipe ).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) )
{
cachedRecipe.computeVisuals();
if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
{
cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient );
this.arecipes.add( cachedRecipe );
}
}
}
}
}
@Override
public String getGuiTexture()
{
return "textures/gui/container/crafting_table.png";
}
@Override
public String getOverlayIdentifier()
{
return "crafting";
}
@Override
public Class<? extends GuiContainer> getGuiClass()
{
return GuiCrafting.class;
}
@Override
public boolean hasOverlay( GuiContainer gui, Container container, int recipe )
{
return ( super.hasOverlay( gui, container, recipe ) ) || ( ( this.isRecipe2x2( recipe ) ) && ( RecipeInfo.hasDefaultOverlay( gui, "crafting2x2" ) ) );
}
@Override
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
{
IRecipeOverlayRenderer renderer = super.getOverlayRenderer( gui, recipe );
if( renderer != null )
{
return renderer;
}
IStackPositioner positioner = RecipeInfo.getStackPositioner( gui, "crafting2x2" );
if( positioner == null )
{
return null;
}
return new DefaultOverlayRenderer( this.getIngredientStacks( recipe ), positioner );
}
@Override
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
{
IOverlayHandler handler = super.getOverlayHandler( gui, recipe );
if( handler != null )
{
return handler;
}
return RecipeInfo.getOverlayHandler( gui, "crafting2x2" );
}
private boolean isRecipe2x2( final int recipe )
{
for( PositionedStack stack : this.getIngredientStacks( recipe ) )
{
if( ( stack.relx > 43 ) || ( stack.rely > 24 ) )
{
return false;
}
}
return true;
}
@Override
public String getRecipeName()
{
return NEIClientUtils.translate( "recipe.shaped" );
}
private class CachedShapedRecipe extends TemplateRecipeHandler.CachedRecipe
{
private final List<PositionedStack> ingredients;
private final PositionedStack result;
public CachedShapedRecipe( ShapedRecipe recipe )
{
this.result = new PositionedStack( recipe.getRecipeOutput(), 119, 24 );
this.ingredients = new ArrayList<PositionedStack>();
this.setIngredients( recipe.getWidth(), recipe.getHeight(), recipe.getIngredients() );
}
private void setIngredients( final int width, final int height, final Object[] items )
{
boolean useSingleItems = AEConfig.instance.disableColoredCableRecipesInNEI();
for( int x = 0; x < width; x++ )
{
for( int y = 0; y < height; y++ )
{
if( items[( y * width + x )] != null )
{
IIngredient ing = (IIngredient) items[( y * width + x )];
try
{
ItemStack[] is = ing.getItemStackSet();
PositionedStack stack = new PositionedStack( useSingleItems ? Platform.findPreferred( is ) : is, 25 + x * 18, 6 + y * 18, false );
stack.setMaxSize( 1 );
this.ingredients.add( stack );
}
catch( RegistrationError ignored )
{
}
catch( MissingIngredientError ignored )
{
}
}
}
}
}
@Override
public PositionedStack getResult()
{
return this.result;
}
@Override
public List<PositionedStack> getIngredients()
{
return this.getCycledIngredients( NEIAEShapedRecipeHandler.this.cycleticks / 20, this.ingredients );
}
private void computeVisuals()
{
for( PositionedStack p : this.ingredients )
{
p.generatePermutations();
}
this.result.generatePermutations();
}
}
}

View File

@ -1,272 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.NEIHelpers;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiCrafting;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.api.DefaultOverlayRenderer;
import codechicken.nei.api.IOverlayHandler;
import codechicken.nei.api.IRecipeOverlayRenderer;
import codechicken.nei.api.IStackPositioner;
import codechicken.nei.recipe.RecipeInfo;
import codechicken.nei.recipe.TemplateRecipeHandler;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RegistrationError;
import appeng.api.recipes.IIngredient;
import appeng.core.AEConfig;
import appeng.recipes.game.ShapelessRecipe;
import appeng.util.Platform;
public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
{
@Override
public void loadTransferRects()
{
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "crafting" ) );
}
@Override
public void loadCraftingRecipes( String outputId, Object... results )
{
if( ( outputId.equals( "crafting" ) ) && ( this.getClass() == NEIAEShapelessRecipeHandler.class ) )
{
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for( IRecipe recipe : recipes )
{
if( ( recipe instanceof ShapelessRecipe ) )
{
if( ( (ShapelessRecipe) recipe ).isEnabled() )
{
CachedShapelessRecipe cachedRecipe = new CachedShapelessRecipe( (ShapelessRecipe) recipe );
cachedRecipe.computeVisuals();
this.arecipes.add( cachedRecipe );
}
}
}
}
else
{
super.loadCraftingRecipes( outputId, results );
}
}
@Override
public void loadCraftingRecipes( ItemStack result )
{
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for( IRecipe recipe : recipes )
{
if( ( recipe instanceof ShapelessRecipe ) )
{
if( ( (ShapelessRecipe) recipe ).isEnabled() && NEIServerUtils.areStacksSameTypeCrafting( recipe.getRecipeOutput(), result ) )
{
CachedShapelessRecipe cachedRecipe = new CachedShapelessRecipe( (ShapelessRecipe) recipe );
cachedRecipe.computeVisuals();
this.arecipes.add( cachedRecipe );
}
}
}
}
@Override
public void loadUsageRecipes( ItemStack ingredient )
{
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for( IRecipe recipe : recipes )
{
if( ( recipe instanceof ShapelessRecipe ) )
{
CachedShapelessRecipe cachedRecipe = new CachedShapelessRecipe( (ShapelessRecipe) recipe );
if( ( (ShapelessRecipe) recipe ).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) )
{
cachedRecipe.computeVisuals();
if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
{
cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient );
this.arecipes.add( cachedRecipe );
}
}
}
}
}
@Override
public String getGuiTexture()
{
return "textures/gui/container/crafting_table.png";
}
@Override
public String getOverlayIdentifier()
{
return "crafting";
}
@Override
public Class<? extends GuiContainer> getGuiClass()
{
return GuiCrafting.class;
}
@Override
public boolean hasOverlay( GuiContainer gui, Container container, int recipe )
{
return ( super.hasOverlay( gui, container, recipe ) ) || ( ( this.isRecipe2x2( recipe ) ) && ( RecipeInfo.hasDefaultOverlay( gui, "crafting2x2" ) ) );
}
@Override
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
{
IRecipeOverlayRenderer renderer = super.getOverlayRenderer( gui, recipe );
if( renderer != null )
{
return renderer;
}
IStackPositioner positioner = RecipeInfo.getStackPositioner( gui, "crafting2x2" );
if( positioner == null )
{
return null;
}
return new DefaultOverlayRenderer( this.getIngredientStacks( recipe ), positioner );
}
@Override
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
{
IOverlayHandler handler = super.getOverlayHandler( gui, recipe );
if( handler != null )
{
return handler;
}
return RecipeInfo.getOverlayHandler( gui, "crafting2x2" );
}
<<<<<<< HEAD
public boolean isRecipe2x2( int recipe )
=======
private boolean isRecipe2x2( final int recipe )
>>>>>>> 500fc47... Reduces visibility of internal fields/methods
{
for( PositionedStack stack : this.getIngredientStacks( recipe ) )
{
if( ( stack.relx > 43 ) || ( stack.rely > 24 ) )
{
return false;
}
}
return true;
}
@Override
public String getRecipeName()
{
return NEIClientUtils.translate( "recipe.shapeless" );
}
private class CachedShapelessRecipe extends TemplateRecipeHandler.CachedRecipe
{
private final List<PositionedStack> ingredients;
private final PositionedStack result;
public CachedShapelessRecipe( ShapelessRecipe recipe )
{
this.result = new PositionedStack( recipe.getRecipeOutput(), 119, 24 );
this.ingredients = new ArrayList<PositionedStack>();
this.setIngredients( recipe.getInput().toArray() );
}
@Override
public PositionedStack getResult()
{
return this.result;
}
@Override
public List<PositionedStack> getIngredients()
{
return this.getCycledIngredients( NEIAEShapelessRecipeHandler.this.cycleticks / 20, this.ingredients );
}
<<<<<<< HEAD
public void setIngredients( Object[] items )
=======
private void setIngredients( final Object[] items )
>>>>>>> 500fc47... Reduces visibility of internal fields/methods
{
boolean useSingleItems = AEConfig.instance.disableColoredCableRecipesInNEI();
for( int x = 0; x < 3; x++ )
{
for( int y = 0; y < 3; y++ )
{
if( items.length > ( y * 3 + x ) )
{
IIngredient ing = (IIngredient) items[( y * 3 + x )];
try
{
ItemStack[] is = ing.getItemStackSet();
PositionedStack stack = new PositionedStack( useSingleItems ? Platform.findPreferred( is ) : ing.getItemStackSet(), 25 + x * 18, 6 + y * 18, false );
stack.setMaxSize( 1 );
this.ingredients.add( stack );
}
catch( RegistrationError ignored )
{
}
catch( MissingIngredientError ignored )
{
}
}
}
}
}
private void computeVisuals()
{
for( PositionedStack p : this.ingredients )
{
p.generatePermutations();
}
this.result.generatePermutations();
}
}
}

View File

@ -1,131 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.NEIHelpers;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import codechicken.nei.PositionedStack;
import codechicken.nei.api.IOverlayHandler;
import codechicken.nei.recipe.IRecipeHandler;
import appeng.client.gui.implementations.GuiCraftingTerm;
import appeng.client.gui.implementations.GuiPatternTerm;
import appeng.container.slot.SlotCraftingMatrix;
import appeng.container.slot.SlotFakeCraftingMatrix;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketNEIRecipe;
import appeng.util.Platform;
public class NEICraftingHandler implements IOverlayHandler
{
private final int offsetX;
private final int offsetY;
public NEICraftingHandler( final int x, final int y )
{
}
@Override
public void overlayRecipe( GuiContainer gui, IRecipeHandler recipe, int recipeIndex, boolean shift )
{
try
{
List ingredients = recipe.getIngredientStacks( recipeIndex );
this.overlayRecipe( gui, ingredients, shift );
}
catch( Exception ignored )
{
}
catch( Error ignored )
{
}
}
private void overlayRecipe( GuiContainer gui, List<PositionedStack> ingredients, boolean shift )
{
try
{
NBTTagCompound recipe = new NBTTagCompound();
if( gui instanceof GuiCraftingTerm || gui instanceof GuiPatternTerm )
{
for( PositionedStack positionedStack : ingredients )
{
int col = ( positionedStack.relx - 25 ) / 18;
int row = ( positionedStack.rely - 6 ) / 18;
if( positionedStack.items != null && positionedStack.items.length > 0 )
{
for( Slot slot : (List<Slot>) gui.inventorySlots.inventorySlots )
{
if( slot instanceof SlotCraftingMatrix || slot instanceof SlotFakeCraftingMatrix )
{
if( slot.getSlotIndex() == col + row * 3 )
{
NBTTagList tags = new NBTTagList();
List<ItemStack> list = new LinkedList<ItemStack>();
// prefer pure crystals.
for( int x = 0; x < positionedStack.items.length; x++ )
{
if( Platform.isRecipePrioritized( positionedStack.items[x] ) )
{
list.add( 0, positionedStack.items[x] );
}
else
{
list.add( positionedStack.items[x] );
}
}
for( ItemStack is : list )
{
NBTTagCompound tag = new NBTTagCompound();
is.writeToNBT( tag );
tags.appendTag( tag );
}
recipe.setTag( "#" + slot.getSlotIndex(), tags );
break;
}
}
}
}
}
NetworkHandler.instance.sendToServer( new PacketNEIRecipe( recipe ) );
}
}
catch( Exception ignored )
{
}
catch( Error ignored )
{
}
}
}

View File

@ -1,249 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.NEIHelpers;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiCrafting;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import codechicken.nei.PositionedStack;
import codechicken.nei.api.DefaultOverlayRenderer;
import codechicken.nei.api.IOverlayHandler;
import codechicken.nei.api.IRecipeOverlayRenderer;
import codechicken.nei.api.IStackPositioner;
import codechicken.nei.recipe.RecipeInfo;
import codechicken.nei.recipe.TemplateRecipeHandler;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IItemDefinition;
import appeng.core.localization.GuiText;
import appeng.facade.IFacadeItem;
import appeng.items.parts.ItemFacade;
public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
{
private final ItemFacade facade;
private final IItemDefinition anchorDefinition;
public NEIFacadeRecipeHandler()
{
final IDefinitions definitions = AEApi.instance().definitions();
this.facade = (ItemFacade) definitions.items().facade().maybeItem().get();
this.anchorDefinition = definitions.parts().cableAnchor();
}
@Override
public void loadTransferRects()
{
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "crafting" ) );
}
@Override
public void loadCraftingRecipes( String outputId, Object... results )
{
if( ( outputId.equals( "crafting" ) ) && ( this.getClass() == NEIFacadeRecipeHandler.class ) )
{
final List<ItemStack> facades = this.facade.getFacades();
for( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() )
{
for( ItemStack is : facades )
{
CachedShapedRecipe recipe = new CachedShapedRecipe( this.facade, anchorStack, is );
recipe.computeVisuals();
this.arecipes.add( recipe );
}
}
}
else
{
super.loadCraftingRecipes( outputId, results );
}
}
@Override
public void loadCraftingRecipes( ItemStack result )
{
if( result.getItem() == this.facade )
{
for( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() )
{
CachedShapedRecipe recipe = new CachedShapedRecipe( this.facade, anchorStack, result );
recipe.computeVisuals();
this.arecipes.add( recipe );
}
}
}
@Override
public void loadUsageRecipes( ItemStack ingredient )
{
List<ItemStack> facades = this.facade.getFacades();
for( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() )
{
for( ItemStack is : facades )
{
CachedShapedRecipe recipe = new CachedShapedRecipe( this.facade, anchorStack, is );
if( recipe.contains( recipe.ingredients, ingredient.getItem() ) )
{
recipe.computeVisuals();
if( recipe.contains( recipe.ingredients, ingredient ) )
{
recipe.setIngredientPermutation( recipe.ingredients, ingredient );
this.arecipes.add( recipe );
}
}
}
}
}
@Override
public String getGuiTexture()
{
return "textures/gui/container/crafting_table.png";
}
@Override
public String getOverlayIdentifier()
{
return "crafting";
}
@Override
public Class<? extends GuiContainer> getGuiClass()
{
return GuiCrafting.class;
}
@Override
public boolean hasOverlay( GuiContainer gui, Container container, int recipe )
{
return ( super.hasOverlay( gui, container, recipe ) ) || ( ( this.isRecipe2x2( recipe ) ) && ( RecipeInfo.hasDefaultOverlay( gui, "crafting2x2" ) ) );
}
@Override
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
{
IRecipeOverlayRenderer renderer = super.getOverlayRenderer( gui, recipe );
if( renderer != null )
{
return renderer;
}
IStackPositioner positioner = RecipeInfo.getStackPositioner( gui, "crafting2x2" );
if( positioner == null )
{
return null;
}
return new DefaultOverlayRenderer( this.getIngredientStacks( recipe ), positioner );
}
@Override
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
{
IOverlayHandler handler = super.getOverlayHandler( gui, recipe );
if( handler != null )
{
return handler;
}
return RecipeInfo.getOverlayHandler( gui, "crafting2x2" );
}
private boolean isRecipe2x2( final int recipe )
{
for( PositionedStack stack : this.getIngredientStacks( recipe ) )
{
if( ( stack.relx > 43 ) || ( stack.rely > 24 ) )
{
return false;
}
}
return true;
}
@Override
public String getRecipeName()
{
return GuiText.FacadeCrafting.getLocal();
}
private final class CachedShapedRecipe extends TemplateRecipeHandler.CachedRecipe
{
public final List<PositionedStack> ingredients;
public final PositionedStack result;
public CachedShapedRecipe( IFacadeItem facade, ItemStack anchor, ItemStack output )
{
output.stackSize = 4;
this.result = new PositionedStack( output, 119, 24 );
this.ingredients = new ArrayList<PositionedStack>();
ItemStack in = facade.getTextureItem( output );
this.setIngredients( 3, 3, new Object[] { null, anchor, null, anchor, in, anchor, null, anchor, null } );
}
public void setIngredients( int width, int height, Object[] items )
{
for( int x = 0; x < width; x++ )
{
for( int y = 0; y < height; y++ )
{
if( items[( y * width + x )] != null )
{
ItemStack is = (ItemStack) items[( y * width + x )];
PositionedStack stack = new PositionedStack( is, 25 + x * 18, 6 + y * 18, false );
stack.setMaxSize( 1 );
this.ingredients.add( stack );
}
}
}
}
@Override
public PositionedStack getResult()
{
return this.result;
}
@Override
public List<PositionedStack> getIngredients()
{
return this.getCycledIngredients( NEIFacadeRecipeHandler.this.cycleticks / 20, this.ingredients );
}
public void computeVisuals()
{
for( PositionedStack p : this.ingredients )
{
p.generatePermutations();
}
this.result.generatePermutations();
}
}
}

View File

@ -1,243 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.NEIHelpers;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.api.IOverlayHandler;
import codechicken.nei.api.IRecipeOverlayRenderer;
import codechicken.nei.recipe.TemplateRecipeHandler;
import appeng.api.AEApi;
import appeng.api.features.IGrinderEntry;
import appeng.client.gui.implementations.GuiGrinder;
import appeng.core.localization.GuiText;
public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
{
@Override
public void loadTransferRects()
{
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "grindstone" ) );
}
@Override
public void loadCraftingRecipes( String outputId, Object... results )
{
if( ( outputId.equals( "grindstone" ) ) && ( this.getClass() == NEIGrinderRecipeHandler.class ) )
{
for( IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes() )
{
CachedGrindStoneRecipe cachedRecipe = new CachedGrindStoneRecipe( recipe );
cachedRecipe.computeVisuals();
this.arecipes.add( cachedRecipe );
}
}
else
{
super.loadCraftingRecipes( outputId, results );
}
}
@Override
public void loadCraftingRecipes( ItemStack result )
{
for( IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes() )
{
if( NEIServerUtils.areStacksSameTypeCrafting( recipe.getOutput(), result ) )
{
CachedGrindStoneRecipe cachedRecipe = new CachedGrindStoneRecipe( recipe );
cachedRecipe.computeVisuals();
this.arecipes.add( cachedRecipe );
}
}
}
@Override
public void loadUsageRecipes( ItemStack ingredient )
{
for( IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes() )
{
CachedGrindStoneRecipe cachedRecipe = new CachedGrindStoneRecipe( recipe );
if( ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) ) )
{
cachedRecipe.computeVisuals();
if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
{
cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient );
this.arecipes.add( cachedRecipe );
}
}
}
}
@Override
public String getGuiTexture()
{
ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/guis/grinder.png" );
return loc.toString();
}
@Override
public String getOverlayIdentifier()
{
return "grindstone";
}
@Override
public Class<? extends GuiContainer> getGuiClass()
{
return GuiGrinder.class;
}
@Override
public void drawBackground( int recipe )
{
GL11.glColor4f( 1, 1, 1, 1 );
GuiDraw.changeTexture( this.getGuiTexture() );
GuiDraw.drawTexturedModalRect( 40, 10, 75, 16 + 10, 90, 66 );
}
@Override
public void drawForeground( int recipe )
{
super.drawForeground( recipe );
if( this.arecipes.size() > recipe )
{
CachedRecipe cr = this.arecipes.get( recipe );
if( cr instanceof CachedGrindStoneRecipe )
{
CachedGrindStoneRecipe cachedRecipe = (CachedGrindStoneRecipe) cr;
if( cachedRecipe.hasOptional )
{
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
int width = fr.getStringWidth( cachedRecipe.displayChance );
fr.drawString( cachedRecipe.displayChance, ( 168 - width ) / 2, 5, 0 );
}
else
{
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
int width = fr.getStringWidth( GuiText.NoSecondOutput.getLocal() );
fr.drawString( GuiText.NoSecondOutput.getLocal(), ( 168 - width ) / 2, 5, 0 );
}
}
}
}
@Override
public boolean hasOverlay( GuiContainer gui, Container container, int recipe )
{
return false;
}
@Override
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
{
return null;
}
@Override
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
{
return null;
}
@Override
public String getRecipeName()
{
return GuiText.GrindStone.getLocal();
}
private class CachedGrindStoneRecipe extends TemplateRecipeHandler.CachedRecipe
{
private final List<PositionedStack> ingredients;
private final PositionedStack result;
private String displayChance;
private boolean hasOptional = false;
public CachedGrindStoneRecipe( IGrinderEntry recipe )
{
this.result = new PositionedStack( recipe.getOutput(), -30 + 107, 47 );
this.ingredients = new ArrayList<PositionedStack>();
final ItemStack optionalOutput = recipe.getOptionalOutput();
final int optionalChancePercent = (int) ( recipe.getOptionalChance() * 100 );
if( optionalOutput != null )
{
this.hasOptional = true;
this.displayChance = String.format( GuiText.OfSecondOutput.getLocal(), optionalChancePercent );
this.ingredients.add( new PositionedStack( optionalOutput, -30 + 107 + 18, 47 ) );
}
final ItemStack secondOptionalOutput = recipe.getSecondOptionalOutput();
final int secondOptionalChancePercent = (int) ( recipe.getSecondOptionalChance() * 100 );
if( secondOptionalOutput != null )
{
this.hasOptional = true;
this.displayChance = String.format( GuiText.MultipleOutputs.getLocal(), optionalChancePercent, secondOptionalChancePercent );
this.ingredients.add( new PositionedStack( secondOptionalOutput, -30 + 107 + 18 + 18, 47 ) );
}
if( recipe.getInput() != null )
{
this.ingredients.add( new PositionedStack( recipe.getInput(), 45, 24 ) );
}
}
@Override
public PositionedStack getResult()
{
return this.result;
}
@Override
public List<PositionedStack> getIngredients()
{
return this.getCycledIngredients( NEIGrinderRecipeHandler.this.cycleticks / 20, this.ingredients );
}
private void computeVisuals()
{
for( PositionedStack p : this.ingredients )
{
p.generatePermutations();
}
this.result.generatePermutations();
}
}
}

View File

@ -1,208 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.NEIHelpers;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.api.IOverlayHandler;
import codechicken.nei.api.IRecipeOverlayRenderer;
import codechicken.nei.recipe.TemplateRecipeHandler;
import appeng.api.AEApi;
import appeng.api.features.IInscriberRecipe;
import appeng.client.gui.implementations.GuiInscriber;
import appeng.core.localization.GuiText;
/**
* @author AlgorithmX2
* @author thatsIch
* @version rv2
* @since rv0
*/
public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
{
@Override
public void loadTransferRects()
{
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "inscriber" ) );
}
@Override
public void loadCraftingRecipes( String outputId, Object... results )
{
if( ( outputId.equals( "inscriber" ) ) && ( this.getClass() == NEIInscriberRecipeHandler.class ) )
{
for( IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
{
CachedInscriberRecipe cachedRecipe = new CachedInscriberRecipe( recipe );
cachedRecipe.computeVisuals();
this.arecipes.add( cachedRecipe );
}
}
else
{
super.loadCraftingRecipes( outputId, results );
}
}
@Override
public void loadCraftingRecipes( ItemStack result )
{
for( IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
{
if( NEIServerUtils.areStacksSameTypeCrafting( recipe.getOutput(), result ) )
{
CachedInscriberRecipe cachedRecipe = new CachedInscriberRecipe( recipe );
cachedRecipe.computeVisuals();
this.arecipes.add( cachedRecipe );
}
}
}
@Override
public void loadUsageRecipes( ItemStack ingredient )
{
for( IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
{
CachedInscriberRecipe cachedRecipe = new CachedInscriberRecipe( recipe );
if( ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) ) )
{
cachedRecipe.computeVisuals();
if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
{
cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient );
this.arecipes.add( cachedRecipe );
}
}
}
}
@Override
public String getGuiTexture()
{
ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/guis/inscriber.png" );
return loc.toString();
}
@Override
public String getOverlayIdentifier()
{
return "inscriber";
}
@Override
public Class<? extends GuiContainer> getGuiClass()
{
return GuiInscriber.class;
}
@Override
public void drawBackground( int recipe )
{
GL11.glColor4f( 1, 1, 1, 1 );
GuiDraw.changeTexture( this.getGuiTexture() );
GuiDraw.drawTexturedModalRect( 0, 0, 5, 11, 166, 75 );
}
@Override
public boolean hasOverlay( GuiContainer gui, Container container, int recipe )
{
return false;
}
@Override
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
{
return null;
}
@Override
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
{
return null;
}
@Override
public String getRecipeName()
{
return GuiText.Inscriber.getLocal();
}
private class CachedInscriberRecipe extends TemplateRecipeHandler.CachedRecipe
{
private final List<PositionedStack> ingredients;
private final PositionedStack result;
public CachedInscriberRecipe( IInscriberRecipe recipe )
{
this.result = new PositionedStack( recipe.getOutput(), 108, 29 );
this.ingredients = new ArrayList<PositionedStack>();
for( ItemStack top : recipe.getTopOptional().asSet() )
{
this.ingredients.add( new PositionedStack( top, 40, 5 ) );
}
this.ingredients.add( new PositionedStack( recipe.getInputs(), 40 + 18, 28 ) );
for( ItemStack bot : recipe.getBottomOptional().asSet() )
{
this.ingredients.add( new PositionedStack( bot, 40, 51 ) );
}
}
@Override
public PositionedStack getResult()
{
return this.result;
}
@Override
public List<PositionedStack> getIngredients()
{
return this.getCycledIngredients( NEIInscriberRecipeHandler.this.cycleticks / 20, this.ingredients );
}
private void computeVisuals()
{
for( PositionedStack p : this.ingredients )
{
p.generatePermutations();
}
this.result.generatePermutations();
}
}
}

View File

@ -1,254 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.NEIHelpers;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.api.IOverlayHandler;
import codechicken.nei.api.IRecipeOverlayRenderer;
import codechicken.nei.recipe.GuiRecipe;
import codechicken.nei.recipe.ICraftingHandler;
import codechicken.nei.recipe.IUsageHandler;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IItemDefinition;
import appeng.api.definitions.IMaterials;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import appeng.core.localization.GuiText;
public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
{
private final Map<IItemDefinition, String> details = new HashMap<IItemDefinition, String>();
private final List<IItemDefinition> offsets = new LinkedList<IItemDefinition>();
private final List<PositionedStack> outputs = new LinkedList<PositionedStack>();
private ItemStack target;
@Override
public String getRecipeName()
{
return GuiText.InWorldCrafting.getLocal();
}
@Override
public int numRecipes()
{
return this.offsets.size();
}
@Override
public void drawBackground( int recipe )
{
GL11.glColor4f( 1, 1, 1, 1 );// nothing.
}
@Override
public void drawForeground( int recipe )
{
if( this.outputs.size() > recipe )
{
// PositionedStack cr = this.outputs.get( recipe );
String details = this.details.get( this.offsets.get( recipe ) );
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
fr.drawSplitString( details, 10, 25, 150, 0 );
}
}
@Override
public List<PositionedStack> getIngredientStacks( int recipeIndex )
{
return new ArrayList<PositionedStack>();
}
@Override
public List<PositionedStack> getOtherStacks( int recipeIndex )
{
return new ArrayList<PositionedStack>();
}
@Override
public PositionedStack getResultStack( int recipe )
{
return this.outputs.get( recipe );
}
@Override
public void onUpdate()
{
}
@Override
public boolean hasOverlay( GuiContainer gui, Container container, int recipe )
{
return false;
}
@Override
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
{
return null;
}
@Override
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
{
return null;
}
@Override
public int recipiesPerPage()
{
return 1;
}
@Override
public List<String> handleTooltip( GuiRecipe gui, List<String> currentToolTip, int recipe )
{
return currentToolTip;
}
@Override
public List<String> handleItemTooltip( GuiRecipe gui, ItemStack stack, List<String> currentToolTip, int recipe )
{
return currentToolTip;
}
@Override
public boolean keyTyped( GuiRecipe gui, char keyChar, int keyCode, int recipe )
{
return false;
}
@Override
public boolean mouseClicked( GuiRecipe gui, int button, int recipe )
{
return false;
}
@Override
public IUsageHandler getUsageHandler( String inputId, Object... ingredients )
{
return this;
}
@Override
public ICraftingHandler getRecipeHandler( String outputId, Object... results )
{
NEIWorldCraftingHandler g = this.newInstance();
if( results.length > 0 && results[0] instanceof ItemStack )
{
g.target = (ItemStack) results[0];
g.addRecipes();
return g;
}
return this;
}
private NEIWorldCraftingHandler newInstance()
{
try
{
return this.getClass().newInstance();
}
catch( InstantiationException e )
{
throw new IllegalStateException( e );
}
catch( IllegalAccessException e )
{
throw new IllegalStateException( e );
}
}
private void addRecipes()
{
final IDefinitions definitions = AEApi.instance().definitions();
final IMaterials materials = definitions.materials();
final String message;
if( AEConfig.instance.isFeatureEnabled( AEFeature.CertusQuartzWorldGen ) )
{
message = GuiText.ChargedQuartz.getLocal() + "\n\n" + GuiText.ChargedQuartzFind.getLocal();
}
else
{
message = GuiText.ChargedQuartzFind.getLocal();
}
this.addRecipe( materials.certusQuartzCrystalCharged(), message );
if( AEConfig.instance.isFeatureEnabled( AEFeature.MeteoriteWorldGen ) )
{
this.addRecipe( materials.logicProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() );
this.addRecipe( materials.calcProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() );
this.addRecipe( materials.engProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() );
}
if( AEConfig.instance.isFeatureEnabled( AEFeature.InWorldFluix ) )
{
this.addRecipe( materials.fluixCrystal(), GuiText.inWorldFluix.getLocal() );
}
if( AEConfig.instance.isFeatureEnabled( AEFeature.InWorldSingularity ) )
{
this.addRecipe( materials.qESingularity(), GuiText.inWorldSingularity.getLocal() );
}
if( AEConfig.instance.isFeatureEnabled( AEFeature.InWorldPurification ) )
{
this.addRecipe( materials.purifiedCertusQuartzCrystal(), GuiText.inWorldPurificationCertus.getLocal() );
this.addRecipe( materials.purifiedNetherQuartzCrystal(), GuiText.inWorldPurificationNether.getLocal() );
this.addRecipe( materials.purifiedFluixCrystal(), GuiText.inWorldPurificationFluix.getLocal() );
}
}
private void addRecipe( IItemDefinition def, String msg )
{
for( ItemStack definitionStack : def.maybeStack( 1 ).asSet() )
{
if( NEIServerUtils.areStacksSameTypeCrafting( definitionStack, this.target ) )
{
this.offsets.add( def );
this.outputs.add( new PositionedStack( definitionStack, 75, 4 ) );
this.details.put( def, msg );
}
}
}
}

View File

@ -1,46 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.NEIHelpers;
import java.util.ArrayList;
import codechicken.nei.PositionedStack;
import codechicken.nei.api.IStackPositioner;
import appeng.client.gui.implementations.GuiMEMonitorable;
public class TerminalCraftingSlotFinder implements IStackPositioner
{
@Override
public ArrayList<PositionedStack> positionStacks( ArrayList<PositionedStack> a )
{
for( PositionedStack ps : a )
{
if( ps != null )
{
ps.relx += GuiMEMonitorable.craftingGridOffsetX;
ps.rely += GuiMEMonitorable.craftingGridOffsetY;
}
}
return a;
}
}

View File

@ -1,77 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import li.cil.oc.api.Items;
import appeng.api.AEApi;
import appeng.api.IAppEngApi;
import appeng.api.config.TunnelType;
import appeng.api.features.IP2PTunnelRegistry;
import appeng.api.parts.IPartHelper;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
public class OpenComputers implements IIntegrationModule
{
@Reflected
public static OpenComputers instance;
@Reflected
public OpenComputers()
{
IntegrationHelper.testClassExistence( this, li.cil.oc.api.Items.class );
IntegrationHelper.testClassExistence( this, li.cil.oc.api.Network.class );
IntegrationHelper.testClassExistence( this, li.cil.oc.api.network.Environment.class );
IntegrationHelper.testClassExistence( this, li.cil.oc.api.network.SidedEnvironment.class );
IntegrationHelper.testClassExistence( this, li.cil.oc.api.network.Node.class );
IntegrationHelper.testClassExistence( this, li.cil.oc.api.network.Message.class );
}
@Override
public void init()
{
final IAppEngApi api = AEApi.instance();
final IPartHelper partHelper = api.partHelper();
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.OpenComputers ) )
{
partHelper.registerNewLayer( "appeng.parts.layers.LayerSidedEnvironment", "li.cil.oc.api.network.SidedEnvironment" );
}
}
@Override
public void postInit()
{
final IP2PTunnelRegistry registry = AEApi.instance().registries().p2pTunnel();
registry.addNewAttunement( Items.get( "cable" ).createItemStack( 1 ), TunnelType.COMPUTER_MESSAGE );
registry.addNewAttunement( Items.get( "adapter" ).createItemStack( 1 ), TunnelType.COMPUTER_MESSAGE );
registry.addNewAttunement( Items.get( "switch" ).createItemStack( 1 ), TunnelType.COMPUTER_MESSAGE );
registry.addNewAttunement( Items.get( "accessPoint" ).createItemStack( 1 ), TunnelType.COMPUTER_MESSAGE );
registry.addNewAttunement( Items.get( "lanCard" ).createItemStack( 1 ), TunnelType.COMPUTER_MESSAGE );
registry.addNewAttunement( Items.get( "linkedCard" ).createItemStack( 1 ), TunnelType.COMPUTER_MESSAGE );
registry.addNewAttunement( Items.get( "wlanCard" ).createItemStack( 1 ), TunnelType.COMPUTER_MESSAGE );
registry.addNewAttunement( Items.get( "analyzer" ).createItemStack( 1 ), TunnelType.COMPUTER_MESSAGE );
}
}

View File

@ -1,85 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.registry.GameRegistry;
import appeng.api.AEApi;
import appeng.api.IAppEngApi;
import appeng.api.config.TunnelType;
import appeng.api.features.IP2PTunnelRegistry;
import appeng.api.parts.IPartHelper;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
public class PneumaticCraft implements IIntegrationModule
{
@Reflected
public static PneumaticCraft instance;
private static final String PNEUMATIC_CRAFT_MOD_ID = "PneumaticCraft";
@Reflected
public PneumaticCraft()
{
IntegrationHelper.testClassExistence( this, pneumaticCraft.api.block.BlockSupplier.class );
IntegrationHelper.testClassExistence( this, pneumaticCraft.api.tileentity.ISidedPneumaticMachine.class );
IntegrationHelper.testClassExistence( this, pneumaticCraft.api.tileentity.AirHandlerSupplier.class );
IntegrationHelper.testClassExistence( this, pneumaticCraft.api.tileentity.IAirHandler.class );
}
@Override
public void init()
{
final IAppEngApi api = AEApi.instance();
final IPartHelper partHelper = api.partHelper();
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.PneumaticCraft ) )
{
partHelper.registerNewLayer( appeng.parts.layers.LayerPressure.class.getName(), pneumaticCraft.api.tileentity.ISidedPneumaticMachine.class.getName() );
}
}
@Override
public void postInit()
{
this.registerPressureAttunement( "pressureTube" );
this.registerPressureAttunement( "advancedPressureTube" );
}
private void registerPressureAttunement( String itemID )
{
final IP2PTunnelRegistry registry = AEApi.instance().registries().p2pTunnel();
final ItemStack modItem = GameRegistry.findItemStack( PNEUMATIC_CRAFT_MOD_ID, itemID, 1 );
if( modItem != null )
{
modItem.setItemDamage( OreDictionary.WILDCARD_VALUE );
registry.addNewAttunement( modItem, TunnelType.PRESSURE );
}
}
}

View File

@ -1,61 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import net.minecraft.item.ItemStack;
import mods.railcraft.api.crafting.IRockCrusherRecipe;
import mods.railcraft.api.crafting.RailcraftCraftingManager;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import appeng.integration.abstraction.IRC;
public class RC implements IRC, IIntegrationModule
{
@Reflected
public static RC instance;
@Reflected
public RC()
{
IntegrationHelper.testClassExistence( this, mods.railcraft.api.crafting.RailcraftCraftingManager.class );
IntegrationHelper.testClassExistence( this, mods.railcraft.api.crafting.IRockCrusherRecipe.class );
}
@Override
public void rockCrusher( ItemStack input, ItemStack output )
{
IRockCrusherRecipe re = RailcraftCraftingManager.rockCrusher.createNewRecipe( input, true, true );
re.addOutput( output, 1.0f );
}
@Override
public void init()
{
}
@Override
public void postInit()
{
}
}

View File

@ -1,96 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;
import appeng.api.AEApi;
import appeng.api.IAppEngApi;
import appeng.api.config.TunnelType;
import appeng.api.parts.IPartHelper;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
public final class RF implements IIntegrationModule
{
@Reflected
public static RF instance;
@Reflected
public RF()
{
IntegrationHelper.testClassExistence( this, cofh.api.energy.IEnergyReceiver.class );
IntegrationHelper.testClassExistence( this, cofh.api.energy.IEnergyProvider.class );
IntegrationHelper.testClassExistence( this, cofh.api.energy.IEnergyHandler.class );
IntegrationHelper.testClassExistence( this, cofh.api.energy.IEnergyConnection.class );
}
@Override
public void init()
{
final IAppEngApi api = AEApi.instance();
final IPartHelper partHelper = api.partHelper();
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.RF ) )
{
partHelper.registerNewLayer( "appeng.parts.layers.LayerIEnergyHandler", "cofh.api.energy.IEnergyReceiver" );
}
}
@Override
public void postInit()
{
this.registerRFAttunement( "ExtraUtilities", "extractor_base", 12 );
this.registerRFAttunement( "ExtraUtilities", "pipes", 11 );
this.registerRFAttunement( "ExtraUtilities", "pipes", 14 );
this.registerRFAttunement( "ExtraUtilities", "generator", OreDictionary.WILDCARD_VALUE );
this.registerRFAttunement( "ThermalExpansion", "Cell", OreDictionary.WILDCARD_VALUE );
this.registerRFAttunement( "ThermalExpansion", "Dynamo", OreDictionary.WILDCARD_VALUE );
// Fluxduct
this.registerRFAttunement( "ThermalDynamics", "ThermalDynamics_0", 0 );
this.registerRFAttunement( "EnderIO", "itemPowerConduit", OreDictionary.WILDCARD_VALUE );
this.registerRFAttunement( "EnderIO", "blockCapacitorBank", 0 );
this.registerRFAttunement( "EnderIO", "blockPowerMonitor", 0 );
}
private void registerRFAttunement( String mod, String name, int dmg )
{
assert mod != null;
assert !mod.isEmpty();
assert name != null;
assert !name.isEmpty();
assert dmg >= 0;
final ItemStack modItem = GameRegistry.findItemStack( mod, name, 1 );
if( modItem != null )
{
modItem.setItemDamage( dmg );
AEApi.instance().registries().p2pTunnel().addNewAttunement( modItem, TunnelType.RF_POWER );
}
}
}

View File

@ -1,47 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
public class RFItem implements IIntegrationModule
{
@Reflected
public static RFItem instance;
@Reflected
public RFItem()
{
IntegrationHelper.testClassExistence( this, cofh.api.energy.IEnergyContainerItem.class );
}
@Override
public void init()
{
}
@Override
public void postInit()
{
}
}

View File

@ -1,48 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
public class RotaryCraft implements IIntegrationModule
{
@Reflected
public static RotaryCraft instance;
@Reflected
public RotaryCraft()
{
IntegrationHelper.testClassExistence( this, Reika.RotaryCraft.API.Power.AdvancedShaftPowerReceiver.class );
IntegrationHelper.testClassExistence( this, Reika.RotaryCraft.API.Interfaces.Transducerable.class );
}
@Override
public void init() throws Throwable
{
}
@Override
public void postInit()
{
}
}

View File

@ -1,73 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaRegistrar;
import appeng.helpers.Reflected;
import appeng.integration.IIntegrationModule;
import appeng.integration.IntegrationHelper;
import appeng.integration.modules.waila.PartWailaDataProvider;
import appeng.integration.modules.waila.TileWailaDataProvider;
import appeng.tile.AEBaseTile;
public class Waila implements IIntegrationModule
{
@Reflected
public static Waila instance;
@Reflected
public Waila()
{
IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaDataProvider.class );
IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaRegistrar.class );
IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaConfigHandler.class );
IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaDataAccessor.class );
IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.ITaggedList.class );
}
public static void register( IWailaRegistrar registrar )
{
final IWailaDataProvider partHost = new PartWailaDataProvider();
registrar.registerStackProvider( partHost, AEBaseTile.class );
registrar.registerBodyProvider( partHost, AEBaseTile.class );
registrar.registerNBTProvider( partHost, AEBaseTile.class );
final IWailaDataProvider tile = new TileWailaDataProvider();
registrar.registerBodyProvider( tile, AEBaseTile.class );
registrar.registerNBTProvider( tile, AEBaseTile.class );
}
@Override
public void init() throws Throwable
{
FMLInterModComms.sendMessage( "Waila", "register", this.getClass().getName() + ".register" );
}
@Override
public void postInit()
{
}
}

View File

@ -1,92 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.helpers;
import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
import net.minecraft.item.ItemStack;
<<<<<<< HEAD
=======
>>>>>>> 500fc47... Reduces visibility of internal fields/methods
import appeng.api.config.Actionable;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.ForgeDirection;
import appeng.util.item.AEItemStack;
public class BSCrate implements IMEInventory<IAEItemStack>
{
private final ICrateStorage crateStorage;
public BSCrate( final Object object )
{
this.crateStorage = (ICrateStorage) object;
}
@Override
public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src )
{
if( mode == Actionable.SIMULATE )
{
return null;
}
ItemStack failed = this.crateStorage.insertItems( input.getItemStack() );
if( failed == null )
{
return null;
}
input.setStackSize( failed.stackSize );
return input;
}
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
{
if( mode == Actionable.SIMULATE )
{
int howMany = this.crateStorage.getItemCount( request.getItemStack() );
return howMany > request.getStackSize() ? request : request.copy().setStackSize( howMany );
}
ItemStack obtained = this.crateStorage.extractItems( request.getItemStack(), (int) request.getStackSize() );
return AEItemStack.create( obtained );
}
@Override
public IItemList getAvailableItems( IItemList out )
{
for( ItemStack is : this.crateStorage.getContents() )
{
out.add( AEItemStack.create( is ) );
}
return out;
}
@Override
public StorageChannel getChannel()
{
return StorageChannel.ITEMS;
}
}

View File

@ -1,49 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.helpers;
import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
import net.minecraft.tileentity.TileEntity;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IExternalStorageHandler;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.StorageChannel;
import appeng.api.util.ForgeDirection;
public class BSCrateHandler implements IExternalStorageHandler
{
@Override
public boolean canHandle( TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc )
{
return channel == StorageChannel.ITEMS && te instanceof ICrateStorage;
}
@Override
public IMEInventory getInventory( TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src )
{
if( channel == StorageChannel.ITEMS )
{
return new BSCrate( te );
}
return null;
}
}

View File

@ -1,217 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.helpers;
import java.util.Iterator;
import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
import net.minecraft.item.ItemStack;
<<<<<<< HEAD
=======
>>>>>>> 500fc47... Reduces visibility of internal fields/methods
import appeng.api.config.FuzzyMode;
import appeng.api.util.ForgeDirection;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.inv.IInventoryDestination;
import appeng.util.inv.ItemSlot;
import appeng.util.iterators.StackToSlotIterator;
public class BSCrateStorageAdaptor extends InventoryAdaptor
{
private final ICrateStorage cs;
public BSCrateStorageAdaptor( final Object te )
{
this.cs = (ICrateStorage) te;
}
@Override
public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination )
{
ItemStack target = null;
for( ItemStack is : this.cs.getContents() )
{
if( is != null )
{
if( is.stackSize > 0 && ( filter == null || Platform.isSameItem( filter, is ) ) )
{
if( destination == null || destination.canInsert( is ) )
{
target = is;
break;
}
}
}
}
if( target != null )
{
ItemStack f = Platform.cloneItemStack( target );
f.stackSize = amount;
return this.cs.extractItems( f, amount );
}
return null;
}
@Override
public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination )
{
ItemStack target = null;
for( ItemStack is : this.cs.getContents() )
{
if( is != null )
{
if( is.stackSize > 0 && ( filter == null || Platform.isSameItem( filter, is ) ) )
{
if( destination == null || destination.canInsert( is ) )
{
target = is;
break;
}
}
}
}
if( target != null )
{
int cnt = this.cs.getItemCount( target );
if( cnt == 0 )
{
return null;
}
if( cnt > amount )
{
cnt = amount;
}
ItemStack c = target.copy();
c.stackSize = cnt;
return c;
}
return null;
}
@Override
public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
{
ItemStack target = null;
for( ItemStack is : this.cs.getContents() )
{
if( is != null )
{
if( is.stackSize > 0 && ( filter == null || Platform.isSameItemFuzzy( filter, is, fuzzyMode ) ) )
{
if( destination == null || destination.canInsert( is ) )
{
target = is;
break;
}
}
}
}
if( target != null )
{
ItemStack f = Platform.cloneItemStack( target );
f.stackSize = amount;
return this.cs.extractItems( f, amount );
}
return null;
}
@Override
public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
{
ItemStack target = null;
for( ItemStack is : this.cs.getContents() )
{
if( is != null )
{
if( is.stackSize > 0 && ( filter == null || Platform.isSameItemFuzzy( filter, is, fuzzyMode ) ) )
{
if( destination == null || destination.canInsert( is ) )
{
target = is;
break;
}
}
}
}
if( target != null )
{
int cnt = this.cs.getItemCount( target );
if( cnt == 0 )
{
return null;
}
if( cnt > amount )
{
cnt = amount;
}
ItemStack c = target.copy();
c.stackSize = cnt;
return c;
}
return null;
}
@Override
public ItemStack addItems( ItemStack toBeAdded )
{
return this.cs.insertItems( toBeAdded );
}
@Override
public ItemStack simulateAdd( ItemStack toBeSimulated )
{
int items = this.cs.getSpaceForItem( toBeSimulated );
ItemStack cloned = Platform.cloneItemStack( toBeSimulated );
if( toBeSimulated.stackSize <= items )
{
return null;
}
cloned.stackSize -= items;
return cloned;
}
@Override
public boolean containsItems()
{
return this.cs.getUniqueItems() > 0;
}
@Override
public Iterator<ItemSlot> iterator()
{
return new StackToSlotIterator( this.cs.getContents().iterator() );
}
}

View File

@ -1,40 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.helpers;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.fml.common.eventhandler.Event;
public class FMPPacketEvent extends Event
{
private final EntityPlayerMP sender;
public FMPPacketEvent( EntityPlayerMP sender )
{
this.sender = sender;
}
public EntityPlayerMP getSender()
{
return this.sender;
}
}

View File

@ -1,176 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.helpers;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import appeng.api.config.Actionable;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.integration.abstraction.IFZ;
import appeng.util.item.AEItemStack;
public class FactorizationBarrel implements IMEInventory<IAEItemStack>
{
private final IFZ fProxy;
private final TileEntity te;
public FactorizationBarrel( IFZ proxy, TileEntity tile )
{
this.te = tile;
this.fProxy = proxy;
}
public long remainingItemCount()
{
return this.fProxy.barrelGetMaxItemCount( this.te ) - this.fProxy.barrelGetItemCount( this.te );
}
@Override
public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src )
{
if( input == null )
{
return null;
}
if( input.getStackSize() == 0 )
{
return null;
}
ItemStack shared = input.getItemStack();
if( shared.isItemDamaged() )
{
return input;
}
if( this.remainingItemTypes() > 0 )
{
if( mode == Actionable.MODULATE )
{
this.fProxy.setItemType( this.te, input.getItemStack() );
}
}
if( this.containsItemType( input, mode == Actionable.SIMULATE ) )
{
int max = this.fProxy.barrelGetMaxItemCount( this.te );
int newTotal = (int) this.storedItemCount() + (int) input.getStackSize();
if( newTotal > max )
{
if( mode == Actionable.MODULATE )
{
this.fProxy.barrelSetCount( this.te, max );
}
IAEItemStack result = input.copy();
result.setStackSize( newTotal - max );
return result;
}
else
{
if( mode == Actionable.MODULATE )
{
this.fProxy.barrelSetCount( this.te, newTotal );
}
return null;
}
}
return input;
}
private long remainingItemTypes()
{
return this.fProxy.barrelGetItem( this.te ) == null ? 1 : 0;
}
private boolean containsItemType( final IAEItemStack i, final boolean acceptEmpty )
{
ItemStack currentItem = this.fProxy.barrelGetItem( this.te );
// empty barrels want your love too!
if( acceptEmpty && currentItem == null )
{
return true;
}
return i.equals( currentItem );
}
private long storedItemCount()
{
return this.fProxy.barrelGetItemCount( this.te );
}
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
{
if( this.containsItemType( request, false ) )
{
int howMany = (int) this.storedItemCount();
if( request.getStackSize() >= howMany )
{
if( mode == Actionable.MODULATE )
{
this.fProxy.setItemType( this.te, null );
this.fProxy.barrelSetCount( this.te, 0 );
}
IAEItemStack r = request.copy();
r.setStackSize( howMany );
return r;
}
else
{
if( mode == Actionable.MODULATE )
{
this.fProxy.barrelSetCount( this.te, (int) ( howMany - request.getStackSize() ) );
}
return request.copy();
}
}
return null;
}
@Override
public IItemList<IAEItemStack> getAvailableItems( IItemList out )
{
ItemStack i = this.fProxy.barrelGetItem( this.te );
if( i != null )
{
i.stackSize = this.fProxy.barrelGetItemCount( this.te );
out.addStorage( AEItemStack.create( i ) );
}
return out;
}
@Override
public StorageChannel getChannel()
{
return StorageChannel.ITEMS;
}
}

View File

@ -1,51 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.helpers;
import net.minecraft.tileentity.TileEntity;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IExternalStorageHandler;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.StorageChannel;
import appeng.api.util.ForgeDirection;
import appeng.integration.modules.FZ;
import appeng.me.storage.MEMonitorIInventory;
import appeng.util.inv.IMEAdaptor;
public class FactorizationHandler implements IExternalStorageHandler
{
@Override
public boolean canHandle( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc )
{
return chan == StorageChannel.ITEMS && FZ.instance.isBarrel( te );
}
@Override
public IMEInventory getInventory( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource src )
{
if( chan == StorageChannel.ITEMS )
{
return new MEMonitorIInventory( new IMEAdaptor( FZ.instance.getFactorizationBarrel( te ), src ) );
}
return null;
}
}

View File

@ -1,52 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.helpers;
import net.minecraft.tileentity.TileEntity;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IExternalStorageHandler;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.StorageChannel;
import appeng.api.util.ForgeDirection;
import appeng.integration.modules.DSU;
import appeng.me.storage.MEMonitorIInventory;
import appeng.util.inv.IMEAdaptor;
public class MFRDSUHandler implements IExternalStorageHandler
{
@Override
public boolean canHandle( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource mySrc )
{
return chan == StorageChannel.ITEMS && DSU.instance.isDSU( te );
}
@Override
public IMEInventory getInventory( TileEntity te, ForgeDirection d, StorageChannel chan, BaseActionSource src )
{
if( chan == StorageChannel.ITEMS )
{
return new MEMonitorIInventory( new IMEAdaptor( DSU.instance.getDSU( te ), src ) );
}
return null;
}
}

View File

@ -1,140 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.helpers;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import powercrystals.minefactoryreloaded.api.IDeepStorageUnit;
import appeng.api.config.Actionable;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.util.item.AEItemStack;
public class MinefactoryReloadedDeepStorageUnit implements IMEInventory<IAEItemStack>
{
private final IDeepStorageUnit dsu;
public MinefactoryReloadedDeepStorageUnit( TileEntity ta )
{
this.dsu = (IDeepStorageUnit) ta;
}
@Override
public IAEItemStack injectItems( IAEItemStack input, Actionable mode, BaseActionSource src )
{
ItemStack is = this.dsu.getStoredItemType();
if( is != null )
{
if( input.equals( is ) )
{
long max = this.dsu.getMaxStoredCount();
long storedItems = is.stackSize;
if( max == storedItems )
{
return input;
}
storedItems += input.getStackSize();
if( storedItems > max )
{
IAEItemStack overflow = AEItemStack.create( is );
overflow.setStackSize( (int) ( storedItems - max ) );
if( mode == Actionable.MODULATE )
{
this.dsu.setStoredItemCount( (int) max );
}
return overflow;
}
else
{
if( mode == Actionable.MODULATE )
{
this.dsu.setStoredItemCount( is.stackSize + (int) input.getStackSize() );
}
return null;
}
}
}
else
{
if( input.getTagCompound() != null )
{
return input;
}
if( mode == Actionable.MODULATE )
{
this.dsu.setStoredItemType( input.getItemStack(), (int) input.getStackSize() );
}
return null;
}
return input;
}
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
{
ItemStack is = this.dsu.getStoredItemType();
if( request.equals( is ) )
{
if( request.getStackSize() >= is.stackSize )
{
is = is.copy();
if( mode == Actionable.MODULATE )
{
this.dsu.setStoredItemCount( 0 );
}
return AEItemStack.create( is );
}
else
{
if( mode == Actionable.MODULATE )
{
this.dsu.setStoredItemCount( is.stackSize - (int) request.getStackSize() );
}
return request.copy();
}
}
return null;
}
@Override
public IItemList<IAEItemStack> getAvailableItems( IItemList<IAEItemStack> out )
{
ItemStack is = this.dsu.getStoredItemType();
if( is != null )
{
out.add( AEItemStack.create( is ) );
}
return out;
}
@Override
public StorageChannel getChannel()
{
return StorageChannel.ITEMS;
}
}

View File

@ -1,52 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.helpers;
import appeng.api.util.ForgeDirection;
import cofh.api.energy.IEnergyReceiver;
public class NullRFHandler implements IEnergyReceiver
{
@Override
public int receiveEnergy( ForgeDirection from, int maxReceive, boolean simulate )
{
return 0;
}
@Override
public int getEnergyStored( ForgeDirection from )
{
return 0;
}
@Override
public int getMaxEnergyStored( ForgeDirection from )
{
return 0;
}
@Override
public boolean canConnectEnergy( ForgeDirection from )
{
return true;
}
}

View File

@ -1,73 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.waila;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
/**
* Base implementation for {@link mcp.mobius.waila.api.IWailaDataProvider}
*
* @author thatsIch
* @version rv2
* @since rv2
*/
public abstract class BaseWailaDataProvider implements IWailaDataProvider
{
@Override
public ItemStack getWailaStack( IWailaDataAccessor accessor, IWailaConfigHandler config )
{
return null;
}
@Override
public List<String> getWailaHead( ItemStack itemStack, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config )
{
return currentToolTip;
}
@Override
public List<String> getWailaBody( ItemStack itemStack, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config )
{
return currentToolTip;
}
@Override
public List<String> getWailaTail( ItemStack itemStack, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config )
{
return currentToolTip;
}
@Override
public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z )
{
return tag;
}
}

View File

@ -1,194 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.integration.modules.waila;
import java.util.List;
import com.google.common.base.Optional;
import com.google.common.collect.Lists;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import appeng.api.parts.IPart;
import appeng.integration.modules.waila.part.ChannelWailaDataProvider;
import appeng.integration.modules.waila.part.IPartWailaDataProvider;
import appeng.integration.modules.waila.part.PartAccessor;
import appeng.integration.modules.waila.part.PartStackWailaDataProvider;
import appeng.integration.modules.waila.part.PowerStateWailaDataProvider;
import appeng.integration.modules.waila.part.StorageMonitorWailaDataProvider;
import appeng.integration.modules.waila.part.Tracer;
/**
* Delegation provider for parts through {@link appeng.integration.modules.waila.part.IPartWailaDataProvider}
*
* @author thatsIch
* @version rv2
* @since rv2
*/
public final class PartWailaDataProvider implements IWailaDataProvider
{
/**
* Contains all providers
*/
private final List<IPartWailaDataProvider> providers;
/**
* Can access parts through view-hits
*/
private final PartAccessor accessor = new PartAccessor();
/**
* Traces views hit on blocks
*/
private final Tracer tracer = new Tracer();
/**
* Initializes the provider list with all wanted providers
*/
public PartWailaDataProvider()
{
final IPartWailaDataProvider channel = new ChannelWailaDataProvider();
final IPartWailaDataProvider storageMonitor = new StorageMonitorWailaDataProvider();
final IPartWailaDataProvider powerState = new PowerStateWailaDataProvider();
final IPartWailaDataProvider partStack = new PartStackWailaDataProvider();
this.providers = Lists.newArrayList( channel, storageMonitor, powerState, partStack );
}
@Override
public ItemStack getWailaStack( IWailaDataAccessor accessor, IWailaConfigHandler config )
{
final TileEntity te = accessor.getTileEntity();
final MovingObjectPosition mop = accessor.getPosition();
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
if( maybePart.isPresent() )
{
final IPart part = maybePart.get();
ItemStack wailaStack = null;
for( IPartWailaDataProvider provider : this.providers )
{
wailaStack = provider.getWailaStack( part, config, wailaStack );
}
return wailaStack;
}
return null;
}
@Override
public List<String> getWailaHead( ItemStack itemStack, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config )
{
final TileEntity te = accessor.getTileEntity();
final MovingObjectPosition mop = accessor.getPosition();
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
if( maybePart.isPresent() )
{
final IPart part = maybePart.get();
for( IPartWailaDataProvider provider : this.providers )
{
provider.getWailaHead( part, currentToolTip, accessor, config );
}
}
return currentToolTip;
}
@Override
public List<String> getWailaBody( ItemStack itemStack, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config )
{
final TileEntity te = accessor.getTileEntity();
final MovingObjectPosition mop = accessor.getPosition();
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
if( maybePart.isPresent() )
{
final IPart part = maybePart.get();
for( IPartWailaDataProvider provider : this.providers )
{
provider.getWailaBody( part, currentToolTip, accessor, config );
}
}
return currentToolTip;
}
@Override
public List<String> getWailaTail( ItemStack itemStack, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config )
{
final TileEntity te = accessor.getTileEntity();
final MovingObjectPosition mop = accessor.getPosition();
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
if( maybePart.isPresent() )
{
final IPart part = maybePart.get();
for( IPartWailaDataProvider provider : this.providers )
{
provider.getWailaTail( part, currentToolTip, accessor, config );
}
}
return currentToolTip;
}
@Override
public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z )
{
final MovingObjectPosition mop = this.tracer.retraceBlock( world, player, x, y, z );
if( mop != null )
{
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
if( maybePart.isPresent() )
{
final IPart part = maybePart.get();
for( IPartWailaDataProvider provider : this.providers )
{
provider.getNBTData( player, part, te, tag, world, x, y, z );
}
}
}
return tag;
}
}

Some files were not shown because too many files have changed in this diff Show More