Most of the 1.8 Port.
This commit is contained in:
@@ -22,19 +22,18 @@ package appeng.block.crafting;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderBlockCraftingCPUMonitor;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.tile.crafting.TileCraftingMonitorTile;
|
||||
|
||||
|
||||
@@ -42,6 +41,7 @@ public class BlockCraftingMonitor extends BlockCraftingUnit
|
||||
{
|
||||
public BlockCraftingMonitor()
|
||||
{
|
||||
super( CraftingUnitType.MONITOR );
|
||||
this.setTileEntity( TileCraftingMonitorTile.class );
|
||||
}
|
||||
|
||||
@@ -52,24 +52,19 @@ public class BlockCraftingMonitor extends BlockCraftingUnit
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon( int direction, int metadata )
|
||||
public IAESprite getIcon(
|
||||
EnumFacing side,
|
||||
IBlockState state )
|
||||
{
|
||||
if( direction != ForgeDirection.SOUTH.ordinal() )
|
||||
if( side != EnumFacing.SOUTH )
|
||||
{
|
||||
for( Block craftingUnitBlock : AEApi.instance().definitions().blocks().craftingUnit().maybeBlock().asSet() )
|
||||
{
|
||||
return craftingUnitBlock.getIcon( direction, metadata );
|
||||
return ( (BlockCraftingUnit)craftingUnitBlock ).getIcon( side, state );
|
||||
}
|
||||
}
|
||||
|
||||
switch( metadata )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
return super.getIcon( 0, 0 );
|
||||
case FLAG_FORMED:
|
||||
return ExtraBlockTextures.BlockCraftingMonitorFit_Light.getIcon();
|
||||
}
|
||||
|
||||
return ExtraBlockTextures.BlockCraftingMonitorFit_Light.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,19 +24,18 @@ import java.util.List;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.crafting.TileCraftingStorageTile;
|
||||
|
||||
|
||||
public class BlockCraftingStorage extends BlockCraftingUnit
|
||||
{
|
||||
public BlockCraftingStorage()
|
||||
|
||||
public BlockCraftingStorage( CraftingUnitType type )
|
||||
{
|
||||
super(type );
|
||||
this.setTileEntity( TileCraftingStorageTile.class );
|
||||
}
|
||||
|
||||
@@ -47,29 +46,29 @@ public class BlockCraftingStorage extends BlockCraftingUnit
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon( int direction, int metadata )
|
||||
public appeng.client.texture.IAESprite getIcon(net.minecraft.util.EnumFacing side, net.minecraft.block.state.IBlockState state)
|
||||
{
|
||||
switch( metadata & ( ~4 ) )
|
||||
boolean formed = (boolean)state.getValue( FORMED );
|
||||
switch( this.type )
|
||||
{
|
||||
default:
|
||||
|
||||
case 0:
|
||||
return super.getIcon( 0, 0 );
|
||||
case 1:
|
||||
return ExtraBlockTextures.BlockCraftingStorage4k.getIcon();
|
||||
case 2:
|
||||
return ExtraBlockTextures.BlockCraftingStorage16k.getIcon();
|
||||
case 3:
|
||||
return ExtraBlockTextures.BlockCraftingStorage64k.getIcon();
|
||||
|
||||
case FLAG_FORMED:
|
||||
return ExtraBlockTextures.BlockCraftingStorage1kFit.getIcon();
|
||||
case 1 | FLAG_FORMED:
|
||||
return ExtraBlockTextures.BlockCraftingStorage4kFit.getIcon();
|
||||
case 2 | FLAG_FORMED:
|
||||
return ExtraBlockTextures.BlockCraftingStorage16kFit.getIcon();
|
||||
case 3 | FLAG_FORMED:
|
||||
return ExtraBlockTextures.BlockCraftingStorage64kFit.getIcon();
|
||||
case STORAGE_1K:
|
||||
return formed ?
|
||||
super.getIcon( side,state ) :
|
||||
ExtraBlockTextures.BlockCraftingStorage1kFit.getIcon();
|
||||
case STORAGE_4K:
|
||||
return formed ?
|
||||
ExtraBlockTextures.BlockCraftingStorage4k.getIcon() :
|
||||
ExtraBlockTextures.BlockCraftingStorage1kFit.getIcon();
|
||||
case STORAGE_16K:
|
||||
return formed ?
|
||||
ExtraBlockTextures.BlockCraftingStorage16k.getIcon() :
|
||||
ExtraBlockTextures.BlockCraftingStorage16kFit.getIcon();
|
||||
case STORAGE_64K:
|
||||
return formed ?
|
||||
ExtraBlockTextures.BlockCraftingStorage64k.getIcon() :
|
||||
ExtraBlockTextures.BlockCraftingStorage64kFit.getIcon();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,17 +24,20 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderBlockCraftingCPU;
|
||||
@@ -44,16 +47,49 @@ import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.crafting.TileCraftingTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
|
||||
public class BlockCraftingUnit extends AEBaseTileBlock
|
||||
{
|
||||
public static final PropertyBool POWERED = PropertyBool.create("powered");
|
||||
public static final PropertyBool FORMED = PropertyBool.create("formed");
|
||||
|
||||
public static final int FLAG_FORMED = 8;
|
||||
|
||||
public BlockCraftingUnit()
|
||||
final public CraftingUnitType type;
|
||||
|
||||
public static enum CraftingUnitType
|
||||
{
|
||||
super( Material.iron );
|
||||
UNIT, ACCELERATOR, STORAGE_1K,STORAGE_4K, STORAGE_16K, STORAGE_64K, MONITOR
|
||||
};
|
||||
|
||||
this.hasSubtypes = true;
|
||||
@Override
|
||||
public EnumWorldBlockLayer getBlockLayer()
|
||||
{
|
||||
return EnumWorldBlockLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(
|
||||
IBlockState state )
|
||||
{
|
||||
boolean p = (boolean)state.getValue( POWERED );
|
||||
boolean f = (boolean)state.getValue( FORMED );
|
||||
return (p ? 1 : 0) | (f?2 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta( int meta )
|
||||
{
|
||||
return getDefaultState().withProperty( POWERED, ( meta & 1 ) == 1 ? true : false ).withProperty( FORMED, ( meta & 2 ) == 2 ? true : false );
|
||||
}
|
||||
|
||||
public BlockCraftingUnit( CraftingUnitType type )
|
||||
{
|
||||
super( Material.iron, Optional.of(type.name()) );
|
||||
|
||||
this.type = type;
|
||||
this.setTileEntity( TileCraftingTile.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.CraftingCPU ) );
|
||||
}
|
||||
@@ -65,26 +101,34 @@ public class BlockCraftingUnit extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon( int direction, int metadata )
|
||||
public appeng.client.texture.IAESprite getIcon(EnumFacing side, IBlockState state)
|
||||
{
|
||||
switch( metadata )
|
||||
if ( type == CraftingUnitType.ACCELERATOR )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
return super.getIcon( 0, 0 );
|
||||
case 1:
|
||||
return ExtraBlockTextures.BlockCraftingAccelerator.getIcon();
|
||||
case FLAG_FORMED:
|
||||
return ExtraBlockTextures.BlockCraftingUnitFit.getIcon();
|
||||
case 1 | FLAG_FORMED:
|
||||
if ( (boolean)state.getValue( FORMED ) )
|
||||
return ExtraBlockTextures.BlockCraftingAcceleratorFit.getIcon();
|
||||
|
||||
return ExtraBlockTextures.BlockCraftingAccelerator.getIcon();
|
||||
}
|
||||
|
||||
if ( (boolean)state.getValue( FORMED ) )
|
||||
return ExtraBlockTextures.BlockCraftingUnitFit.getIcon();
|
||||
|
||||
return super.getIcon( side,state );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ )
|
||||
{
|
||||
TileCraftingTile tg = this.getTileEntity( w, x, y, z );
|
||||
@Override
|
||||
public boolean onBlockActivated(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
IBlockState state,
|
||||
EntityPlayer p,
|
||||
EnumFacing side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ )
|
||||
{
|
||||
TileCraftingTile tg = this.getTileEntity( w, pos );
|
||||
if( tg != null && !p.isSneaking() && tg.isFormed() && tg.isActive() )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
@@ -92,7 +136,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock
|
||||
return true;
|
||||
}
|
||||
|
||||
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_CRAFTING_CPU );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CRAFTING_CPU );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -108,23 +152,18 @@ public class BlockCraftingUnit extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRenderStateByMeta( int itemDamage )
|
||||
public void breakBlock(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
IBlockState state )
|
||||
{
|
||||
IIcon front = this.getIcon( ForgeDirection.SOUTH.ordinal(), itemDamage );
|
||||
IIcon other = this.getIcon( ForgeDirection.NORTH.ordinal(), itemDamage );
|
||||
this.getRendererInstance().setTemporaryRenderIcons( other, other, front, other, other, other );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock( World w, int x, int y, int z, Block a, int b )
|
||||
{
|
||||
TileCraftingTile cp = this.getTileEntity( w, x, y, z );
|
||||
TileCraftingTile cp = this.getTileEntity( w, pos );
|
||||
if( cp != null )
|
||||
{
|
||||
cp.breakCluster();
|
||||
}
|
||||
|
||||
super.breakBlock( w, x, y, z, a, b );
|
||||
super.breakBlock( w, pos, state );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -144,25 +183,23 @@ public class BlockCraftingUnit extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange( World w, int x, int y, int z, Block junk )
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
TileCraftingTile cp = this.getTileEntity( w, x, y, z );
|
||||
return new IProperty[]{POWERED, FORMED };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(
|
||||
World worldIn,
|
||||
BlockPos pos,
|
||||
IBlockState state,
|
||||
Block neighborBlock )
|
||||
{
|
||||
TileCraftingTile cp = this.getTileEntity( worldIn, pos );
|
||||
if( cp != null )
|
||||
{
|
||||
cp.updateMultiBlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped( int meta )
|
||||
{
|
||||
return meta & 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamageValue( World w, int x, int y, int z )
|
||||
{
|
||||
int meta = w.getBlockMetadata( x, y, z );
|
||||
return this.damageDropped( meta );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,13 +22,15 @@ package appeng.block.crafting;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.blocks.RenderBlockAssembler;
|
||||
@@ -41,8 +43,6 @@ import appeng.util.Platform;
|
||||
public class BlockMolecularAssembler extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
public static boolean booleanAlphaPass = false;
|
||||
|
||||
public BlockMolecularAssembler()
|
||||
{
|
||||
super( Material.iron );
|
||||
@@ -54,18 +54,10 @@ public class BlockMolecularAssembler extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass()
|
||||
{
|
||||
return 1;
|
||||
public boolean canRenderInLayer(net.minecraft.util.EnumWorldBlockLayer layer) {
|
||||
return layer == EnumWorldBlockLayer.CUTOUT_MIPPED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderInPass( int pass )
|
||||
{
|
||||
booleanAlphaPass = pass == 1;
|
||||
return pass == 0 || pass == 1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public Class<? extends BaseBlockRender> getRenderer()
|
||||
@@ -74,12 +66,20 @@ public class BlockMolecularAssembler extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ )
|
||||
public boolean onBlockActivated(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
IBlockState state,
|
||||
EntityPlayer p,
|
||||
EnumFacing side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ )
|
||||
{
|
||||
TileMolecularAssembler tg = this.getTileEntity( w, x, y, z );
|
||||
TileMolecularAssembler tg = this.getTileEntity( w, pos );
|
||||
if( tg != null && !p.isSneaking() )
|
||||
{
|
||||
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_MAC );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_MAC );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -21,7 +21,6 @@ package appeng.block.crafting;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.block.AEBaseItemBlock;
|
||||
import appeng.core.AEConfig;
|
||||
|
||||
Reference in New Issue
Block a user