equivalent-exchange-3/src/main/java/com/pahimar/ee3/block/BlockCalcinator.java

106 lines
2.9 KiB
Java
Raw Normal View History

2013-08-23 16:59:50 +02:00
package com.pahimar.ee3.block;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.lib.GuiIds;
import com.pahimar.ee3.lib.Particles;
import com.pahimar.ee3.lib.RenderIds;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.tileentity.TileCalcinator;
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;
import net.minecraft.world.IBlockAccess;
2013-08-23 16:59:50 +02:00
import net.minecraft.world.World;
import java.util.Random;
2013-08-23 16:59:50 +02:00
/**
* Equivalent-Exchange-3
* <p/>
2013-08-23 16:59:50 +02:00
* BlockCalcinator
*
2013-08-23 16:59:50 +02:00
* @author pahimar
*/
public class BlockCalcinator extends BlockEE implements ITileEntityProvider
{
public BlockCalcinator(int id)
{
2013-08-23 16:59:50 +02:00
super(id, Material.rock);
this.setUnlocalizedName(Strings.CALCINATOR_NAME);
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
public TileEntity createNewTileEntity(World world)
{
2013-08-23 16:59:50 +02:00
return new TileCalcinator();
}
@Override
public boolean renderAsNormalBlock()
{
2013-08-23 16:59:50 +02:00
return false;
}
@Override
public boolean isOpaqueCube()
{
2013-08-23 16:59:50 +02:00
return false;
}
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z)
{
// TODO Vary light levels depending on whether or not we are calcinating something
return super.getLightValue(world, x, y, z);
2013-08-23 16:59:50 +02:00
}
@Override
public int getRenderType()
{
return RenderIds.calcinatorRender;
2013-08-23 16:59:50 +02:00
}
@Override
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-08-23 16:59:50 +02:00
return false;
}
else
{
if (!world.isRemote)
{
if (world.getBlockTileEntity(x, y, z) instanceof TileCalcinator)
{
2013-08-23 16:59:50 +02:00
player.openGui(EquivalentExchange3.instance, GuiIds.CALCINATOR, world, x, y, z);
}
}
return true;
}
}
@Override
public void randomDisplayTick(World world, int x, int y, int z, Random random)
{
if (world.getBlockTileEntity(x, y, z) instanceof TileCalcinator)
{
if (((TileCalcinator) world.getBlockTileEntity(x, y, z)).isBurning())
{
// Fire pot particles
// TODO TileEntity.onClientEvent to update 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);
// Bowl particle effects
// TODO Decide if the bowl should have particle effects
}
}
}
2013-08-23 16:59:50 +02:00
}