diff --git a/src/main/java/biomesoplenty/api/block/BOPBlocks.java b/src/main/java/biomesoplenty/api/block/BOPBlocks.java index 8340b009d..837ade571 100644 --- a/src/main/java/biomesoplenty/api/block/BOPBlocks.java +++ b/src/main/java/biomesoplenty/api/block/BOPBlocks.java @@ -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; diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPFlesh.java b/src/main/java/biomesoplenty/common/block/BlockBOPFlesh.java index ce3b4bd28..cbf24e427 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPFlesh.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPFlesh.java @@ -33,7 +33,8 @@ 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 public Class getItemClass() { return ItemBOPBlock.class; } @@ -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 diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPJelledPoison.java b/src/main/java/biomesoplenty/common/block/BlockBOPJelledPoison.java new file mode 100644 index 000000000..7aaa2c1c1 --- /dev/null +++ b/src/main/java/biomesoplenty/common/block/BlockBOPJelledPoison.java @@ -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 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; + } + +} \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/fluids/blocks/BlockBloodFluid.java b/src/main/java/biomesoplenty/common/fluids/blocks/BlockBloodFluid.java index 72bfbfd95..68582c420 100644 --- a/src/main/java/biomesoplenty/common/fluids/blocks/BlockBloodFluid.java +++ b/src/main/java/biomesoplenty/common/fluids/blocks/BlockBloodFluid.java @@ -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; + } } \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/fluids/blocks/BlockHoneyFluid.java b/src/main/java/biomesoplenty/common/fluids/blocks/BlockHoneyFluid.java index 409d54645..01089e97b 100644 --- a/src/main/java/biomesoplenty/common/fluids/blocks/BlockHoneyFluid.java +++ b/src/main/java/biomesoplenty/common/fluids/blocks/BlockHoneyFluid.java @@ -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; + } } \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/fluids/blocks/BlockHotSpringWaterFluid.java b/src/main/java/biomesoplenty/common/fluids/blocks/BlockHotSpringWaterFluid.java index 950cc6a3d..c25c474ac 100644 --- a/src/main/java/biomesoplenty/common/fluids/blocks/BlockHotSpringWaterFluid.java +++ b/src/main/java/biomesoplenty/common/fluids/blocks/BlockHotSpringWaterFluid.java @@ -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; + } } \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/fluids/blocks/BlockPoisonFluid.java b/src/main/java/biomesoplenty/common/fluids/blocks/BlockPoisonFluid.java index bddc1b3d4..4eea4db57 100644 --- a/src/main/java/biomesoplenty/common/fluids/blocks/BlockPoisonFluid.java +++ b/src/main/java/biomesoplenty/common/fluids/blocks/BlockPoisonFluid.java @@ -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; + } } \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/fluids/blocks/BlockQuicksandFluid.java b/src/main/java/biomesoplenty/common/fluids/blocks/BlockQuicksandFluid.java index bdf496fea..fa6a01171 100644 --- a/src/main/java/biomesoplenty/common/fluids/blocks/BlockQuicksandFluid.java +++ b/src/main/java/biomesoplenty/common/fluids/blocks/BlockQuicksandFluid.java @@ -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 @@ -32,16 +38,60 @@ 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; + } } \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/init/ModBlocks.java b/src/main/java/biomesoplenty/common/init/ModBlocks.java index de1a02a3e..17312385b 100644 --- a/src/main/java/biomesoplenty/common/init/ModBlocks.java +++ b/src/main/java/biomesoplenty/common/init/ModBlocks.java @@ -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); diff --git a/src/main/resources/assets/biomesoplenty/blockstates/jelled_poison.json b/src/main/resources/assets/biomesoplenty/blockstates/jelled_poison.json new file mode 100644 index 000000000..629b12086 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/blockstates/jelled_poison.json @@ -0,0 +1,5 @@ +{ + "variants": { + "normal": { "model": "biomesoplenty:jelled_poison" } + } +} diff --git a/src/main/resources/assets/biomesoplenty/lang/en_US.lang b/src/main/resources/assets/biomesoplenty/lang/en_US.lang index a0934f784..5d7195016 100644 --- a/src/main/resources/assets/biomesoplenty/lang/en_US.lang +++ b/src/main/resources/assets/biomesoplenty/lang/en_US.lang @@ -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 diff --git a/src/main/resources/assets/biomesoplenty/models/block/jelled_poison.json b/src/main/resources/assets/biomesoplenty/models/block/jelled_poison.json new file mode 100644 index 000000000..c145a8126 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/jelled_poison.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "biomesoplenty:blocks/jelled_poison" + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/jelled_poison.json b/src/main/resources/assets/biomesoplenty/models/item/jelled_poison.json new file mode 100644 index 000000000..c3940bce9 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/jelled_poison.json @@ -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 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/gelled_poison.png b/src/main/resources/assets/biomesoplenty/textures/blocks/jelled_poison.png similarity index 100% rename from src/main/resources/assets/biomesoplenty/textures/blocks/gelled_poison.png rename to src/main/resources/assets/biomesoplenty/textures/blocks/jelled_poison.png