mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-19 11:49:14 +00:00
78 lines
2.8 KiB
Java
78 lines
2.8 KiB
Java
/*******************************************************************************
|
|
* Copyright (c) 2011-2014 SirSengir.
|
|
* All rights reserved. This program and the accompanying materials
|
|
* are made available under the terms of the GNU Lesser Public License v3
|
|
* which accompanies this distribution, and is available at
|
|
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
|
*
|
|
* Various Contributors including, but not limited to:
|
|
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
|
******************************************************************************/
|
|
package forestry.apiculture.blocks;
|
|
|
|
import java.util.List;
|
|
import java.util.Random;
|
|
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.block.BlockTorch;
|
|
import net.minecraft.block.SoundType;
|
|
import net.minecraft.block.state.IBlockState;
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.util.EnumFacing;
|
|
import net.minecraft.util.EnumHand;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.world.World;
|
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
|
|
import forestry.api.core.IItemModelRegister;
|
|
import forestry.api.core.IModelManager;
|
|
import forestry.api.core.Tabs;
|
|
import forestry.apiculture.PluginApiculture;
|
|
import forestry.apiculture.tiles.TileCandle;
|
|
import forestry.core.config.Constants;
|
|
|
|
public class BlockStump extends BlockTorch implements IItemModelRegister {
|
|
|
|
public BlockStump() {
|
|
this.setHardness(0.0F);
|
|
this.setSoundType(SoundType.WOOD);
|
|
setCreativeTab(Tabs.tabApiculture);
|
|
}
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
@Override
|
|
public void registerModel(Item item, IModelManager manager) {
|
|
manager.registerItemModel(item, 0, "stump");
|
|
}
|
|
|
|
@Override
|
|
public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List<ItemStack> itemList) {
|
|
itemList.add(new ItemStack(this, 1, 0));
|
|
}
|
|
|
|
@Override
|
|
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
|
if (heldItem != null && BlockCandle.lightingItems.contains(heldItem.getItem())) {
|
|
IBlockState blockState = worldIn.getBlockState(pos);
|
|
Block block = blockState.getBlock();
|
|
IBlockState activatedState = PluginApiculture.blocks.candle.getStateFromMeta(block.getMetaFromState(blockState) | 0x08);
|
|
worldIn.setBlockState(pos, activatedState, Constants.FLAG_BLOCK_SYNC);
|
|
TileCandle tc = new TileCandle();
|
|
tc.setColour(0); // default to white
|
|
worldIn.setTileEntity(pos, tc);
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
|
}
|
|
}
|