Merge pull request #674 from GirafiStudios/BOP-1.8.9-3.0.x

Made Tall Cattails drop 2 regular cattails.
This commit is contained in:
Forstride 2016-02-14 01:04:00 -05:00
commit 510c7fde6e
1 changed files with 24 additions and 16 deletions

View File

@ -8,10 +8,8 @@
package biomesoplenty.common.block; package biomesoplenty.common.block;
import java.util.List;
import java.util.Random;
import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.block.BlockQueries;
import biomesoplenty.common.enums.BOPPlants;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockState; import net.minecraft.block.state.BlockState;
@ -26,11 +24,12 @@ import net.minecraft.world.ColorizerGrass;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeColorHelper; import net.minecraft.world.biome.BiomeColorHelper;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.IShearable; import net.minecraftforge.common.IShearable;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
public class BlockBOPDoublePlant extends BlockBOPDoubleDecoration implements IShearable public class BlockBOPDoublePlant extends BlockBOPDoubleDecoration implements IShearable
{ {
@ -182,13 +181,28 @@ public class BlockBOPDoublePlant extends BlockBOPDoubleDecoration implements ISh
} }
@Override
public List<ItemStack> getUpperDrops(IBlockAccess world, BlockPos upperPos, IBlockState upperState, int fortune)
{
List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
DoublePlantType type = (DoublePlantType) upperState.getValue(VARIANT);
switch (type) {
case TALL_CATTAIL:
ret.add(BlockBOPPlant.paging.getVariantItem(BOPPlants.CATTAIL));
default:
break;
}
return ret;
}
// get the items dropped when you bash the bush // get the items dropped when you bash the bush
@Override @Override
public List<ItemStack> getLowerDrops(IBlockAccess world, BlockPos lowerPos, IBlockState lowerState, int fortune) public List<ItemStack> getLowerDrops(IBlockAccess world, BlockPos lowerPos, IBlockState lowerState, int fortune)
{ {
Random rand = world instanceof World ? ((World)world).rand : RANDOM;
// start with an empty stack // start with an empty stack
List<ItemStack> ret = new java.util.ArrayList<ItemStack>(); List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
@ -196,15 +210,11 @@ public class BlockBOPDoublePlant extends BlockBOPDoubleDecoration implements ISh
DoublePlantType type = (DoublePlantType) lowerState.getValue(VARIANT); DoublePlantType type = (DoublePlantType) lowerState.getValue(VARIANT);
switch (type) switch (type)
{ {
case FLAX:
// drop flax plant and also 1 in 8 chance of getting a seed
ret.add(this.getVariantItem(type));
if (rand.nextInt(8) == 0) {ret.add(ForgeHooks.getGrassSeed(rand));}
case TALL_CATTAIL: case TALL_CATTAIL:
ret.add(BlockBOPPlant.paging.getVariantItem(BOPPlants.CATTAIL));
break; break;
case EYEBULB: default: default:
// drop self // drop self
ret.add(this.getVariantItem(type)); ret.add(this.getVariantItem(type));
} }
@ -231,8 +241,6 @@ public class BlockBOPDoublePlant extends BlockBOPDoubleDecoration implements ISh
DoublePlantType type = (DoublePlantType) lowerState.getValue(VARIANT); DoublePlantType type = (DoublePlantType) lowerState.getValue(VARIANT);
switch (type) switch (type)
{ {
case TALL_CATTAIL:
ret.add(this.getVariantItem(type));
default: default:
break; break;
} }