2013-12-27 23:59:59 +01:00
|
|
|
package appeng.block.solids;
|
|
|
|
|
|
|
|
import java.util.EnumSet;
|
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
import net.minecraft.block.material.Material;
|
2014-02-09 02:34:52 +01:00
|
|
|
import net.minecraft.item.Item;
|
2013-12-27 23:59:59 +01:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.MathHelper;
|
|
|
|
import net.minecraft.world.IBlockAccess;
|
|
|
|
import net.minecraft.world.World;
|
2014-01-30 03:47:55 +01:00
|
|
|
import net.minecraftforge.oredict.OreDictionary;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.api.AEApi;
|
|
|
|
import appeng.block.AEBaseBlock;
|
|
|
|
import appeng.client.render.BaseBlockRender;
|
|
|
|
import appeng.client.render.blocks.RenderQuartzOre;
|
|
|
|
import appeng.core.features.AEFeature;
|
|
|
|
|
2014-05-11 18:22:10 +02:00
|
|
|
public class OreQuartz extends AEBaseBlock
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
public int boostBrightnessLow;
|
|
|
|
public int boostBrightnessHigh;
|
|
|
|
public boolean enhanceBrightness;
|
|
|
|
|
|
|
|
public OreQuartz(Class self) {
|
|
|
|
super( self, Material.rock );
|
|
|
|
setfeature( EnumSet.of( AEFeature.Core ) );
|
|
|
|
setHardness( 3.0F );
|
|
|
|
setResistance( 5.0F );
|
|
|
|
boostBrightnessLow = 0;
|
|
|
|
boostBrightnessHigh = 1;
|
|
|
|
enhanceBrightness = false;
|
|
|
|
}
|
|
|
|
|
2014-01-30 03:47:55 +01:00
|
|
|
@Override
|
|
|
|
public void postInit()
|
|
|
|
{
|
|
|
|
OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( this ) );
|
|
|
|
}
|
|
|
|
|
2013-12-27 23:59:59 +01:00
|
|
|
@Override
|
|
|
|
protected Class<? extends BaseBlockRender> getRenderer()
|
|
|
|
{
|
|
|
|
return RenderQuartzOre.class;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getMixedBrightnessForBlock(IBlockAccess par1iBlockAccess, int par2, int par3, int par4)
|
|
|
|
{
|
|
|
|
int j1 = super.getMixedBrightnessForBlock( par1iBlockAccess, par2, par3, par4 );
|
|
|
|
if ( enhanceBrightness )
|
|
|
|
{
|
|
|
|
j1 = Math.max( j1 >> 20, j1 >> 4 );
|
|
|
|
|
|
|
|
if ( j1 > 4 )
|
|
|
|
j1 += boostBrightnessHigh;
|
|
|
|
else
|
|
|
|
j1 += boostBrightnessLow;
|
|
|
|
|
|
|
|
if ( j1 > 15 )
|
|
|
|
j1 = 15;
|
|
|
|
return j1 << 20 | j1 << 4;
|
|
|
|
}
|
|
|
|
return j1;
|
|
|
|
}
|
|
|
|
|
|
|
|
public OreQuartz() {
|
|
|
|
this( OreQuartz.class );
|
|
|
|
}
|
|
|
|
|
|
|
|
ItemStack getItemDropped()
|
|
|
|
{
|
|
|
|
return AEApi.instance().materials().materialCertusQuartzCrystal.stack( 1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-02-09 02:34:52 +01:00
|
|
|
public Item getItemDropped(int id, Random rand, int meta)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-02-09 02:34:52 +01:00
|
|
|
return getItemDropped().getItem();
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int damageDropped(int id)
|
|
|
|
{
|
|
|
|
return getItemDropped().getItemDamage();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int quantityDropped(Random rand)
|
|
|
|
{
|
|
|
|
return 1 + rand.nextInt( 2 );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int quantityDroppedWithBonus(int fortune, Random rand)
|
|
|
|
{
|
2014-02-09 02:34:52 +01:00
|
|
|
if ( fortune > 0 && Item.getItemFromBlock( this ) != getItemDropped( 0, rand, fortune ) )
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
|
|
|
int j = rand.nextInt( fortune + 2 ) - 1;
|
|
|
|
|
|
|
|
if ( j < 0 )
|
|
|
|
{
|
|
|
|
j = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.quantityDropped( rand ) * (j + 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return this.quantityDropped( rand );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void dropBlockAsItemWithChance(World w, int x, int y, int z, int blockid, float something, int meta)
|
|
|
|
{
|
|
|
|
super.dropBlockAsItemWithChance( w, x, y, z, blockid, something, meta );
|
|
|
|
|
2014-02-09 02:34:52 +01:00
|
|
|
if ( getItemDropped( blockid, w.rand, meta ) != Item.getItemFromBlock( this ) )
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
|
|
|
int xp = MathHelper.getRandomIntegerInRange( w.rand, 2, 5 );
|
|
|
|
|
|
|
|
this.dropXpOnBlockBreak( w, x, y, z, xp );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|