Fixed sideway logs handling

This commit is contained in:
bm01 2013-01-22 23:44:53 +01:00
parent 69475f92c7
commit ee91ed8708
2 changed files with 9 additions and 7 deletions

View File

@ -188,8 +188,6 @@ public abstract class TreeFeller {
case LOG:
Woodcutting.checkDoubleDrop(player, block);
byte extraData = block.getData();
try {
xp += Woodcutting.getExperienceFromLog(block);
}
@ -199,7 +197,7 @@ public abstract class TreeFeller {
// TODO: Nerf XP from jungle trees, as it was done previously
Misc.dropItem(block.getLocation(), new ItemStack(Material.LOG, 1, extraData));
Misc.dropItem(block.getLocation(), new ItemStack(Material.LOG, 1, block.getData()));
break;
case LEAVES:
Misc.randomDropItem(block.getLocation(), new ItemStack(Material.LOG, 1, (short) (block.getData() & 3)), 10);

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.skills.woodcutting;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.TreeSpecies;
@ -84,7 +85,10 @@ public abstract class Woodcutting {
* @throws IllegalArgumentException if 'log' is invalid
*/
protected static int getExperienceFromLog(Block log) {
TreeSpecies logType = TreeSpecies.getByData(log.getData());
byte data = log.getData();
Bukkit.getLogger().info(Integer.toHexString(data));
TreeSpecies logType = TreeSpecies.getByData((byte) (log.getData() & 0x3));
// Apparently species can be null in certain cases (custom server mods?)
// https://github.com/mcMMO-Dev/mcMMO/issues/229
@ -142,11 +146,11 @@ public abstract class Woodcutting {
}
}
else {
byte extraData = block.getData();
byte blockData = block.getData();
Location location = block.getLocation();
ItemStack item = new ItemStack(Material.LOG, 1, extraData);
ItemStack item = new ItemStack(Material.LOG, 1, blockData);
switch (TreeSpecies.getByData(extraData)) {
switch (TreeSpecies.getByData((byte) (blockData & 0x3))) {
case GENERIC:
if (Config.getInstance().getOakDoubleDropsEnabled()) {
Misc.dropItem(location, item);