use of net.minecraft.item.ItemBlock in project ArsMagica2 by Mithion.
the class TileEntityCalefactor method smeltItem.
public void smeltItem() {
if (this.canSmelt()) {
ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.calefactorItemStacks[0]);
ItemStack smeltStack = var1.copy();
if (this.calefactorItemStacks[0].getItem() instanceof ItemFood || this.calefactorItemStacks[0].getItem() instanceof ItemBlock || this.calefactorItemStacks[0].getItem() == ItemsCommonProxy.itemOre) {
if (PowerNodeRegistry.For(worldObj).checkPower(this, PowerTypes.DARK, getCookTickPowerCost()))
if (PowerNodeRegistry.For(worldObj).checkPower(this, PowerTypes.NEUTRAL, getCookTickPowerCost()))
if (PowerNodeRegistry.For(worldObj).checkPower(this, PowerTypes.LIGHT, getCookTickPowerCost()))
smeltStack.stackSize++;
}
if (this.calefactorItemStacks[0].getItem() instanceof ItemFood) {
if (smeltStack.stackSize == var1.stackSize && worldObj.rand.nextDouble() < 0.15f) {
smeltStack.stackSize++;
}
}
boolean doSmelt = true;
if (doSmelt) {
if (this.calefactorItemStacks[1] == null) {
this.calefactorItemStacks[1] = smeltStack.copy();
} else if (this.calefactorItemStacks[1].isItemEqual(smeltStack)) {
calefactorItemStacks[1].stackSize += smeltStack.stackSize;
if (calefactorItemStacks[1].stackSize > calefactorItemStacks[1].getMaxStackSize()) {
calefactorItemStacks[1].stackSize = calefactorItemStacks[1].getMaxStackSize();
}
}
if (Math.random() <= 0.25) {
if (calefactorItemStacks[5] == null) {
calefactorItemStacks[5] = new ItemStack(ItemsCommonProxy.itemOre, 1, ItemsCommonProxy.itemOre.META_VINTEUMDUST);
} else {
calefactorItemStacks[5].stackSize++;
if (calefactorItemStacks[5].stackSize > calefactorItemStacks[5].getMaxStackSize()) {
calefactorItemStacks[5].stackSize = calefactorItemStacks[5].getMaxStackSize();
}
}
}
}
--this.calefactorItemStacks[0].stackSize;
if (this.calefactorItemStacks[0].stackSize <= 0) {
this.calefactorItemStacks[0] = null;
}
}
}
use of net.minecraft.item.ItemBlock in project ArsMagica2 by Mithion.
the class Forge method ApplyFurnaceToBlockAtCoords.
private boolean ApplyFurnaceToBlockAtCoords(EntityLivingBase entity, World world, int x, int y, int z) {
Block block = world.getBlock(x, y, z);
if (block == Blocks.air) {
return false;
}
if (block == Blocks.ice) {
if (!world.isRemote) {
world.setBlock(x, y, z, Blocks.water);
}
return true;
}
int meta = world.getBlockMetadata(x, y, z);
ItemStack smelted = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block, 1, meta));
if (smelted == null) {
return false;
}
if (!world.isRemote) {
if (ItemIsBlock(smelted.getItem())) {
world.setBlock(x, y, z, ((ItemBlock) smelted.getItem()).field_150939_a);
} else {
entity.entityDropItem(new ItemStack(smelted.getItem(), 1, smelted.getItemDamage()), 0);
world.setBlock(x, y, z, Blocks.air);
}
}
return true;
}
use of net.minecraft.item.ItemBlock in project minecolonies by Minecolonies.
the class AbstractBlockHut method initBlock.
/**
* Initiates the basic block variables.
*/
private void initBlock() {
setRegistryName(getName());
setUnlocalizedName(Constants.MOD_ID.toLowerCase() + "." + getName());
setCreativeTab(ModCreativeTabs.MINECOLONIES);
//Blast resistance for creepers etc. makes them explosion proof
setResistance(RESISTANCE);
//Hardness of 10 takes a long time to mine to not loose progress
setHardness(HARDNESS);
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
GameRegistry.register(this);
GameRegistry.register((new ItemBlock(this)).setRegistryName(this.getRegistryName()));
}
use of net.minecraft.item.ItemBlock in project minecolonies by Minecolonies.
the class BlockConstructionTape method initBlock.
/**
* initialize the block
* sets the creative tab, as well as the resistance and the hardness.
*/
private void initBlock() {
setRegistryName(BLOCK_NAME);
setUnlocalizedName(String.format("%s.%s", Constants.MOD_ID.toLowerCase(), BLOCK_NAME));
setCreativeTab(ModCreativeTabs.MINECOLONIES);
GameRegistry.register(this);
GameRegistry.register((new ItemBlock(this)).setRegistryName(this.getRegistryName()));
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
setHardness(BLOCK_HARDNESS);
setResistance(RESISTANCE);
setLightOpacity(LIGHT_OPACITY);
}
use of net.minecraft.item.ItemBlock in project minecolonies by Minecolonies.
the class BlockConstructionTapeCorner method initBlock.
/**
* initialize the block
* sets the creative tab, as well as the resistance and the hardness.
*/
private void initBlock() {
setRegistryName(BLOCK_NAME);
setUnlocalizedName(String.format("%s.%s", Constants.MOD_ID.toLowerCase(), BLOCK_NAME));
setCreativeTab(ModCreativeTabs.MINECOLONIES);
GameRegistry.register(this);
GameRegistry.register((new ItemBlock(this)).setRegistryName(this.getRegistryName()));
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
setHardness(BLOCK_HARDNESS);
setResistance(RESISTANCE);
setLightOpacity(LIGHT_OPACITY);
}
Aggregations