Make sacred oad sapling items shiny

This commit is contained in:
Cheeserolls 2015-05-04 10:05:42 +01:00
parent faa60f0e37
commit fc3c423523
2 changed files with 47 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import java.util.Random;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.api.block.BOPTreeEnums;
import biomesoplenty.api.block.BOPTreeEnums.AllTrees;
import biomesoplenty.common.item.ItemBOPSapling;
import net.minecraft.block.Block;
import net.minecraft.block.IGrowable;
import net.minecraft.block.properties.IProperty;
@ -23,6 +24,7 @@ import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
@ -98,6 +100,8 @@ public abstract class BlockBOPSapling extends BlockDecoration implements IGrowab
// implement IBOPBlock
@Override
public Class<? extends ItemBlock> getItemClass() { return ItemBOPSapling.class; }
@Override
public IProperty[] getPresetProperties() { return new IProperty[] {getMyVariantProperty()}; }
@Override
public IProperty[] getNonRenderingProperties() { return new IProperty[] {STAGE}; }

View File

@ -0,0 +1,43 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.item;
import biomesoplenty.api.block.BOPTreeEnums.AllTrees;
import biomesoplenty.common.block.BlockBOPSapling;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
public class ItemBOPSapling extends ItemBOPBlock
{
public BlockBOPSapling saplingBlock;
public ItemBOPSapling(Block block) {
super(block);
if (!(block instanceof BlockBOPSapling))
{
throw new IllegalArgumentException("ItemBOPSapling must be created with a BlockBOPSapling block");
}
this.saplingBlock = (BlockBOPSapling)block;
}
@Override
public boolean hasEffect(ItemStack stack)
{
AllTrees tree = this.saplingBlock.variantFromMeta(stack.getMetadata());
switch (tree)
{
case SACRED_OAK:
return true;
default:
return super.hasEffect(stack);
}
}
}