mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-17 10:55:06 +00:00
87 lines
2.9 KiB
Java
87 lines
2.9 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.BlockTorch;
|
|
import net.minecraft.block.state.IBlockState;
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.init.Blocks;
|
|
import net.minecraft.init.Items;
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.util.BlockPos;
|
|
import net.minecraft.util.EnumFacing;
|
|
import net.minecraft.world.World;
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
import forestry.api.core.IModelManager;
|
|
import forestry.api.core.IItemModelRegister;
|
|
import forestry.api.core.Tabs;
|
|
import forestry.apiculture.tiles.TileCandle;
|
|
import forestry.core.config.Constants;
|
|
import forestry.core.utils.BlockUtil;
|
|
import forestry.core.utils.ItemStackUtil;
|
|
import forestry.plugins.PluginApiculture;
|
|
|
|
public class BlockStump extends BlockTorch implements IItemModelRegister {
|
|
|
|
public BlockStump() {
|
|
super();
|
|
this.setHardness(0.0F);
|
|
this.setStepSound(soundTypeWood);
|
|
setCreativeTab(Tabs.tabApiculture);
|
|
}
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
@Override
|
|
public void registerModel(Item item, IModelManager manager) {
|
|
manager.registerItemModel(item, 0, "stump");
|
|
}
|
|
|
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
|
@Override
|
|
public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
|
itemList.add(new ItemStack(this, 1, 0));
|
|
}
|
|
|
|
@Override
|
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
|
|
|
|
ItemStack held = player.getCurrentEquippedItem();
|
|
if (held != null &&
|
|
(held.getItem() == Items.flint_and_steel ||
|
|
held.getItem() == Items.flint ||
|
|
ItemStackUtil.equals(Blocks.torch, held))) {
|
|
world.setBlockState(pos, PluginApiculture.blocks.candle.getStateFromMeta(BlockUtil.getBlockMetadata(world, pos) | 0x08), Constants.FLAG_BLOCK_SYNCH);
|
|
TileCandle tc = new TileCandle();
|
|
tc.setColour(0); // default to white
|
|
world.setTileEntity(pos, tc);
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public int getRenderColor(IBlockState state) {
|
|
return 0xee0000;
|
|
}
|
|
|
|
@Override
|
|
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
|
|
}
|
|
}
|