Fixed errors with block-based skill experience (#3506)

* Updated configs

* [WIP] Replacing MaterialData with Blockdata

* Fixed most block based experience gain

* Fixed most block based experience gain & updated wooden_tools

* Removed debug prints
This commit is contained in:
Shane Robertson
2018-07-26 18:53:29 -05:00
committed by t00thpick1
parent 210b418e44
commit ee324c77a9
29 changed files with 211 additions and 165 deletions

View File

@@ -6,6 +6,7 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Misc;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.inventory.ItemStack;
public class Mining {
@@ -15,7 +16,7 @@ public class Mining {
* @param blockState The {@link BlockState} to check ability activation for
*/
public static int getBlockXp(BlockState blockState) {
int xp = ExperienceConfig.getInstance().getXp(SkillType.MINING, blockState.getData());
int xp = ExperienceConfig.getInstance().getXp(SkillType.MINING, blockState.getBlockData());
if (xp == 0 && mcMMO.getModManager().isCustomMiningBlock(blockState)) {
xp = mcMMO.getModManager().getBlock(blockState).getXpGain();
@@ -86,12 +87,12 @@ public class Mining {
case REDSTONE_ORE:
case STONE:
case PRISMARINE:
Misc.dropItem(Misc.getBlockCenter(blockState), blockState.getData().toItemStack(1));
Misc.dropItem(Misc.getBlockCenter(blockState), new ItemStack(blockState.getType()));
return;
default:
if (mcMMO.getModManager().isCustomMiningBlock(blockState)) {
Misc.dropItem(Misc.getBlockCenter(blockState), blockState.getData().toItemStack(1));
Misc.dropItem(Misc.getBlockCenter(blockState), new ItemStack(blockState.getType()));
}
return;
}

View File

@@ -16,6 +16,7 @@ import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.SkillUtils;
import org.bukkit.inventory.ItemStack;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
@@ -146,7 +147,7 @@ public class MiningManager extends SkillManager {
xp += Mining.getBlockXp(blockState);
}
Misc.dropItem(Misc.getBlockCenter(blockState), blockState.getData().toItemStack(1)); // Initial block that would have been dropped
Misc.dropItem(Misc.getBlockCenter(blockState), new ItemStack(blockState.getType())); // Initial block that would have been dropped
if (!mcMMO.getPlaceStore().isTrue(blockState)) {
for (int i = 1; i < dropMultiplier; i++) {