2013-08-23 16:59:50 +02:00
|
|
|
package com.pahimar.ee3.block;
|
|
|
|
|
2013-12-16 02:26:42 +01:00
|
|
|
import com.pahimar.ee3.EquivalentExchange3;
|
|
|
|
import com.pahimar.ee3.lib.GuiIds;
|
2013-12-30 04:44:06 +01:00
|
|
|
import com.pahimar.ee3.lib.Particles;
|
2013-12-16 02:26:42 +01:00
|
|
|
import com.pahimar.ee3.lib.RenderIds;
|
|
|
|
import com.pahimar.ee3.lib.Strings;
|
|
|
|
import com.pahimar.ee3.tileentity.TileCalcinator;
|
2014-01-02 08:21:46 +01:00
|
|
|
import net.minecraft.block.ITileEntityProvider;
|
2013-08-23 16:59:50 +02:00
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2014-01-02 08:21:46 +01:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
2013-08-23 16:59:50 +02:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
2013-12-16 02:26:42 +01:00
|
|
|
import java.util.Random;
|
2013-08-23 16:59:50 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Equivalent-Exchange-3
|
2013-12-16 02:26:42 +01:00
|
|
|
* <p/>
|
2013-08-23 16:59:50 +02:00
|
|
|
* BlockCalcinator
|
2013-12-16 02:26:42 +01:00
|
|
|
*
|
2013-08-23 16:59:50 +02:00
|
|
|
* @author pahimar
|
|
|
|
*/
|
2014-01-02 08:21:46 +01:00
|
|
|
public class BlockCalcinator extends BlockEE implements ITileEntityProvider
|
2013-12-16 02:26:42 +01:00
|
|
|
{
|
|
|
|
public BlockCalcinator(int id)
|
|
|
|
{
|
2013-08-23 16:59:50 +02:00
|
|
|
super(id, Material.rock);
|
|
|
|
this.setUnlocalizedName(Strings.CALCINATOR_NAME);
|
2014-01-04 18:53:23 +01:00
|
|
|
this.setCreativeTab(EquivalentExchange3.tabsEE3);
|
2013-12-31 03:41:10 +01:00
|
|
|
this.setHardness(2.0F);
|
2013-08-23 16:59:50 +02:00
|
|
|
this.setBlockBounds(0.1F, 0.0F, 0.1F, 0.9F, 1.0F, 0.9F);
|
|
|
|
}
|
2013-09-07 04:47:12 +02:00
|
|
|
|
2013-08-23 16:59:50 +02:00
|
|
|
@Override
|
2013-12-16 02:26:42 +01:00
|
|
|
public TileEntity createNewTileEntity(World world)
|
|
|
|
{
|
2013-08-23 16:59:50 +02:00
|
|
|
return new TileCalcinator();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-12-16 02:26:42 +01:00
|
|
|
public boolean renderAsNormalBlock()
|
|
|
|
{
|
2013-08-23 16:59:50 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-12-16 02:26:42 +01:00
|
|
|
public boolean isOpaqueCube()
|
|
|
|
{
|
2013-08-23 16:59:50 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-01-02 08:21:46 +01:00
|
|
|
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
2013-12-16 02:26:42 +01:00
|
|
|
{
|
2014-01-12 16:51:26 +01:00
|
|
|
if (world.getBlockTileEntity(x, y, z) instanceof TileCalcinator)
|
|
|
|
{
|
|
|
|
if (((TileCalcinator) world.getBlockTileEntity(x, y, z)).getState() == 1)
|
|
|
|
{
|
|
|
|
return 15;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-02 08:21:46 +01:00
|
|
|
return super.getLightValue(world, x, y, z);
|
2013-08-23 16:59:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-01-02 08:21:46 +01:00
|
|
|
public int getRenderType()
|
2013-12-16 02:26:42 +01:00
|
|
|
{
|
2014-01-02 08:21:46 +01:00
|
|
|
|
|
|
|
return RenderIds.calcinatorRender;
|
2013-08-23 16:59:50 +02:00
|
|
|
}
|
|
|
|
|
2014-01-11 05:54:39 +01:00
|
|
|
@Override
|
|
|
|
public boolean onBlockEventReceived(World par1World, int par2, int par3, int par4, int par5, int par6)
|
|
|
|
{
|
|
|
|
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
|
|
|
TileEntity tileentity = par1World.getBlockTileEntity(par2, par3, par4);
|
|
|
|
return tileentity != null ? tileentity.receiveClientEvent(par5, par6) : false;
|
|
|
|
}
|
|
|
|
|
2013-08-23 16:59:50 +02:00
|
|
|
@Override
|
2013-12-16 02:26:42 +01:00
|
|
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
|
|
|
{
|
2013-08-23 16:59:50 +02:00
|
|
|
if (player.isSneaking())
|
2013-12-16 02:26:42 +01:00
|
|
|
{
|
2013-08-23 16:59:50 +02:00
|
|
|
return false;
|
2013-12-16 02:26:42 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!world.isRemote)
|
|
|
|
{
|
2014-01-02 08:21:46 +01:00
|
|
|
if (world.getBlockTileEntity(x, y, z) instanceof TileCalcinator)
|
2013-12-16 02:26:42 +01:00
|
|
|
{
|
2013-08-23 16:59:50 +02:00
|
|
|
player.openGui(EquivalentExchange3.instance, GuiIds.CALCINATOR, world, x, y, z);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-30 04:04:57 +01:00
|
|
|
@Override
|
|
|
|
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
|
|
|
{
|
2013-12-30 04:44:06 +01:00
|
|
|
if (world.getBlockTileEntity(x, y, z) instanceof TileCalcinator)
|
|
|
|
{
|
2014-01-11 05:54:39 +01:00
|
|
|
if (((TileCalcinator) world.getBlockTileEntity(x, y, z)).getState() == 1)
|
2013-12-30 04:44:06 +01:00
|
|
|
{
|
|
|
|
// Fire pot particles
|
|
|
|
world.spawnParticle(Particles.NORMAL_SMOKE, (double) x + 0.5F, (double) y + 0.4F, (double) ((z + 0.5F) + (random.nextFloat() * 0.5F - 0.3F)), 0.0D, 0.0D, 0.0D);
|
|
|
|
world.spawnParticle(Particles.FLAME, (double) x + 0.5F, (double) y + 0.4F, (double) z + 0.5F, 0.0D, 0.0D, 0.0D);
|
|
|
|
}
|
|
|
|
}
|
2013-12-30 04:04:57 +01:00
|
|
|
}
|
2013-08-23 16:59:50 +02:00
|
|
|
}
|