Huge Mushrooms now work for Tree Feller (UNTESTED)

This commit is contained in:
nossr50
2013-02-15 15:32:49 -08:00
parent c1b12c027a
commit 9df149c489
8 changed files with 52 additions and 2 deletions

View File

@ -175,6 +175,35 @@ public final class TreeFeller {
}
switch (block.getType()) {
case HUGE_MUSHROOM_1:
case HUGE_MUSHROOM_2:
Woodcutting.checkForDoubleDrop(mcMMOPlayer, block);
try {
xp += Woodcutting.getExperienceFromLog(block, ExperienceGainMethod.TREE_FELLER);
}
catch (IllegalArgumentException exception) {
break;
}
//Stems have a block data value of 15 and should not drop mushrooms
//0-2 mushrooms drop when you break a block
if(block.getData() != (byte) 15) {
switch(block.getType()) {
case HUGE_MUSHROOM_1:
Misc.randomDropItem(block.getLocation(), new ItemStack(Material.BROWN_MUSHROOM, 1), 50);
Misc.randomDropItem(block.getLocation(), new ItemStack(Material.BROWN_MUSHROOM, 1), 50);
break;
case HUGE_MUSHROOM_2:
Misc.randomDropItem(block.getLocation(), new ItemStack(Material.RED_MUSHROOM, 1), 50);
Misc.randomDropItem(block.getLocation(), new ItemStack(Material.RED_MUSHROOM, 1), 50);
break;
default:
break;
}
}
break;
case LOG:
Woodcutting.checkForDoubleDrop(mcMMOPlayer, block);

View File

@ -93,6 +93,19 @@ public final class Woodcutting {
* @throws IllegalArgumentException if 'log' is invalid
*/
protected static int getExperienceFromLog(Block log, ExperienceGainMethod experienceGainMethod) {
//Mushrooms aren't trees so we could never get species data from them
if(log.getType() == Material.HUGE_MUSHROOM_1 || log.getType() == Material.HUGE_MUSHROOM_2) {
switch(log.getType()) {
case HUGE_MUSHROOM_1:
return Config.getInstance().getWoodcuttingXPHugeBrownMushroom();
case HUGE_MUSHROOM_2:
return Config.getInstance().getWoodcuttingXPHugeRedMushroom();
default:
throw new IllegalArgumentException();
}
}
TreeSpecies logType = TreeSpecies.getByData(extractLogItemData(log.getData()));
// Apparently species can be null in certain cases (custom server mods?)