mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
Fix bonus drops on multi-block crops
This commit is contained in:
@ -87,7 +87,9 @@ public class Herbalism {
|
||||
protected static int countAndMarkDoubleDropsMultiBlockPlant(BlockState blockState, boolean triple, HerbalismManager herbalismManager) {
|
||||
Block block = blockState.getBlock();
|
||||
Material blockType = blockState.getType();
|
||||
int dropAmount = mcMMO.getPlaceStore().isTrue(block) ? 0 : 1;
|
||||
int dropAmount = 0;
|
||||
int bonusDropAmount = 0;
|
||||
int bonusAdd = triple ? 2 : 1;
|
||||
|
||||
if (blockType == Material.CHORUS_PLANT) {
|
||||
dropAmount = 1;
|
||||
@ -96,6 +98,17 @@ public class Herbalism {
|
||||
dropAmount = calculateChorusPlantDrops(block, triple, herbalismManager);
|
||||
}
|
||||
} else {
|
||||
//Check the block itself first
|
||||
if(!mcMMO.getPlaceStore().isTrue(block))
|
||||
{
|
||||
dropAmount++;
|
||||
|
||||
if(herbalismManager.checkDoubleDrop(blockState))
|
||||
bonusDropAmount+=bonusAdd;
|
||||
} else {
|
||||
mcMMO.getPlaceStore().setFalse(blockState);
|
||||
}
|
||||
|
||||
// Handle the two blocks above it - cacti & sugar cane can only grow 3 high naturally
|
||||
for (int y = 1; y < 255; y++) {
|
||||
Block relativeBlock = block.getRelative(BlockFace.UP, y);
|
||||
@ -110,11 +123,14 @@ public class Herbalism {
|
||||
dropAmount++;
|
||||
|
||||
if(herbalismManager.checkDoubleDrop(relativeBlock.getState()))
|
||||
BlockUtils.markDropsAsBonus(relativeBlock.getState(), triple);
|
||||
bonusDropAmount+=bonusAdd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Mark the original block for bonus drops
|
||||
BlockUtils.markDropsAsBonus(blockState, bonusDropAmount);
|
||||
|
||||
return dropAmount;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user