Readded hive blocks

This commit is contained in:
Adubbz 2014-12-13 09:31:54 +11:00
parent eed5bf7627
commit c8ea198f67
5 changed files with 96 additions and 8 deletions

View file

@ -18,6 +18,7 @@ public class BOPBlocks
public static Block flower2;
public static Block gem;
public static Block gem_ore;
public static Block hive;
public static Block log;
public static Block log2;
public static Block log3;

View file

@ -0,0 +1,85 @@
/*******************************************************************************
* 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.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.IStringSerializable;
import biomesoplenty.api.block.BOPBlock;
//TODO: Add wasp spawn on honeycomb breaking, add correct drops
public class BlockHive extends BOPBlock
{
public static final PropertyEnum VARIANT_PROP = PropertyEnum.create("variant", HiveType.class);
public BlockHive()
{
super(Material.wood);
this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, HiveType.HIVE));
this.setHardness(0.5F);
this.setStepSound(Block.soundTypeGrass);
}
@Override
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(VARIANT_PROP, HiveType.values()[meta]);
}
@Override
public int getMetaFromState(IBlockState state)
{
int meta = ((HiveType)state.getValue(VARIANT_PROP)).ordinal();
return meta;
}
@Override
protected BlockState createBlockState()
{
return new BlockState(this, new IProperty[] { VARIANT_PROP });
}
@Override
public IProperty[] getPresetProperties()
{
return new IProperty[] { VARIANT_PROP };
}
@Override
public String getStateName(IBlockState state, boolean fullName)
{
return ((HiveType)state.getValue(VARIANT_PROP)).getName() + (fullName ? "_block" : "");
}
public static enum HiveType implements IStringSerializable
{
HIVE,
HONEYCOMB,
EMPTY_HONEYCOMB,
FILLED_HONEYCOMB;
public String getName()
{
return this.name().toLowerCase();
}
@Override
public String toString()
{
return getName();
}
}
}

View file

@ -31,6 +31,7 @@ import biomesoplenty.common.block.BlockBOPStone;
import biomesoplenty.common.block.BlockBamboo;
import biomesoplenty.common.block.BlockGem;
import biomesoplenty.common.block.BlockGemOre;
import biomesoplenty.common.block.BlockHive;
import biomesoplenty.common.item.ItemBlockWithVariants;
import biomesoplenty.common.util.block.BlockStateUtils;
import biomesoplenty.core.BiomesOPlenty;
@ -45,6 +46,7 @@ public class ModBlocks
flower2 = registerBlock(new BlockBOPFlower2(), "flower2");
gem = registerBlock(new BlockGem(), "gem");
gem_ore = registerBlock(new BlockGemOre(), "gem_ore");
hive = registerBlock(new BlockHive(), "hive");
log = registerBlock(new BlockBOPLog(), "log");
log2 = registerBlock(new BlockBOPLog2(), "log2");
log3 = registerBlock(new BlockBOPLog3(), "log3");

View file

@ -1,8 +1,8 @@
{
"variants": {
"variant=hive_block": { "model": "biomesoplenty:hive_block" },
"variant=honeycomb_block": { "model": "biomesoplenty:honeycomb_block" },
"variant=empty_honeycomb_block": { "model": "biomesoplenty:empty_honeycomb_block" },
"variant=filled_honeycomb_block": { "model": "biomesoplenty:filled_honeycomb_block" }
"variant=hive": { "model": "biomesoplenty:hive_block" },
"variant=honeycomb": { "model": "biomesoplenty:honeycomb_block" },
"variant=empty_honeycomb": { "model": "biomesoplenty:empty_honeycomb_block" },
"variant=filled_honeycomb": { "model": "biomesoplenty:filled_honeycomb_block" }
}
}

View file

@ -61,10 +61,10 @@ tile.gem_ore.malachite.name=Malachite Ore
tile.gem_ore.sapphire.name=Sapphire Ore
tile.gem_ore.amber.name=Amber Ore
tile.hive.hive_block.name=Hive Block
tile.hive.honeycomb_block.name=Honeycomb Block
tile.hive.empty_honeycomb_block.name=Empty Honeycomb Block
tile.hive.filled_honeycomb_block.name=Filled Honeycomb Block
tile.hive.hive.name=Hive Block
tile.hive.honeycomb.name=Honeycomb Block
tile.hive.empty_honeycomb.name=Empty Honeycomb Block
tile.hive.filled_honeycomb.name=Filled Honeycomb Block
tile.log.sacred_oak.name=Sacred Oak Wood
tile.log.cherry.name=Cherry Wood