Added jelled poison, and mixing effects for liquids

This commit is contained in:
Forstride 2016-07-18 07:21:01 -04:00
parent a198d003da
commit 5dcc78908b
14 changed files with 361 additions and 12 deletions

View file

@ -142,6 +142,7 @@ public class BOPBlocks
public static Block double_plant;
public static Block honey_block;
public static Block jelled_poison;
public static Block terrarium;
public static Block sand;

View file

@ -33,6 +33,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockBOPFlesh extends Block implements IBOPBlock
{
protected static final AxisAlignedBB FLESH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.875D, 1.0D);
// implement IBOPBlock
@Override
@ -56,12 +57,9 @@ public class BlockBOPFlesh extends Block implements IBOPBlock
this.setSoundType(SoundType.GROUND);
}
@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos)
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos)
{
// 7/8 height
float heightOffset = 0.125F;
return new AxisAlignedBB((double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), (double) (pos.getX() + 1), (double) ((float) (pos.getY() + 1) - heightOffset), (double) (pos.getZ() + 1));
return FLESH_AABB;
}
@Override

View file

@ -0,0 +1,63 @@
/*******************************************************************************
* Copyright 2014-2016, 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.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
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.BlockRenderLayer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockBOPJelledPoison extends Block implements IBOPBlock
{
// implement IBOPBlock
@Override
public Class<? extends ItemBlock> getItemClass() { return ItemBOPBlock.class; }
@Override
public IProperty[] getPresetProperties() { return new IProperty[] {}; }
@Override
public IProperty[] getNonRenderingProperties() { return null; }
@Override
public String getStateName(IBlockState state) {return "";}
@Override
@SideOnly(Side.CLIENT)
public IBlockColor getBlockColor() { return null; }
@Override
@SideOnly(Side.CLIENT)
public IItemColor getItemColor() { return null; }
public BlockBOPJelledPoison() {
super(Material.CLAY);
this.setHardness(0.4F);
this.setSoundType(SoundType.SLIME);
this.slipperiness = 0.9F;
}
@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.TRANSLUCENT;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
}

View file

@ -8,8 +8,11 @@
package biomesoplenty.common.fluids.blocks;
import biomesoplenty.api.block.BOPBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
@ -35,4 +38,54 @@ public class BlockBloodFluid extends BlockFluidClassic
{
return NULL_AABB;
}
@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
{
super.onBlockAdded(worldIn, pos, state);
this.checkForMixing(worldIn, pos, state);
}
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn)
{
super.neighborChanged(state, worldIn, pos, blockIn);
this.checkForMixing(worldIn, pos, state);
}
public boolean checkForMixing(World worldIn, BlockPos pos, IBlockState state)
{
boolean flag = false;
for (EnumFacing enumfacing : EnumFacing.values())
{
if (enumfacing != EnumFacing.DOWN && (worldIn.getBlockState(pos.offset(enumfacing)).getMaterial() == Material.WATER || worldIn.getBlockState(pos.offset(enumfacing)).getMaterial() == Material.LAVA))
{
if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock() != this.getBlockState().getBlock())
{
flag = true;
break;
}
}
}
if (flag)
{
Integer integer = (Integer)state.getValue(LEVEL);
if (integer.intValue() == 0)
{
worldIn.setBlockState(pos, BOPBlocks.flesh.getDefaultState());
return true;
}
if (integer.intValue() <= 4)
{
worldIn.setBlockState(pos, BOPBlocks.flesh.getDefaultState());
return true;
}
}
return false;
}
}

View file

@ -8,12 +8,15 @@
package biomesoplenty.common.fluids.blocks;
import biomesoplenty.api.block.BOPBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.MobEffects;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
@ -51,4 +54,54 @@ public class BlockHoneyFluid extends BlockFluidFinite
{
return NULL_AABB;
}
@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
{
super.onBlockAdded(worldIn, pos, state);
this.checkForMixing(worldIn, pos, state);
}
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn)
{
super.neighborChanged(state, worldIn, pos, blockIn);
this.checkForMixing(worldIn, pos, state);
}
public boolean checkForMixing(World worldIn, BlockPos pos, IBlockState state)
{
boolean flag = false;
for (EnumFacing enumfacing : EnumFacing.values())
{
if (enumfacing != EnumFacing.DOWN && (worldIn.getBlockState(pos.offset(enumfacing)).getMaterial() == Material.WATER || worldIn.getBlockState(pos.offset(enumfacing)).getMaterial() == Material.LAVA))
{
if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock() != this.getBlockState().getBlock())
{
flag = true;
break;
}
}
}
if (flag)
{
Integer integer = (Integer)state.getValue(LEVEL);
if (integer.intValue() == 0)
{
worldIn.setBlockState(pos, BOPBlocks.honey_block.getDefaultState());
return true;
}
if (integer.intValue() <= 4)
{
worldIn.setBlockState(pos, BOPBlocks.honey_block.getDefaultState());
return true;
}
}
return false;
}
}

View file

@ -10,12 +10,16 @@ package biomesoplenty.common.fluids.blocks;
import java.util.Random;
import biomesoplenty.api.block.BOPBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.init.MobEffects;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
@ -64,4 +68,54 @@ public class BlockHotSpringWaterFluid extends BlockFluidClassic
{
return NULL_AABB;
}
@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
{
super.onBlockAdded(worldIn, pos, state);
this.checkForMixing(worldIn, pos, state);
}
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn)
{
super.neighborChanged(state, worldIn, pos, blockIn);
this.checkForMixing(worldIn, pos, state);
}
public boolean checkForMixing(World worldIn, BlockPos pos, IBlockState state)
{
boolean flag = false;
for (EnumFacing enumfacing : EnumFacing.values())
{
if (enumfacing != EnumFacing.DOWN && (worldIn.getBlockState(pos.offset(enumfacing)).getMaterial() == Material.WATER || worldIn.getBlockState(pos.offset(enumfacing)).getMaterial() == Material.LAVA))
{
if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock() != this.getBlockState().getBlock())
{
flag = true;
break;
}
}
}
if (flag)
{
Integer integer = (Integer)state.getValue(LEVEL);
if (integer.intValue() == 0)
{
worldIn.setBlockState(pos, Blocks.STONE.getDefaultState());
return true;
}
if (integer.intValue() <= 4)
{
worldIn.setBlockState(pos, Blocks.STONE.getDefaultState());
return true;
}
}
return false;
}
}

View file

@ -8,12 +8,15 @@
package biomesoplenty.common.fluids.blocks;
import biomesoplenty.api.block.BOPBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.MobEffects;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
@ -51,4 +54,54 @@ public class BlockPoisonFluid extends BlockFluidClassic
{
return NULL_AABB;
}
@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
{
super.onBlockAdded(worldIn, pos, state);
this.checkForMixing(worldIn, pos, state);
}
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn)
{
super.neighborChanged(state, worldIn, pos, blockIn);
this.checkForMixing(worldIn, pos, state);
}
public boolean checkForMixing(World worldIn, BlockPos pos, IBlockState state)
{
boolean flag = false;
for (EnumFacing enumfacing : EnumFacing.values())
{
if (enumfacing != EnumFacing.DOWN && (worldIn.getBlockState(pos.offset(enumfacing)).getMaterial() == Material.WATER || worldIn.getBlockState(pos.offset(enumfacing)).getMaterial() == Material.LAVA))
{
if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock() != this.getBlockState().getBlock())
{
flag = true;
break;
}
}
}
if (flag)
{
Integer integer = (Integer)state.getValue(LEVEL);
if (integer.intValue() == 0)
{
worldIn.setBlockState(pos, BOPBlocks.jelled_poison.getDefaultState());
return true;
}
if (integer.intValue() <= 4)
{
worldIn.setBlockState(pos, BOPBlocks.jelled_poison.getDefaultState());
return true;
}
}
return false;
}
}

View file

@ -8,10 +8,15 @@
package biomesoplenty.common.fluids.blocks;
import biomesoplenty.api.block.BOPBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
@ -25,6 +30,7 @@ public class BlockQuicksandFluid extends BlockFluidClassic
{
super(fluid, Material.WATER);
this.quantaPerBlock = 3;
this.renderLayer = BlockRenderLayer.SOLID;
}
@Override
@ -33,15 +39,59 @@ public class BlockQuicksandFluid extends BlockFluidClassic
return FULL_BLOCK_AABB;
}
@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos)
{
return NULL_AABB;
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity)
{
entity.setInWeb();
}
@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
{
super.onBlockAdded(worldIn, pos, state);
this.checkForMixing(worldIn, pos, state);
}
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn)
{
super.neighborChanged(state, worldIn, pos, blockIn);
this.checkForMixing(worldIn, pos, state);
}
public boolean checkForMixing(World worldIn, BlockPos pos, IBlockState state)
{
boolean flag = false;
for (EnumFacing enumfacing : EnumFacing.values())
{
if (enumfacing != EnumFacing.DOWN && (worldIn.getBlockState(pos.offset(enumfacing)).getMaterial() == Material.WATER || worldIn.getBlockState(pos.offset(enumfacing)).getMaterial() == Material.LAVA))
{
if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock() != this.getBlockState().getBlock())
{
flag = true;
break;
}
}
}
if (flag)
{
Integer integer = (Integer)state.getValue(LEVEL);
if (integer.intValue() == 0)
{
worldIn.setBlockState(pos, BOPBlocks.mud.getDefaultState());
return true;
}
if (integer.intValue() <= 4)
{
worldIn.setBlockState(pos, BOPBlocks.mud.getDefaultState());
return true;
}
}
return false;
}
}

View file

@ -42,6 +42,7 @@ import biomesoplenty.common.block.BlockBOPHalfOtherSlab;
import biomesoplenty.common.block.BlockBOPHalfWoodSlab;
import biomesoplenty.common.block.BlockBOPHive;
import biomesoplenty.common.block.BlockBOPHoney;
import biomesoplenty.common.block.BlockBOPJelledPoison;
import biomesoplenty.common.block.BlockBOPLeaves;
import biomesoplenty.common.block.BlockBOPLilypad;
import biomesoplenty.common.block.BlockBOPLog;
@ -131,6 +132,7 @@ public class ModBlocks
gem_block = registerBlock( new BlockBOPGem(), "gem_block" );
hive = registerBlock( new BlockBOPHive(), "hive" );
honey_block = registerBlock( new BlockBOPHoney(), "honey_block" );
jelled_poison = registerBlock( new BlockBOPJelledPoison(), "jelled_poison" );
//Material Blocks
bamboo_thatching = registerBlock( (new BlockBOPGeneric(Material.WOOD, SoundType.WOOD)).setHardness(2.0F), "bamboo_thatching"); bamboo_thatching.setHarvestLevel("axe", 0);

View file

@ -0,0 +1,5 @@
{
"variants": {
"normal": { "model": "biomesoplenty:jelled_poison" }
}
}

View file

@ -290,6 +290,7 @@ tile.jacaranda_fence.name=Jacaranda Fence
tile.jacaranda_fence_gate.name=Jacaranda Fence Gate
tile.jacaranda_wood_slab.name=Jacaranda Wood Slab
tile.jacaranda_stairs.name=Jacaranda Wood Stairs
tile.jelled_poison.name=Jelled Poison
tile.leaves_0.yellow_autumn_leaves.name=Yellow Autumn Leaves
tile.leaves_0.orange_autumn_leaves.name=Orange Autumn Leaves
tile.leaves_0.bamboo_leaves.name=Bamboo Leaves

View file

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "biomesoplenty:blocks/jelled_poison"
}
}

View file

@ -0,0 +1,10 @@
{
"parent": "biomesoplenty:block/jelled_poison",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}