buildcraft/common/buildcraft/silicon/BlockLaserTable.java

126 lines
3.1 KiB
Java
Raw Normal View History

2014-02-15 09:21:40 +01:00
/**
* Copyright (c) 2011-2017, SpaceToad and the BuildCraft Team
2014-02-15 09:21:40 +01:00
* http://www.mod-buildcraft.com
2015-09-20 11:20:30 +02:00
* <p/>
2014-02-15 09:21:40 +01:00
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
2012-07-25 12:45:15 +02:00
package buildcraft.silicon;
2012-05-09 22:43:05 +02:00
2014-09-10 15:18:23 +02:00
import java.util.List;
2015-05-07 19:49:53 +02:00
2012-12-17 23:30:54 +01:00
import net.minecraft.block.material.Material;
2012-12-17 23:29:42 +01:00
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
2014-02-08 14:47:31 +01:00
import net.minecraft.item.Item;
2012-12-17 23:29:42 +01:00
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
2015-09-20 11:20:30 +02:00
2014-09-10 15:18:23 +02:00
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
2015-05-07 19:49:53 +02:00
2014-09-10 15:18:23 +02:00
import buildcraft.BuildCraftSilicon;
import buildcraft.api.power.ILaserTargetBlock;
import buildcraft.core.BCCreativeTab;
import buildcraft.core.lib.block.BlockBuildCraft;
2012-05-09 22:43:05 +02:00
public class BlockLaserTable extends BlockBuildCraft implements ILaserTargetBlock {
2015-09-20 11:20:30 +02:00
protected static final int TABLE_MAX = 6;
2012-05-09 22:43:05 +02:00
2014-02-08 14:47:31 +01:00
public BlockLaserTable() {
super(Material.iron);
2012-06-04 22:48:18 +02:00
2023-01-29 16:58:27 +01:00
setBlockBounds(0, 0, 0, 1, 9F / 16F, 1);
2013-09-16 08:18:14 +02:00
setHardness(10F);
setCreativeTab(BCCreativeTab.get("main"));
2015-03-26 22:40:59 +01:00
setPassCount(2);
setAlphaPass(true);
2012-05-09 22:43:05 +02:00
}
2012-06-04 22:48:18 +02:00
2012-05-09 22:43:05 +02:00
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public int getRenderType() {
2023-01-29 16:58:27 +01:00
return 0;
}
2012-05-09 22:43:05 +02:00
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, int par6, float par7, float par8, float par9) {
if (super.onBlockActivated(world, i, j, k, entityplayer, par6, par7, par8, par9)) {
return true;
}
2012-05-09 22:43:05 +02:00
// Drop through if the player is sneaking
2014-03-15 23:57:59 +01:00
if (entityplayer.isSneaking()) {
2012-05-09 22:43:05 +02:00
return false;
2014-03-15 23:57:59 +01:00
}
2012-06-04 22:48:18 +02:00
if (!world.isRemote) {
int meta = world.getBlockMetadata(i, j, k);
entityplayer.openGui(BuildCraftSilicon.instance, meta, world, i, j, k);
}
2012-05-09 22:43:05 +02:00
return true;
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
switch (metadata) {
case 0:
return new TileAssemblyTable();
case 1:
return new TileAdvancedCraftingTable();
case 2:
return new TileIntegrationTable();
2015-09-20 11:20:30 +02:00
case 3:
return new TileChargingTable();
2015-02-24 14:39:23 +01:00
case 4:
return new TileProgrammingTable();
case 5:
return new TileStampingTable();
}
return null;
}
2012-12-17 23:30:54 +01:00
2012-05-09 22:43:05 +02:00
@Override
2014-02-08 14:47:31 +01:00
public TileEntity createNewTileEntity(World world, int metadata) {
return null;
2012-05-09 22:43:05 +02:00
}
@Override
public int damageDropped(int par1) {
return par1;
}
@SuppressWarnings({"rawtypes", "unchecked"})
2012-05-09 22:43:05 +02:00
@Override
@SideOnly(Side.CLIENT)
2014-02-08 14:47:31 +01:00
public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List par3List) {
2015-09-20 11:20:30 +02:00
for (int i = 0; i < TABLE_MAX; i++) {
par3List.add(new ItemStack(this, 1, i));
}
2012-05-09 22:43:05 +02:00
}
@Override
@SideOnly(Side.CLIENT)
public String[] getIconBlockNames() {
2015-09-20 11:20:30 +02:00
return new String[]{
"BuildCraft|Silicon:assemblyTable",
"BuildCraft|Silicon:advancedCraftingTable",
"BuildCraft|Silicon:integrationTable",
"BuildCraft|Silicon:chargingTable",
"BuildCraft|Silicon:programmingTable",
"BuildCraft|Silicon:stampingTable"
};
}
2012-05-09 22:43:05 +02:00
}