Added mud blocks, added remaining methods to ash blocks

This commit is contained in:
Forstride 2019-01-10 06:26:47 -05:00
parent 88f6ea79c6
commit 5f16ea4eaf
7 changed files with 150 additions and 85 deletions

View File

@ -12,6 +12,8 @@ import net.minecraft.block.Block;
public class BOPBlocks
{
public static Block ash_block;
public static Block mud;
/*public static Block grass;
public static Block dirt;
@ -22,7 +24,6 @@ public class BOPBlocks
public static Block white_sand;
public static Block white_sandstone;
public static Block white_sandstone_stairs;
public static Block mud;
public static Block mud_brick_block;
public static Block mud_brick_stairs;
public static Block other_slab;

View File

@ -0,0 +1,65 @@
/*******************************************************************************
* 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 java.util.Random;
import biomesoplenty.api.item.BOPItems;
import net.minecraft.block.Block;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Particles;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockAsh extends Block
{
protected static final VoxelShape SHAPE = Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 14.0D, 16.0D);
public BlockAsh()
{
// TODO: Sound and Harvest Level
super(Builder.create(Material.SAND, MapColor.BLACK).hardnessAndResistance(0.4F, 0.1F));
//this.setHarvestLevel("shovel", 0);
}
@Override
public VoxelShape getCollisionShape(IBlockState state, IBlockReader worldIn, BlockPos pos)
{
return SHAPE;
}
@Override
public IItemProvider getItemDropped(IBlockState state, World worldIn, BlockPos pos, int fortune)
{
return BOPItems.ash;
}
@Override
public int quantityDropped(IBlockState state, Random random)
{
return 4;
}
@Override
@OnlyIn(Dist.CLIENT)
public void animateTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
super.animateTick(stateIn, worldIn, pos, rand);
if (rand.nextInt(2) == 0)
{
worldIn.addParticle(Particles.SMOKE, (double)((float)pos.getX() + rand.nextFloat()), (double)((float)pos.getY() + 1.1F), (double)((float)pos.getZ() + rand.nextFloat()), 0.0D, 0.0D, 0.0D);
}
}
}

View File

@ -1,70 +0,0 @@
/*******************************************************************************
* 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.SoundType;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import java.util.Random;
public class BlockBOPAsh extends Block
{
protected static final AxisAlignedBB COLLISION_BOX = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.875D, 1.0D);
public BlockBOPAsh()
{
// TODO: Sound
super(Builder.create(Material.SAND, MapColor.BLACK).hardnessAndResistance(0.4F, 0.4F));
//this.setHarvestLevel("shovel", 0);
}
// ash blocks are slightly lower
/*@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos)
{
return COLLISION_BOX;
}
@Override
public boolean isFireSource(World world, BlockPos pos, EnumFacing side)
{
return (side == EnumFacing.UP);
}
// drop 4 balls of ash instead of one block
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return BOPItems.ash;
}
@Override
public int quantityDropped(Random random)
{
return 4;
}
// randomly show some smoke particles
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random random)
{
if (random.nextInt(2) == 0)
{
world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, pos.getX() + random.nextFloat(), pos.getY() + 1.1F, pos.getZ() + random.nextFloat(), 0.0D, 0.0D, 0.0D);
}
}*/
}

View File

@ -0,0 +1,69 @@
/*******************************************************************************
* 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 java.util.Random;
import biomesoplenty.api.item.BOPItems;
import net.minecraft.block.Block;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.init.Particles;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockMud extends Block
{
protected static final VoxelShape SHAPE = Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 14.0D, 16.0D);
public BlockMud()
{
// TODO: Sound and Harvest Level
super(Builder.create(Material.GROUND, MapColor.BROWN).hardnessAndResistance(0.6F, 0.1F));
//this.setHarvestLevel("shovel", 0);
}
@Override
public VoxelShape getCollisionShape(IBlockState state, IBlockReader worldIn, BlockPos pos)
{
return SHAPE;
}
@Override
public IItemProvider getItemDropped(IBlockState state, World worldIn, BlockPos pos, int fortune)
{
return BOPItems.mudball;
}
@Override
public int quantityDropped(IBlockState state, Random random)
{
return 4;
}
@Override
public void onEntityCollision(IBlockState state, World worldIn, BlockPos pos, Entity entityIn)
{
entityIn.motionX *= 0.4D;
entityIn.motionZ *= 0.4D;
}
@Override
public boolean canSustainPlant(IBlockState state, IBlockReader world, BlockPos pos, EnumFacing facing, net.minecraftforge.common.IPlantable plantable)
{
return false;
}
}

View File

@ -7,23 +7,23 @@
******************************************************************************/
package biomesoplenty.init;
import biomesoplenty.common.block.BlockBOPAsh;
import static biomesoplenty.api.block.BOPBlocks.ash_block;
import static biomesoplenty.api.block.BOPBlocks.mud;
import biomesoplenty.common.block.BlockAsh;
import biomesoplenty.common.block.BlockMud;
import biomesoplenty.common.util.inventory.ItemGroupBOP;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemGroup;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.IForgeRegistry;
import static biomesoplenty.api.block.BOPBlocks.*;
public class ModBlocks
{
public static void init()
{
ash_block = registerBlock(new BlockBOPAsh(), "ash_block");
ash_block = registerBlock(new BlockAsh(), "ash_block");
mud = registerBlock(new BlockMud(), "mud");
}
public static Block registerBlock(Block block, String name)

View File

@ -1,10 +1,10 @@
{
"variants": {
"variant=mud": [
{ "model": "biomesoplenty:mud" },
{ "model": "biomesoplenty:mud", "y": 90 },
{ "model": "biomesoplenty:mud", "y": 180 },
{ "model": "biomesoplenty:mud", "y": 270 }
]
"": [
{ "model": "biomesoplenty:block/mud" },
{ "model": "biomesoplenty:block/mud", "y": 90 },
{ "model": "biomesoplenty:block/mud", "y": 180 },
{ "model": "biomesoplenty:block/mud", "y": 270 }
]
}
}

View File

@ -160,7 +160,7 @@
"block.biomesoplenty.mahogany_fence_gate": "Mahogany Fence Gate",
"block.biomesoplenty.mahogany_wood_slab": "Mahogany Wood Slab",
"block.biomesoplenty.mahogany_stairs": "Mahogany Wood Stairs",
"block.biomesoplenty.mud.mud": "Mud",
"block.biomesoplenty.mud": "Mud",
"block.biomesoplenty.mud_brick_block": "Mud Bricks",
"block.biomesoplenty.mud_brick_slab": "Mud Bricks Slab",
"block.biomesoplenty.mud_brick_stairs": "Mud Bricks Stairs",