mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-29 20:24:44 +02:00
Begin trying to remove newly-deprecated "magic numbers"
This commit is contained in:
@ -103,9 +103,9 @@ public final class Woodcutting {
|
||||
else {
|
||||
Location location = blockState.getLocation();
|
||||
Tree tree = (Tree) blockState.getData();
|
||||
ItemStack item = new ItemStack(Material.LOG, 1, tree.getSpecies().getData());
|
||||
ItemStack item = tree.toItemStack(1);
|
||||
|
||||
switch (((Tree) blockState.getData()).getSpecies()) {
|
||||
switch (tree.getSpecies()) {
|
||||
case GENERIC:
|
||||
if (Config.getInstance().getOakDoubleDropsEnabled()) {
|
||||
Misc.dropItem(location, item);
|
||||
|
@ -8,7 +8,6 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.Tree;
|
||||
|
||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
@ -161,18 +160,17 @@ public class WoodcuttingManager extends SkillManager {
|
||||
Misc.randomDropItem(blockState.getLocation(), ModUtils.getCustomBlock(blockState).getItemDrop(), 10);
|
||||
}
|
||||
else {
|
||||
Tree tree = (Tree) blockState.getData();
|
||||
switch (material) {
|
||||
case LOG:
|
||||
if (canGetDoubleDrops()) {
|
||||
Woodcutting.checkForDoubleDrop(blockState);
|
||||
}
|
||||
xp += Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.TREE_FELLER);
|
||||
Misc.dropItem(blockState.getLocation(), new ItemStack(Material.LOG, 1, tree.getSpecies().getData()));
|
||||
Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack(1));
|
||||
break;
|
||||
|
||||
case LEAVES:
|
||||
Misc.randomDropItem(blockState.getLocation(), new ItemStack(Material.SAPLING, 1, tree.getSpecies().getData()), 10);
|
||||
Misc.randomDropItem(blockState.getLocation(), blockState.getData().toItemStack(1), 10);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -180,7 +178,6 @@ public class WoodcuttingManager extends SkillManager {
|
||||
}
|
||||
}
|
||||
|
||||
blockState.setRawData((byte) 0x0);
|
||||
blockState.setType(Material.AIR);
|
||||
blockState.update(true);
|
||||
}
|
||||
|
Reference in New Issue
Block a user