Added bone segment blocks
This commit is contained in:
parent
bf5424becc
commit
6b886e1ef2
9 changed files with 207 additions and 1 deletions
|
@ -24,6 +24,7 @@ public class BOPBlocks
|
|||
public static Block mushroom;
|
||||
public static Block stone;
|
||||
public static Block biome_block;
|
||||
public static Block bone_segment;
|
||||
|
||||
public static Block flower_0;
|
||||
public static Block flower_1;
|
||||
|
|
|
@ -0,0 +1,141 @@
|
|||
/*******************************************************************************
|
||||
* Copyright 2014-2017, 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 biomesoplenty.common.item.ItemBOPBlock;
|
||||
import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockBOPBoneSegment extends BlockRotatedPillar implements IBOPBlock
|
||||
{
|
||||
public static enum BoneType implements IStringSerializable
|
||||
{
|
||||
SMALL, MEDIUM;
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return this.name().toLowerCase();
|
||||
}
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.getName();
|
||||
}
|
||||
};
|
||||
public static final PropertyEnum<BoneType> VARIANT = PropertyEnum.create("variant", BoneType.class);
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {return new BlockStateContainer(this, new IProperty[] { VARIANT, AXIS });}
|
||||
|
||||
// implement IBOPBlock
|
||||
@Override
|
||||
public Class<? extends ItemBlock> getItemClass() { return ItemBOPBlock.class; }
|
||||
@Override
|
||||
public IProperty[] getPresetProperties() { return new IProperty[] {VARIANT}; }
|
||||
@Override
|
||||
public IProperty[] getNonRenderingProperties() { return null; }
|
||||
@Override
|
||||
public String getStateName(IBlockState state)
|
||||
{
|
||||
return ((BoneType) state.getValue(VARIANT)).getName() + "_bone_segment";
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IBlockColor getBlockColor() { return null; }
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IItemColor getItemColor() { return null; }
|
||||
|
||||
public BlockBOPBoneSegment()
|
||||
{
|
||||
super(Material.ROCK);
|
||||
|
||||
// set some defaults
|
||||
this.setHardness(5.0F);
|
||||
this.setResistance(10.0F);
|
||||
this.setSoundType(SoundType.STONE);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
this.setDefaultState( this.blockState.getBaseState().withProperty(VARIANT, BoneType.SMALL));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
double x1, y1 = 0.0D, z1, x2, y2 = 1.0D, z2;
|
||||
|
||||
switch (state.getValue(VARIANT))
|
||||
{
|
||||
case SMALL:
|
||||
x1 = z1 = 0.25D;
|
||||
x2 = z2 = 0.75D;
|
||||
break;
|
||||
case MEDIUM: default:
|
||||
x1 = z1 = 0.125D;
|
||||
x2 = z2 = 0.875D;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (state.getValue(AXIS))
|
||||
{
|
||||
case Y:
|
||||
return new AxisAlignedBB(x1, y1, z1, x2, y2, z2);
|
||||
|
||||
case Z:
|
||||
return new AxisAlignedBB(x1, z1, y1, x2, z2, y2);
|
||||
|
||||
default:
|
||||
return new AxisAlignedBB(y1, x1, z1, y2, x2, z2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
return getBoundingBox(state, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// map from state to meta and vice verca
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
return super.getStateFromMeta(meta).withProperty(VARIANT, BoneType.values()[meta & 3]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
return super.getMetaFromState(state) | state.getValue(VARIANT).ordinal();
|
||||
}
|
||||
|
||||
// our blocks usually drop their current state as opposed to a single 'default' state
|
||||
@Override
|
||||
public int damageDropped(IBlockState state)
|
||||
{
|
||||
return this.getMetaFromState(state.withProperty(AXIS, EnumFacing.Axis.X));
|
||||
}
|
||||
}
|
|
@ -84,6 +84,7 @@ public class ModBlocks
|
|||
hive = registerBlock( new BlockBOPHive(), "hive" );
|
||||
honey_block = registerBlock( new BlockBOPHoney(), "honey_block" );
|
||||
jelled_poison = registerBlock( new BlockBOPJelledPoison(), "jelled_poison" );
|
||||
bone_segment = registerBlock( new BlockBOPBoneSegment(), "bone_segment" );
|
||||
|
||||
//Material Blocks
|
||||
bamboo_thatching = registerBlock( (new BlockBOPGeneric(Material.WOOD, SoundType.WOOD)).setHardness(2.0F), "bamboo_thatching"); bamboo_thatching.setHarvestLevel("axe", 0);
|
||||
|
@ -370,7 +371,7 @@ public class ModBlocks
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException("An error occurred associating an item block during registration...");
|
||||
throw new RuntimeException("An error occurred associating an item block during registration...", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"variants": {
|
||||
"axis=y,variant=small": { "model": "biomesoplenty:small_bone_segment" },
|
||||
"axis=z,variant=small": { "model": "biomesoplenty:small_bone_segment", "x": 90 },
|
||||
"axis=x,variant=small": { "model": "biomesoplenty:small_bone_segment", "x": 90, "y": 90 },
|
||||
"axis=none,variant=small": { "model": "biomesoplenty:small_bone_segment" },
|
||||
"axis=y,variant=medium": { "model": "biomesoplenty:medium_bone_segment" },
|
||||
"axis=z,variant=medium": { "model": "biomesoplenty:medium_bone_segment", "x": 90 },
|
||||
"axis=x,variant=medium": { "model": "biomesoplenty:medium_bone_segment", "x": 90, "y": 90 },
|
||||
"axis=none,variant=medium": { "model": "biomesoplenty:medium_bone_segment" }
|
||||
}
|
||||
}
|
||||
|
|
@ -177,6 +177,8 @@ tile.ash_block.name=Ash Block
|
|||
tile.bamboo.name=Bamboo
|
||||
tile.bamboo_thatching.name=Bamboo Thatching
|
||||
tile.biome_block.name=Biome Essence Ore
|
||||
tile.bone_segment.small_bone_segment.name=Small Bone Segment
|
||||
tile.bone_segment.medium_bone_segment.name=Medium Bone Segment
|
||||
tile.cherry_fence.name=Cherry Fence
|
||||
tile.cherry_fence_gate.name=Cherry Fence Gate
|
||||
tile.cherry_wood_slab.name=Cherry Wood Slab
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"end": "blocks/bone_block_top",
|
||||
"side": "blocks/bone_block_side",
|
||||
"particle": "blocks/bone_block_side"
|
||||
},
|
||||
"elements": [
|
||||
{ "from": [ 2, 0, 2 ],
|
||||
"to": [ 14, 16, 14 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 4, 4, 12, 12 ], "texture": "#end", "cullface": "down" },
|
||||
"up": { "uv": [ 4, 4, 12, 12 ], "texture": "#end" },
|
||||
"north": { "uv": [ 2, 2, 14, 14 ], "texture": "#side", "cullface": "north" },
|
||||
"south": { "uv": [ 2, 2, 14, 14 ], "texture": "#side", "cullface": "south" },
|
||||
"west": { "uv": [ 2, 2, 14, 14 ], "texture": "#side", "cullface": "west" },
|
||||
"east": { "uv": [ 2, 2, 14, 14 ], "texture": "#side", "cullface": "east" }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"end": "blocks/bone_block_top",
|
||||
"side": "blocks/bone_block_side",
|
||||
"particle": "blocks/bone_block_side"
|
||||
},
|
||||
"elements": [
|
||||
{ "from": [ 4, 0, 4 ],
|
||||
"to": [ 12, 16, 12 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 6, 6, 10, 10 ], "texture": "#end", "cullface": "down" },
|
||||
"up": { "uv": [ 6, 6, 10, 10 ], "texture": "#end" },
|
||||
"north": { "uv": [ 4, 4, 12, 12 ], "texture": "#side", "cullface": "north" },
|
||||
"south": { "uv": [ 4, 4, 12, 12 ], "texture": "#side", "cullface": "south" },
|
||||
"west": { "uv": [ 4, 4, 12, 12 ], "texture": "#side", "cullface": "west" },
|
||||
"east": { "uv": [ 4, 4, 12, 12 ], "texture": "#side", "cullface": "east" }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"parent": "biomesoplenty:block/medium_bone_segment"
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"parent": "biomesoplenty:block/small_bone_segment"
|
||||
}
|
Loading…
Reference in a new issue