Re-added bramble block

This commit is contained in:
Forstride 2019-01-12 18:38:58 -05:00
parent 088195c315
commit 8d36d9f5d1
11 changed files with 138 additions and 16 deletions

View File

@ -297,7 +297,7 @@ public class BOPBlocks
public static Block toadstool;
public static Block glowshroom;
//public static Block bramble_plant;
public static Block bramble;
//public static Block blue_fire;

View File

@ -0,0 +1,117 @@
/*******************************************************************************
* Copyright 2014-2019, 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.BlockSixWay;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.pathfinding.PathType;
import net.minecraft.state.StateContainer;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
public class BlockBramble extends BlockSixWay
{
public BlockBramble(Block.Builder builder)
{
super(0.25F, builder);
this.setDefaultState((IBlockState)((IBlockState)((IBlockState)((IBlockState)((IBlockState)((IBlockState)(this.stateContainer.getBaseState()).with(NORTH, Boolean.valueOf(false))).with(EAST, Boolean.valueOf(false))).with(SOUTH, Boolean.valueOf(false))).with(WEST, Boolean.valueOf(false))).with(UP, Boolean.valueOf(false))).with(DOWN, Boolean.valueOf(false)));
}
@Override
public IBlockState getStateForPlacement(BlockItemUseContext context)
{
return this.makeConnections(context.getWorld(), context.getPos());
}
public IBlockState makeConnections(IBlockReader p_196497_1_, BlockPos p_196497_2_)
{
Block block = p_196497_1_.getBlockState(p_196497_2_.down()).getBlock();
Block block1 = p_196497_1_.getBlockState(p_196497_2_.up()).getBlock();
Block block2 = p_196497_1_.getBlockState(p_196497_2_.north()).getBlock();
Block block3 = p_196497_1_.getBlockState(p_196497_2_.east()).getBlock();
Block block4 = p_196497_1_.getBlockState(p_196497_2_.south()).getBlock();
Block block5 = p_196497_1_.getBlockState(p_196497_2_.west()).getBlock();
return (IBlockState)((IBlockState)((IBlockState)((IBlockState)((IBlockState)((IBlockState)this.getDefaultState().with(DOWN, Boolean.valueOf(block == this || block.isFullCube(block.getDefaultState())))).with(UP, Boolean.valueOf(block1 == this || block1.isFullCube(block.getDefaultState())))).with(NORTH, Boolean.valueOf(block2 == this || block2.isFullCube(block.getDefaultState())))).with(EAST, Boolean.valueOf(block3 == this || block3.isFullCube(block.getDefaultState())))).with(SOUTH, Boolean.valueOf(block4 == this || block4.isFullCube(block.getDefaultState())))).with(WEST, Boolean.valueOf(block5 == this || block5.isFullCube(block.getDefaultState())));
}
/**
* Update the provided state given the provided neighbor facing and neighbor state, returning a new state.
* For example, fences make their connections to the passed in state if possible, and wet concrete powder immediately
* returns its solidified counterpart.
* Note that this method should ideally consider only the specific face passed in.
*/
@Override
public IBlockState updatePostPlacement(IBlockState stateIn, EnumFacing facing, IBlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos)
{
Block block = facingState.getBlock();
boolean flag = block == this || block.isFullCube(facingState);
return (IBlockState)stateIn.with(FACING_TO_PROPERTY_MAP.get(facing), Boolean.valueOf(flag));
}
/**
* @deprecated call via {@link IBlockState#isFullCube()} whenever possible. Implementing/overriding is fine.
*/
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public void onEntityCollision(IBlockState state, World worldIn, BlockPos pos, Entity entityIn) {
entityIn.attackEntityFrom(DamageSource.CACTUS, 1.0F);
}
/**
* Gets the render layer this block will render on. SOLID for solid blocks, CUTOUT or CUTOUT_MIPPED for on-off
* transparency (glass, reeds), TRANSLUCENT for fully blended transparency (stained glass)
*/
@Override
public BlockRenderLayer getRenderLayer()
{
return BlockRenderLayer.CUTOUT;
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder)
{
builder.add(NORTH, EAST, SOUTH, WEST, UP, DOWN);
}
/**
* Get the geometry of the queried face at the given position and state. This is used to decide whether things like
* buttons are allowed to be placed on the face, or how glass panes connect to the face, among other things.
* <p>
* Common values are {@code SOLID}, which is the default, and {@code UNDEFINED}, which represents something that does
* not fit the other descriptions and will generally cause other things not to connect to the face.
*
* @return an approximation of the form of the given face
* @deprecated call via {@link IBlockState#getBlockFaceShape(IBlockAccess,BlockPos,EnumFacing)} whenever possible.
* Implementing/overriding is fine.
*/
@Override
public BlockFaceShape getBlockFaceShape(IBlockReader worldIn, IBlockState state, BlockPos pos, EnumFacing face)
{
return BlockFaceShape.UNDEFINED;
}
@Override
public boolean allowsMovement(IBlockState state, IBlockReader worldIn, BlockPos pos, PathType type)
{
return false;
}
}

