2014-03-26 04:06:54 +01:00
|
|
|
package appeng.block.crafting;
|
|
|
|
|
|
|
|
import java.util.EnumSet;
|
2014-05-10 07:00:02 +02:00
|
|
|
import java.util.List;
|
2014-03-26 04:06:54 +01:00
|
|
|
|
2014-05-14 04:42:14 +02:00
|
|
|
import net.minecraft.block.Block;
|
2014-03-26 04:06:54 +01:00
|
|
|
import net.minecraft.block.material.Material;
|
2014-05-10 07:00:02 +02:00
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2014-05-15 16:34:38 +02:00
|
|
|
import net.minecraft.util.IIcon;
|
2014-05-10 07:00:02 +02:00
|
|
|
import net.minecraft.world.World;
|
2014-03-26 04:06:54 +01:00
|
|
|
import appeng.block.AEBaseBlock;
|
2014-05-14 04:42:14 +02:00
|
|
|
import appeng.client.render.BaseBlockRender;
|
|
|
|
import appeng.client.render.blocks.RenderBlockCrafting;
|
2014-05-15 16:34:38 +02:00
|
|
|
import appeng.client.texture.ExtraTextures;
|
2014-03-26 04:06:54 +01:00
|
|
|
import appeng.core.features.AEFeature;
|
2014-05-09 06:10:12 +02:00
|
|
|
import appeng.tile.crafting.TileCraftingTile;
|
2014-03-26 04:06:54 +01:00
|
|
|
|
|
|
|
public class BlockCraftingUnit extends AEBaseBlock
|
|
|
|
{
|
|
|
|
|
2014-05-18 05:19:23 +02:00
|
|
|
public static final int FLAG_FORMED = 8;
|
|
|
|
public static final int FLAG_POWERED = 4;
|
2014-05-10 07:00:02 +02:00
|
|
|
|
2014-05-18 05:19:23 +02:00
|
|
|
public BlockCraftingUnit(Class<? extends BlockCraftingUnit> childClass) {
|
|
|
|
super( childClass, Material.iron );
|
|
|
|
hasSubtypes = true;
|
|
|
|
setfeature( EnumSet.of( AEFeature.Crafting ) );
|
2014-05-14 04:42:14 +02:00
|
|
|
}
|
|
|
|
|
2014-03-26 04:06:54 +01:00
|
|
|
public BlockCraftingUnit() {
|
2014-05-18 05:19:23 +02:00
|
|
|
this( BlockCraftingUnit.class );
|
2014-05-09 06:10:12 +02:00
|
|
|
setTileEntiy( TileCraftingTile.class );
|
2014-03-26 04:06:54 +01:00
|
|
|
}
|
|
|
|
|
2014-05-18 05:19:23 +02:00
|
|
|
@Override
|
|
|
|
public int getDamageValue(World w, int x, int y, int z)
|
|
|
|
{
|
|
|
|
int meta = w.getBlockMetadata( x, y, z );
|
|
|
|
return meta & 3;
|
|
|
|
}
|
|
|
|
|
2014-05-23 04:39:21 +02:00
|
|
|
@Override
|
|
|
|
public String getUnlocalizedName(ItemStack is)
|
|
|
|
{
|
|
|
|
if ( is.getItemDamage() == 1 )
|
|
|
|
return "tile.appliedenergistics2.BlockCraftingAccelerator";
|
|
|
|
|
|
|
|
return getItemUnlocalizedName( is );
|
|
|
|
}
|
|
|
|
|
|
|
|
protected String getItemUnlocalizedName(ItemStack is)
|
|
|
|
{
|
|
|
|
return super.getUnlocalizedName( is );
|
|
|
|
}
|
|
|
|
|
2014-05-15 16:34:38 +02:00
|
|
|
@Override
|
|
|
|
public IIcon getIcon(int direction, int metadata)
|
|
|
|
{
|
|
|
|
switch (metadata)
|
|
|
|
{
|
2014-05-18 05:19:23 +02:00
|
|
|
default:
|
|
|
|
case 0:
|
|
|
|
return super.getIcon( 0, 0 );
|
|
|
|
case 1:
|
2014-05-15 16:34:38 +02:00
|
|
|
return ExtraTextures.BlockCraftingAccelerator.getIcon();
|
2014-05-18 05:19:23 +02:00
|
|
|
case 0 | FLAG_FORMED:
|
2014-05-15 16:34:38 +02:00
|
|
|
return ExtraTextures.BlockCraftingUnitFit.getIcon();
|
2014-05-18 05:19:23 +02:00
|
|
|
case 1 | FLAG_FORMED:
|
|
|
|
return ExtraTextures.BlockCraftingAcceleratorFit.getIcon();
|
2014-05-15 16:34:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-14 04:42:14 +02:00
|
|
|
@Override
|
|
|
|
protected Class<? extends BaseBlockRender> getRenderer()
|
|
|
|
{
|
|
|
|
return RenderBlockCrafting.class;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onNeighborBlockChange(World w, int x, int y, int z, Block junk)
|
|
|
|
{
|
|
|
|
TileCraftingTile cp = getTileEntity( w, x, y, z );
|
|
|
|
if ( cp != null )
|
|
|
|
cp.updateMultiBlock();
|
|
|
|
}
|
|
|
|
|
2014-05-10 07:00:02 +02:00
|
|
|
@Override
|
|
|
|
public void getSubBlocks(Item i, CreativeTabs c, List l)
|
|
|
|
{
|
2014-05-18 05:19:23 +02:00
|
|
|
l.add( new ItemStack( this, 1, 0 ) );
|
|
|
|
l.add( new ItemStack( this, 1, 1 ) );
|
2014-05-10 07:00:02 +02:00
|
|
|
}
|
2014-03-26 04:06:54 +01:00
|
|
|
}
|