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

113 lines
3.2 KiB
Java
Raw Normal View History

package com.pahimar.ee3.block;
2023-01-03 17:47:36 +01:00
import java.util.Random;
import com.pahimar.ee3.EquivalentExchange3;
2014-09-19 21:55:28 +02:00
import com.pahimar.ee3.reference.GUIs;
import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.Particles;
import com.pahimar.ee3.reference.RenderIds;
2014-04-30 03:46:59 +02:00
import com.pahimar.ee3.tileentity.TileEntityCalcinator;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
2023-01-03 17:47:36 +01:00
public class BlockCalcinator extends BlockTileEntityEE {
public BlockCalcinator() {
super(Material.rock);
this.setHardness(2.0f);
this.setBlockName(Names.Blocks.CALCINATOR);
this.setBlockBounds(0.1F, 0.0F, 0.1F, 0.9F, 1.0F, 0.9F);
}
@Override
2023-01-03 17:47:36 +01:00
public TileEntity createNewTileEntity(World world, int metaData) {
2014-04-30 03:46:59 +02:00
return new TileEntityCalcinator();
}
@Override
2023-01-03 17:47:36 +01:00
public boolean renderAsNormalBlock() {
return false;
}
@Override
2023-01-03 17:47:36 +01:00
public int getRenderType() {
return RenderIds.calcinator;
}
@Override
2023-01-03 17:47:36 +01:00
public boolean isOpaqueCube() {
2014-07-04 22:11:39 +02:00
return false;
}
@Override
2023-01-03 17:47:36 +01:00
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
if (world.getTileEntity(x, y, z) instanceof TileEntityCalcinator) {
if (((TileEntityCalcinator) world.getTileEntity(x, y, z)).getState() == 1) {
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
);
2014-07-04 22:11:39 +02:00
}
}
}
@Override
2023-01-03 17:47:36 +01:00
public boolean onBlockActivated(
World world,
int x,
int y,
int z,
EntityPlayer player,
int par6,
float par7,
float par8,
float par9
) {
if (player.isSneaking()) {
return false;
2023-01-03 17:47:36 +01:00
} else {
if (!world.isRemote) {
if (world.getTileEntity(x, y, z) instanceof TileEntityCalcinator) {
player.openGui(
EquivalentExchange3.instance,
GUIs.CALCINATOR.ordinal(),
world,
x,
y,
z
);
}
}
return true;
}
}
2014-07-04 22:11:39 +02:00
@Override
2023-01-03 17:47:36 +01:00
public int getLightValue(IBlockAccess world, int x, int y, int z) {
if ((world.getTileEntity(x, y, z) instanceof TileEntityCalcinator)
&& (((TileEntityCalcinator) world.getTileEntity(x, y, z)).getState() == 1)) {
2014-07-04 22:11:39 +02:00
return 15;
}
2014-07-04 22:11:39 +02:00
return super.getLightValue(world, x, y, z);
}
}