View File

@ -10,6 +10,7 @@ package biomesoplenty.init;
import static biomesoplenty.api.block.BOPBlocks.*;
import biomesoplenty.common.block.BlockAsh;
import biomesoplenty.common.block.BlockBramble;
import biomesoplenty.common.block.BlockDoublePlantBOP;
import biomesoplenty.common.block.BlockFlatPlantBOP;
import biomesoplenty.common.block.BlockFlesh;
@ -326,6 +327,7 @@ public class ModBlocks
watergrass = registerBlock(new BlockPlantBOP(Block.Builder.create(Material.VINE).doesNotBlockMovement().zeroHardnessAndResistance().sound(SoundType.PLANT)), "watergrass");
dead_leaf_pile = registerBlock(new BlockFlatPlantBOP(Block.Builder.create(Material.PLANTS).doesNotBlockMovement().zeroHardnessAndResistance().sound(SoundType.PLANT)), "dead_leaf_pile");
bramble = registerBlock(new BlockBramble(Block.Builder.create(Material.PLANTS, MapColor.RED).hardnessAndResistance(0.4F).sound(SoundType.WOOD)), "bramble");
toadstool = registerBlock(new BlockMushroomBOP(Block.Builder.create(Material.PLANTS).doesNotBlockMovement().zeroHardnessAndResistance().sound(SoundType.PLANT)), "toadstool");
glowshroom = registerBlock(new BlockMushroomBOP(Block.Builder.create(Material.PLANTS).doesNotBlockMovement().zeroHardnessAndResistance().sound(SoundType.PLANT).lightValue(6)), "glowshroom");

View File

@ -1,23 +1,23 @@
{
"multipart": [
{ "apply": { "model": "biomesoplenty:bramble_plant" }},
{ "apply": { "model": "biomesoplenty:block/bramble" }},
{ "when": { "north": true },
"apply": { "model": "biomesoplenty:bramble_plant_side" }
"apply": { "model": "biomesoplenty:block/bramble_side" }
},
{ "when": { "east": true },
"apply": { "model": "biomesoplenty:bramble_plant_side", "y": 90, "uvlock": true }
"apply": { "model": "biomesoplenty:block/bramble_side", "y": 90, "uvlock": true }
},
{ "when": { "south": true },
"apply": { "model": "biomesoplenty:bramble_plant_side", "y": 180, "uvlock": true }
"apply": { "model": "biomesoplenty:block/bramble_side", "y": 180, "uvlock": true }
},
{ "when": { "west": true },
"apply": { "model": "biomesoplenty:bramble_plant_side", "y": 270, "uvlock": true }
"apply": { "model": "biomesoplenty:block/bramble_side", "y": 270, "uvlock": true }
},
{ "when": { "up": true },
"apply": { "model": "biomesoplenty:bramble_plant_side", "x": 270, "uvlock": true }
"apply": { "model": "biomesoplenty:block/bramble_side", "x": 270, "uvlock": true }
},
{ "when": { "down": true },
"apply": { "model": "biomesoplenty:bramble_plant_side", "x": 90, "uvlock": true }
"apply": { "model": "biomesoplenty:block/bramble_side", "x": 90, "uvlock": true }
}
]
}

View File

@ -46,7 +46,7 @@
"block.biomesoplenty.barley": "Barley",
"block.biomesoplenty.blue_fire": "Blue Fire",
"block.biomesoplenty.blue_hydrangea": "Blue Hydrangea",
"block.biomesoplenty.bramble_plant": "Bramble",
"block.biomesoplenty.bramble": "Bramble",
"block.biomesoplenty.burning_blossom": "Burning Blossom",
"block.biomesoplenty.bush": "Bush",
"block.biomesoplenty.cattail": "Cattail",

View File

@ -1,9 +1,9 @@
{ "parent": "block/block",
"ambientocclusion": false,
"textures": {
"plant": "biomesoplenty:blocks/bramble_plant",
"plant": "biomesoplenty:blocks/bramble",
"thorns": "biomesoplenty:blocks/bramble_thorns",
"particle": "biomesoplenty:blocks/bramble_plant"
"particle": "biomesoplenty:blocks/bramble"
},
"elements": [
{ "from": [ 0.8, 0, 8 ],

View File

@ -1,8 +1,8 @@
{
"ambientocclusion": false,
"textures": {
"texture": "biomesoplenty:blocks/bramble_plant",
"particle": "biomesoplenty:blocks/bramble_plant"
"texture": "biomesoplenty:blocks/bramble",
"particle": "biomesoplenty:blocks/bramble"
},
"elements": [
{ "from": [ 4, 4, 0 ],

View File

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "biomesoplenty:items/bramble"
}
}

View File

@ -1,3 +0,0 @@
{
"parent": "biomesoplenty:block/bramble_plant"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B