Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package wintercraft.blocks;
- import static net.minecraftforge.common.util.ForgeDirection.DOWN;
- import java.util.List;
- import java.util.Random;
- import net.minecraft.block.Block;
- import net.minecraft.block.BlockContainer;
- import net.minecraft.block.material.Material;
- import net.minecraft.client.renderer.texture.IIconRegister;
- import net.minecraft.creativetab.CreativeTabs;
- import net.minecraft.entity.EntityLiving;
- import net.minecraft.init.Blocks;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.util.IIcon;
- import net.minecraft.util.MathHelper;
- import net.minecraft.world.World;
- import net.minecraftforge.common.util.ForgeDirection;
- import wintercraft.Wintercraft;
- import wintercraft.render.tileEntity.TileEntityOrnament;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- public class BlockOrnament extends BlockContainer {
- public BlockOrnament(int texture, Material material) {
- super(material);
- this.setCreativeTab(Wintercraft.WintercraftTab);
- this.setBlockBounds(0.4F, 0.5F, 0.3F, 0.7F, 1F, 0.65F);
- }
- public Item getItemDropped(int par1, Random par2Random, int par3)
- {
- return Item.getItemFromBlock(WinterBlocks.ornament);
- }
- /**
- * checks to see if you can place this block can be placed on that side of a block: BlockLever overrides
- */
- public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
- {
- ForgeDirection dir = ForgeDirection.getOrientation(par5);
- return dir == DOWN && !par1World.isSideSolid(par2, par3 + 1, par4, DOWN);
- }
- @SideOnly(Side.CLIENT)
- private IIcon[] icons;
- @SideOnly(Side.CLIENT)
- public void registerBlockIcons(IIconRegister par1IconRegister)
- {
- this.icons = new IIcon[3];
- for(int i = 0; i < icons.length; i++)
- {
- this.icons[i] = par1IconRegister.registerIcon(Wintercraft.modid + ":" + (this.getUnlocalizedName().substring(5)) + i);
- }
- }
- @SideOnly(Side.CLIENT)
- public IIcon getIcon(int par1, int par2)
- {
- return icons[par2];
- }
- @SideOnly(Side.CLIENT)
- public void getSubBlocks(Block par1, CreativeTabs par2CreativeTabs, List par3List)
- {
- for (int var4 = 0; var4 < 3; ++var4)
- {
- par3List.add(new ItemStack(par1, 1, var4));
- }
- }
- protected boolean canThisPlantGrowOnThisBlock(Block par1)
- {
- return par1 == Blocks.leaves;
- }
- /**
- * The type of render function that is called for this block
- */
- public int getRenderType()
- {
- return -2;
- }
- /**
- * Is this block (a) opaque and (B) a full 1m cube? This determines whether or not to render the shared face of two
- * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
- */
- public boolean isOpaqueCube()
- {
- return false;
- }
- /**
- * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
- */
- public boolean renderAsNormalBlock()
- {
- return false;
- }
- public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving)
- {
- int rotation = MathHelper.floor_double((double)((entityliving.rotationYaw * 4F) / 360F) + 2.5D) & 3;
- world.setBlock(i, j, k, this, rotation - 1, rotation - 1);
- }
- public TileEntity createNewTileEntity(World par1World, int i)
- {
- return new TileEntityOrnament();
- }
- public int damageDropped(int par1)
- {
- return par1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement