2015-01-11 11:47:36 +00:00
|
|
|
package com.cricketcraft.chisel.block;
|
|
|
|
|
|
2015-01-11 13:21:47 +00:00
|
|
|
import java.util.Random;
|
|
|
|
|
|
2015-01-11 11:47:36 +00:00
|
|
|
import net.minecraft.block.BlockTorch;
|
|
|
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
2015-01-11 13:21:47 +00:00
|
|
|
import net.minecraft.world.World;
|
2015-01-11 11:47:36 +00:00
|
|
|
|
|
|
|
|
import com.cricketcraft.chisel.Chisel;
|
|
|
|
|
import com.cricketcraft.chisel.api.ICarvable;
|
|
|
|
|
import com.cricketcraft.chisel.carving.CarvableHelper;
|
|
|
|
|
import com.cricketcraft.chisel.carving.CarvableVariation;
|
2015-01-11 13:21:47 +00:00
|
|
|
import com.cricketcraft.chisel.init.ChiselTabs;
|
|
|
|
|
|
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2015-01-11 11:47:36 +00:00
|
|
|
|
|
|
|
|
public class BlockCarvableTorch extends BlockTorch implements ICarvable
|
|
|
|
|
{
|
2015-01-11 13:21:47 +00:00
|
|
|
public CarvableHelper carverHelper;
|
|
|
|
|
private String texLocation;
|
|
|
|
|
protected boolean emitsParticles = true;
|
2015-01-11 11:47:36 +00:00
|
|
|
|
2015-01-11 13:21:47 +00:00
|
|
|
public BlockCarvableTorch()
|
|
|
|
|
{
|
|
|
|
|
super();
|
|
|
|
|
carverHelper = new CarvableHelper();
|
|
|
|
|
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
|
|
|
|
setLightLevel(0.9375F);
|
|
|
|
|
setBlockName("torch");
|
|
|
|
|
}
|
2015-01-11 11:47:36 +00:00
|
|
|
@Override
|
|
|
|
|
public CarvableVariation getVariation(int metadata) {
|
|
|
|
|
return carverHelper.getVariation(metadata);
|
|
|
|
|
}
|
|
|
|
|
@Override
|
2015-01-11 13:21:47 +00:00
|
|
|
public void registerBlockIcons(IIconRegister icon){
|
|
|
|
|
this.blockIcon = icon.registerIcon(Chisel.MOD_ID + ":torch/"+ texLocation);
|
|
|
|
|
}
|
2015-01-11 11:47:36 +00:00
|
|
|
public void setInformation(String textureLocation){
|
2015-01-11 13:21:47 +00:00
|
|
|
this.texLocation = textureLocation;
|
|
|
|
|
}
|
|
|
|
|
public BlockCarvableTorch disableParticles()
|
|
|
|
|
{
|
|
|
|
|
this.emitsParticles = false;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
|
public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_)
|
|
|
|
|
{
|
|
|
|
|
if(emitsParticles)
|
|
|
|
|
{
|
|
|
|
|
int l = p_149734_1_.getBlockMetadata(p_149734_2_, p_149734_3_, p_149734_4_);
|
|
|
|
|
double d0 = (double)((float)p_149734_2_ + 0.5F);
|
|
|
|
|
double d1 = (double)((float)p_149734_3_ + 0.7F);
|
|
|
|
|
double d2 = (double)((float)p_149734_4_ + 0.5F);
|
|
|
|
|
double d3 = 0.2199999988079071D;
|
|
|
|
|
double d4 = 0.27000001072883606D;
|
|
|
|
|
|
|
|
|
|
if (l == 1)
|
|
|
|
|
{
|
|
|
|
|
p_149734_1_.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
|
|
|
|
p_149734_1_.spawnParticle("flame", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
|
|
|
|
}
|
|
|
|
|
else if (l == 2)
|
|
|
|
|
{
|
|
|
|
|
p_149734_1_.spawnParticle("smoke", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
|
|
|
|
p_149734_1_.spawnParticle("flame", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
|
|
|
|
}
|
|
|
|
|
else if (l == 3)
|
|
|
|
|
{
|
|
|
|
|
p_149734_1_.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
|
|
|
|
|
p_149734_1_.spawnParticle("flame", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
|
|
|
|
|
}
|
|
|
|
|
else if (l == 4)
|
|
|
|
|
{
|
|
|
|
|
p_149734_1_.spawnParticle("smoke", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
|
|
|
|
|
p_149734_1_.spawnParticle("flame", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
p_149734_1_.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
|
|
|
|
p_149734_1_.spawnParticle("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-01-11 11:47:36 +00:00
|
|
|
}
|