Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Short and tall grass now drops thatch based on age, Closes #407.
  • Loading branch information
DisasterMoo committed Sep 11, 2019
1 parent fa525b6 commit 152acae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Expand Up @@ -28,6 +28,7 @@
import net.minecraft.world.World;
import net.minecraftforge.common.IShearable;

import net.dries007.tfc.Constants;
import net.dries007.tfc.api.types.Plant;
import net.dries007.tfc.objects.items.ItemsTFC;
import net.dries007.tfc.util.climate.ClimateTFC;
Expand Down Expand Up @@ -61,7 +62,10 @@ public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBloc
}
else if (!worldIn.isRemote && stack.getItem().getHarvestLevel(stack, "knife", player, state) != -1 || stack.getItem().getHarvestLevel(stack, "scythe", player, state) != -1)
{
spawnAsEntity(worldIn, pos, new ItemStack(ItemsTFC.STRAW, 1));
if (Constants.RNG.nextDouble() <= (state.getValue(AGE) + 1) / 4.0D) //+25% change for each age
{
spawnAsEntity(worldIn, pos, new ItemStack(ItemsTFC.STRAW, 1));
}
}
super.harvestBlock(worldIn, player, pos, state, te, stack);
}
Expand Down
Expand Up @@ -27,6 +27,7 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

import net.dries007.tfc.Constants;
import net.dries007.tfc.api.types.Plant;
import net.dries007.tfc.objects.blocks.property.ITallPlant;
import net.dries007.tfc.objects.items.ItemsTFC;
Expand Down Expand Up @@ -143,7 +144,10 @@ public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, Ent
{
for (int i = 1; worldIn.getBlockState(pos.up(i)).getBlock() == this; ++i)
{
spawnAsEntity(worldIn, pos, new ItemStack(ItemsTFC.STRAW, 1));
if (Constants.RNG.nextDouble() <= (worldIn.getBlockState(pos.up(i)).getValue(AGE) + 1) / 4.0D) //+25% change for each age
{
spawnAsEntity(worldIn, pos, new ItemStack(ItemsTFC.STRAW, 1));
}
}
}
}
Expand Down

0 comments on commit 152acae

Please sign in to comment.