Skip to content

Commit

Permalink
Fix Berry Bushes dropping no berries. Closes #377
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbegt committed Jul 7, 2017
1 parent d2bc623 commit 1c25a83
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 26 deletions.
Expand Up @@ -35,20 +35,18 @@ public class BlockEnumBerryBush extends Block implements IPlantable, IGrowable
{
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 3);

private final ItemStack itemDrop;
private ItemStack itemDrop;

//@formatter:off
public static final AxisAlignedBB SMALL_BUSH_AABB = new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 0.5D, 0.75D);
public static final AxisAlignedBB MEDIUM_BUSH_AABB = new AxisAlignedBB(0.125D, 0.0D, 0.125D, 0.875D, 0.75D, 0.875D);
public static final AxisAlignedBB FULL_BUSH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
//@formatter:on

public BlockEnumBerryBush(ItemStack item)
public BlockEnumBerryBush()
{
super(Material.LEAVES);

this.itemDrop = item;

this.setCreativeTab(NaturaRegistry.tabWorld);
this.setTickRandomly(true);
this.setHardness(0.3F);
Expand All @@ -60,6 +58,11 @@ public boolean isMaxAge(IBlockState state)
return state.getValue(AGE).intValue() >= 3;
}

public void setItemDrop(ItemStack itemIn)
{
this.itemDrop = itemIn;
}

@Nonnull
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
Expand Down Expand Up @@ -96,10 +99,12 @@ public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos)
public IBlockState getPlant(IBlockAccess world, BlockPos pos)
{
IBlockState state = world.getBlockState(pos);

if (state.getBlock() != this)
{
return this.getDefaultState();
}

return state;
}

Expand Down
22 changes: 14 additions & 8 deletions src/main/java/com/progwml6/natura/nether/NaturaNether.java
Expand Up @@ -5,6 +5,7 @@
import com.google.common.eventbus.Subscribe;
import com.progwml6.natura.common.CommonProxy;
import com.progwml6.natura.common.NaturaPulse;
import com.progwml6.natura.common.block.BlockEnumBerryBush;
import com.progwml6.natura.common.block.BlockNaturaDoor;
import com.progwml6.natura.common.item.ItemBlockLeaves;
import com.progwml6.natura.common.item.ItemNaturaDoor;
Expand Down Expand Up @@ -83,10 +84,10 @@ public class NaturaNether extends NaturaPulse
public static Block netherStairsDarkwood;
public static Block netherStairsFusewood;

public static Block netherBerryBushBlightberry;
public static Block netherBerryBushDuskberry;
public static Block netherBerryBushSkyberry;
public static Block netherBerryBushStingberry;
public static BlockEnumBerryBush netherBerryBushBlightberry;
public static BlockEnumBerryBush netherBerryBushDuskberry;
public static BlockEnumBerryBush netherBerryBushSkyberry;
public static BlockEnumBerryBush netherBerryBushStingberry;

public static BlockNetherGlowshroom netherGlowshroom;
public static BlockNetherLargeGlowshroom netherLargeGreenGlowshroom;
Expand Down Expand Up @@ -151,10 +152,10 @@ public void registerBlocks(Register<Block> event)
netherStairsDarkwood = registerBlockStairsFrom(registry, netherPlanks, BlockNetherPlanks.PlankType.DARKWOOD, "nether_stairs_darkwood");
netherStairsFusewood = registerBlockStairsFrom(registry, netherPlanks, BlockNetherPlanks.PlankType.FUSEWOOD, "nether_stairs_fusewood");

netherBerryBushBlightberry = registerBlock(registry, new BlockNetherBerryBush(NaturaCommons.blightberry), "nether_berrybush_blightberry");
netherBerryBushDuskberry = registerBlock(registry, new BlockNetherBerryBush(NaturaCommons.duskberry), "nether_berrybush_duskberry");
netherBerryBushSkyberry = registerBlock(registry, new BlockNetherBerryBush(NaturaCommons.skyberry), "nether_berrybush_skyberry");
netherBerryBushStingberry = registerBlock(registry, new BlockNetherBerryBush(NaturaCommons.stingberry), "nether_berrybush_stingberry");
netherBerryBushBlightberry = registerBlock(registry, new BlockNetherBerryBush(), "nether_berrybush_blightberry");
netherBerryBushDuskberry = registerBlock(registry, new BlockNetherBerryBush(), "nether_berrybush_duskberry");
netherBerryBushSkyberry = registerBlock(registry, new BlockNetherBerryBush(), "nether_berrybush_skyberry");
netherBerryBushStingberry = registerBlock(registry, new BlockNetherBerryBush(), "nether_berrybush_stingberry");

respawnObelisk = registerBlock(registry, new BlockRespawnObelisk(), "respawn_obelisk");

Expand Down Expand Up @@ -221,6 +222,11 @@ public void registerItems(Register<Item> event)
netherBerryBushSkyberry = registerItemBlock(registry, netherBerryBushSkyberry, "nether_berrybush_skyberry");
netherBerryBushStingberry = registerItemBlock(registry, netherBerryBushStingberry, "nether_berrybush_stingberry");

netherBerryBushBlightberry.setItemDrop(NaturaCommons.blightberry);
netherBerryBushDuskberry.setItemDrop(NaturaCommons.duskberry);
netherBerryBushSkyberry.setItemDrop(NaturaCommons.skyberry);
netherBerryBushStingberry.setItemDrop(NaturaCommons.stingberry);

