diff --git a/build.properties b/build.properties index 8444eebe6..97ffc6ffb 100644 --- a/build.properties +++ b/build.properties @@ -1,3 +1,3 @@ minecraft_version=1.8 -forge_version=11.14.0.1247-1.8 +forge_version=11.14.0.1265-1.8 mod_version=3.0.0 diff --git a/src/main/java/biomesoplenty/api/block/BOPBlocks.java b/src/main/java/biomesoplenty/api/block/BOPBlocks.java index bfc400517..26a0ccff4 100644 --- a/src/main/java/biomesoplenty/api/block/BOPBlocks.java +++ b/src/main/java/biomesoplenty/api/block/BOPBlocks.java @@ -22,4 +22,5 @@ public class BOPBlocks public static Block log4; public static Block mushroom; public static Block planks; + public static Block stone; } diff --git a/src/main/java/biomesoplenty/api/block/BOPPlant.java b/src/main/java/biomesoplenty/api/block/BOPPlant.java index 26085638e..b9090c954 100644 --- a/src/main/java/biomesoplenty/api/block/BOPPlant.java +++ b/src/main/java/biomesoplenty/api/block/BOPPlant.java @@ -44,7 +44,7 @@ public class BOPPlant extends BOPBlock public boolean canBlockStay(World world, BlockPos pos, IBlockState state) { - Block ground = world.getBlockState(pos.offsetDown()).getBlock(); + Block ground = world.getBlockState(pos.down()).getBlock(); return ground == Blocks.grass || ground == Blocks.dirt || ground == Blocks.farmland; } diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPFlower2.java b/src/main/java/biomesoplenty/common/block/BlockBOPFlower2.java index f282ea4ef..5c877f8c7 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPFlower2.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPFlower2.java @@ -32,7 +32,7 @@ public class BlockBOPFlower2 extends BOPPlant @Override public boolean canBlockStay(World world, BlockPos pos, IBlockState state) { - Block ground = world.getBlockState(pos.offsetDown()).getBlock(); + Block ground = world.getBlockState(pos.down()).getBlock(); FlowerType type = (FlowerType)state.getValue(VARIANT_PROP); switch (type) diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPMushroom.java b/src/main/java/biomesoplenty/common/block/BlockBOPMushroom.java index 87fff89cb..b6cb2774b 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPMushroom.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPMushroom.java @@ -45,7 +45,7 @@ public class BlockBOPMushroom extends BOPPlant @Override public boolean canBlockStay(World world, BlockPos pos, IBlockState state) { - Block ground = world.getBlockState(pos.offsetDown()).getBlock(); + Block ground = world.getBlockState(pos.down()).getBlock(); MushroomType type = (MushroomType)state.getValue(VARIANT_PROP); switch (type) diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPStone.java b/src/main/java/biomesoplenty/common/block/BlockBOPStone.java new file mode 100644 index 000000000..812fb6074 --- /dev/null +++ b/src/main/java/biomesoplenty/common/block/BlockBOPStone.java @@ -0,0 +1,127 @@ +/******************************************************************************* + * Copyright 2014, 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.api.block.BOPBlock; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IStringSerializable; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; + +public class BlockBOPStone extends BOPBlock +{ + public static PropertyEnum VARIANT_PROP = PropertyEnum.create("variant", StoneType.class); + public static PropertyBool POLISHED_PROP = PropertyBool.create("polished"); + + public BlockBOPStone() + { + super(Material.rock); + + this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, StoneType.LIMESTONE).withProperty(POLISHED_PROP, Boolean.valueOf(false))); + + this.setHarvestLevel("pickaxe", 1, this.getDefaultState().withProperty(VARIANT_PROP, StoneType.LIMESTONE)); + this.setHarvestLevel("pickaxe", 2, this.getDefaultState().withProperty(VARIANT_PROP, StoneType.SILTSTONE)); + this.setHarvestLevel("pickaxe", 3, this.getDefaultState().withProperty(VARIANT_PROP, StoneType.SHALE)); + } + + @Override + public float getBlockHardness(World world, BlockPos pos) + { + IBlockState state = world.getBlockState(pos); + + if (state.getBlock() == this) + { + boolean polished = (Boolean)state.getValue(POLISHED_PROP); + + if (polished) return 1.5F; + return 3.0F; + } + + return super.getBlockHardness(world, pos); + } + + @Override + public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion) + { + IBlockState state = world.getBlockState(pos); + + if (state.getBlock() == this) + { + boolean polished = (Boolean)state.getValue(POLISHED_PROP); + + if (polished) return 7.0F; + return 5.0F; + } + + return super.getExplosionResistance(world, pos, exploder, explosion); + } + + @Override + public IBlockState getStateFromMeta(int meta) + { + boolean polished = (meta & 8) > 0; + int type = meta & 3; + + return this.getDefaultState().withProperty(VARIANT_PROP, StoneType.values()[type]).withProperty(POLISHED_PROP, Boolean.valueOf(polished)); + } + + @Override + public int getMetaFromState(IBlockState state) + { + int baseMeta = ((StoneType)state.getValue(VARIANT_PROP)).ordinal(); + boolean polished = (Boolean)state.getValue(POLISHED_PROP); + + return polished ? baseMeta | 8 : baseMeta; + } + + @Override + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] { VARIANT_PROP, POLISHED_PROP }); + } + + @Override + public IProperty[] getPresetProperties() + { + return new IProperty[] { VARIANT_PROP, POLISHED_PROP }; + } + + @Override + public String getStateName(IBlockState state, boolean fullName) + { + boolean polished = (Boolean)state.getValue(POLISHED_PROP); + + return (fullName && polished ? "polished_" : "") + ((StoneType)state.getValue(VARIANT_PROP)).getName(); + } + + public static enum StoneType implements IStringSerializable + { + LIMESTONE, + SILTSTONE, + SHALE; + + public String getName() + { + return this.name().toLowerCase(); + } + + @Override + public String toString() + { + return getName(); + } + } +} diff --git a/src/main/java/biomesoplenty/common/block/BlockBamboo.java b/src/main/java/biomesoplenty/common/block/BlockBamboo.java index 56541da64..3aeb2107c 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBamboo.java +++ b/src/main/java/biomesoplenty/common/block/BlockBamboo.java @@ -32,7 +32,7 @@ public class BlockBamboo extends BOPPlant @Override public boolean canBlockStay(World world, BlockPos pos, IBlockState state) { - Block ground = world.getBlockState(pos.offsetDown()).getBlock(); + Block ground = world.getBlockState(pos.down()).getBlock(); return ground == Blocks.grass || ground == Blocks.dirt || ground == this; } diff --git a/src/main/java/biomesoplenty/common/init/ModBlocks.java b/src/main/java/biomesoplenty/common/init/ModBlocks.java index b48920983..9e38d2a2b 100644 --- a/src/main/java/biomesoplenty/common/init/ModBlocks.java +++ b/src/main/java/biomesoplenty/common/init/ModBlocks.java @@ -27,6 +27,7 @@ import biomesoplenty.common.block.BlockBOPLog3; import biomesoplenty.common.block.BlockBOPLog4; import biomesoplenty.common.block.BlockBOPMushroom; import biomesoplenty.common.block.BlockBOPPlanks; +import biomesoplenty.common.block.BlockBOPStone; import biomesoplenty.common.block.BlockBamboo; import biomesoplenty.common.item.ItemBlockWithVariants; import biomesoplenty.common.util.block.BlockStateUtils; @@ -46,6 +47,7 @@ public class ModBlocks log4 = registerBlock(new BlockBOPLog4(), "log4"); mushroom = registerBlock(new BlockBOPMushroom(), "mushroom"); planks = registerBlock(new BlockBOPPlanks(), "planks"); + stone = registerBlock(new BlockBOPStone(), "stone"); } private static Block registerBlock(BOPBlock block, String name) diff --git a/src/main/resources/assets/biomesoplenty/blockstates/rocks.json b/src/main/resources/assets/biomesoplenty/blockstates/rocks.json deleted file mode 100644 index 1a85b31ec..000000000 --- a/src/main/resources/assets/biomesoplenty/blockstates/rocks.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "variants": { - "variant=limestone": { "model": "biomesoplenty:limestone" }, - "variant=polished_limestone": { "model": "biomesoplenty:pilished_limestone" }, - "variant=siltstone": { "model": "biomesoplenty:siltstone" }, - "variant=polished_siltstone": { "model": "biomesoplenty:polished_siltstone" }, - "variant=shale": { "model": "biomesoplenty:shale" }, - "variant=polished_shale": { "model": "biomesoplenty:polished_shale" } - } -} diff --git a/src/main/resources/assets/biomesoplenty/blockstates/stone.json b/src/main/resources/assets/biomesoplenty/blockstates/stone.json new file mode 100644 index 000000000..6cae6f91a --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/blockstates/stone.json @@ -0,0 +1,10 @@ +{ + "variants": { + "polished=false,variant=limestone": { "model": "biomesoplenty:limestone" }, + "polished=true,variant=limestone": { "model": "biomesoplenty:polished_limestone" }, + "polished=false,variant=siltstone": { "model": "biomesoplenty:siltstone" }, + "polished=true,variant=siltstone": { "model": "biomesoplenty:polished_siltstone" }, + "polished=false,variant=shale": { "model": "biomesoplenty:shale" }, + "polished=true,variant=shale": { "model": "biomesoplenty:polished_shale" } + } +} diff --git a/src/main/resources/assets/biomesoplenty/lang/en_US.lang b/src/main/resources/assets/biomesoplenty/lang/en_US.lang index a7abe4017..cc877a8ab 100644 --- a/src/main/resources/assets/biomesoplenty/lang/en_US.lang +++ b/src/main/resources/assets/biomesoplenty/lang/en_US.lang @@ -105,9 +105,9 @@ tile.planks.hell_bark.name=Hell Bark Wood Planks tile.planks.jacaranda.name=Jacaranda Wood Planks tile.planks.mahogany.name=Mahogany Wood Planks -tile.rocks.limestone.name=Limestone -tile.rocks.polished_limestone.name=Polished Limestone -tile.rocks.siltstone.name=Siltstone -tile.rocks.polished_siltstone.name=Polished Siltstone -tile.rocks.shale.name=Shale -tile.rocks.polished_shale.name=Polished Shale +tile.stone.limestone.name=Limestone +tile.stone.polished_limestone.name=Polished Limestone +tile.stone.siltstone.name=Siltstone +tile.stone.polished_siltstone.name=Polished Siltstone +tile.stone.shale.name=Shale +tile.stone.polished_shale.name=Polished Shale