respawnObelisk = registerEnumItemBlock(registry, respawnObelisk, "respawn_obelisk");

netherGlowshroom = registerItemBlockProp(registry, new ItemBlockMeta(netherGlowshroom), "nether_glowshroom", BlockNetherGlowshroom.TYPE);
Expand Down
Expand Up @@ -6,17 +6,16 @@

import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;

public class BlockNetherBerryBush extends BlockEnumBerryBush
{
public BlockNetherBerryBush(ItemStack item)
public BlockNetherBerryBush()
{
super(item);
super();

Blocks.FIRE.setFireInfo(this, 0, 0);
}
Expand Down
22 changes: 14 additions & 8 deletions src/main/java/com/progwml6/natura/overworld/NaturaOverworld.java
Expand Up @@ -5,6 +5,7 @@
import com.google.common.eventbus.Subscribe;
import com.progwml6.natura.common.CommonProxy;
import com.progwml6.natura.common.NaturaPulse;
import com.progwml6.natura.common.block.BlockEnumBerryBush;
import com.progwml6.natura.common.block.BlockNaturaDoor;
import com.progwml6.natura.common.item.ItemBlockLeaves;
import com.progwml6.natura.common.item.ItemNaturaDoor;
Expand Down Expand Up @@ -97,10 +98,10 @@ public class NaturaOverworld extends NaturaPulse
public static Block overworldStairsSakura;
public static Block overworldStairsRedwood;

public static Block overworldBerryBushRaspberry;
public static Block overworldBerryBushBlueberry;
public static Block overworldBerryBushBlackberry;
public static Block overworldBerryBushMaloberry;
public static BlockEnumBerryBush overworldBerryBushRaspberry;
public static BlockEnumBerryBush overworldBerryBushBlueberry;
public static BlockEnumBerryBush overworldBerryBushBlackberry;
public static BlockEnumBerryBush overworldBerryBushMaloberry;

public static BlockNaturaBarley barleyCrop;
public static BlockNaturaCotton cottonCrop;
Expand Down Expand Up @@ -176,10 +177,10 @@ public void registerBlocks(Register<Block> event)
overworldStairsSakura = registerBlockStairsFrom(registry, overworldPlanks, BlockOverworldPlanks.PlankType.SAKURA, "overworld_stairs_sakura");
overworldStairsRedwood = registerBlockStairsFrom(registry, overworldPlanks, BlockOverworldPlanks.PlankType.REDWOOD, "overworld_stairs_redwood");

overworldBerryBushRaspberry = registerBlock(registry, new BlockOverworldBerryBush(NaturaCommons.raspberry), "overworld_berrybush_raspberry");
overworldBerryBushBlueberry = registerBlock(registry, new BlockOverworldBerryBush(NaturaCommons.blueberry), "overworld_berrybush_blueberry");
overworldBerryBushBlackberry = registerBlock(registry, new BlockOverworldBerryBush(NaturaCommons.blackberry), "overworld_berrybush_blackberry");
overworldBerryBushMaloberry = registerBlock(registry, new BlockOverworldBerryBush(NaturaCommons.maloberry), "overworld_berrybush_maloberry");
overworldBerryBushRaspberry = registerBlock(registry, new BlockOverworldBerryBush(), "overworld_berrybush_raspberry");
overworldBerryBushBlueberry = registerBlock(registry, new BlockOverworldBerryBush(), "overworld_berrybush_blueberry");
overworldBerryBushBlackberry = registerBlock(registry, new BlockOverworldBerryBush(), "overworld_berrybush_blackberry");
overworldBerryBushMaloberry = registerBlock(registry, new BlockOverworldBerryBush(), "overworld_berrybush_maloberry");

barleyCrop = registerBlock(registry, new BlockNaturaBarley(), "barley_crop");
cottonCrop = registerBlock(registry, new BlockNaturaCotton(), "cotton_crop");
Expand Down Expand Up @@ -242,6 +243,11 @@ public void registerItems(Register<Item> event)
overworldBerryBushBlackberry = registerItemBlock(registry, overworldBerryBushBlackberry, "overworld_berrybush_blackberry");
overworldBerryBushMaloberry = registerItemBlock(registry, overworldBerryBushMaloberry, "overworld_berrybush_maloberry");

overworldBerryBushRaspberry.setItemDrop(NaturaCommons.raspberry);
overworldBerryBushBlueberry.setItemDrop(NaturaCommons.blueberry);
overworldBerryBushBlackberry.setItemDrop(NaturaCommons.blackberry);
overworldBerryBushMaloberry.setItemDrop(NaturaCommons.maloberry);

barleyCrop = registerItemBlock(registry, barleyCrop, "barley_crop");
cottonCrop = registerItemBlock(registry, cottonCrop, "cotton_crop");

Expand Down
Expand Up @@ -6,17 +6,16 @@

import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class BlockOverworldBerryBush extends BlockEnumBerryBush
{
public BlockOverworldBerryBush(ItemStack item)
public BlockOverworldBerryBush()
{
super(item);
super();

Blocks.FIRE.setFireInfo(this, 4, 25);
}
Expand Down

0 comments on commit 1c25a83

Please sign in to comment.