mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
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:

committed by
t00thpick1

parent
210b418e44
commit
ee324c77a9
@ -112,18 +112,22 @@ public class HerbalismManager extends SkillManager {
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
*/
|
||||
public void herbalismBlockCheck(BlockState blockState) {
|
||||
System.out.print(">>1");
|
||||
Player player = getPlayer();
|
||||
Material material = blockState.getType();
|
||||
boolean oneBlockPlant = !(material == Material.CACTUS || material == Material.CHORUS_PLANT || material == Material.SUGAR_CANE);
|
||||
|
||||
// Prevents placing and immediately breaking blocks for exp
|
||||
if (oneBlockPlant && mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||
System.out.print(">>1.5");
|
||||
return;
|
||||
}
|
||||
System.out.print(">>2");
|
||||
|
||||
if (!canBlockCheck()) {
|
||||
return;
|
||||
}
|
||||
System.out.print(">>3");
|
||||
|
||||
Collection<ItemStack> drops = null;
|
||||
int amount = 1;
|
||||
@ -131,6 +135,7 @@ public class HerbalismManager extends SkillManager {
|
||||
boolean greenTerra = mcMMOPlayer.getAbilityMode(skill.getAbility());
|
||||
|
||||
if (mcMMO.getModManager().isCustomHerbalismBlock(blockState)) {
|
||||
System.out.print(">>4");
|
||||
CustomBlock customBlock = mcMMO.getModManager().getBlock(blockState);
|
||||
xp = customBlock.getXpGain();
|
||||
|
||||
@ -139,28 +144,34 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
}
|
||||
else {
|
||||
System.out.print(">>5");
|
||||
if(material == Material.CHORUS_FLOWER && blockState.getRawData() != 5) {
|
||||
return;
|
||||
}
|
||||
xp = ExperienceConfig.getInstance().getXp(skill, blockState.getData());
|
||||
xp = ExperienceConfig.getInstance().getXp(skill, blockState.getBlockData());
|
||||
|
||||
if (Config.getInstance().getDoubleDropsEnabled(skill, material) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS)) {
|
||||
drops = blockState.getBlock().getDrops();
|
||||
System.out.print(">>6");
|
||||
}
|
||||
|
||||
if (!oneBlockPlant) {
|
||||
System.out.print(">>7");
|
||||
amount = Herbalism.calculateMultiBlockPlantDrops(blockState);
|
||||
xp *= amount;
|
||||
}
|
||||
|
||||
if (Permissions.greenThumbPlant(player, material)) {
|
||||
System.out.print(">>8");
|
||||
processGreenThumbPlants(blockState, greenTerra);
|
||||
}
|
||||
}
|
||||
System.out.print(">>9");
|
||||
|
||||
applyXpGain(xp, XPGainReason.PVE);
|
||||
|
||||
if (drops == null) {
|
||||
System.out.print(">>10");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -199,7 +210,7 @@ public class HerbalismManager extends SkillManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
String friendly = StringUtils.getFriendlyConfigMaterialDataString(blockState.getData());
|
||||
String friendly = StringUtils.getFriendlyConfigBlockDataString(blockState.getBlockData());
|
||||
if (!TreasureConfig.getInstance().hylianMap.containsKey(friendly))
|
||||
return false;
|
||||
List<HylianTreasure> treasures = TreasureConfig.getInstance().hylianMap.get(friendly);
|
||||
@ -320,11 +331,11 @@ public class HerbalismManager extends SkillManager {
|
||||
|
||||
switch (blockState.getType()) {
|
||||
|
||||
case POTATO:
|
||||
case CARROT:
|
||||
case POTATOES:
|
||||
case CARROTS:
|
||||
case BEETROOTS:
|
||||
case WHEAT:
|
||||
Crops crops = (Crops) blockState.getData();
|
||||
Crops crops = (Crops) blockState.getBlockData();
|
||||
|
||||
if (greenTerra) {
|
||||
crops.setState(CropState.MEDIUM);
|
||||
@ -349,7 +360,7 @@ public class HerbalismManager extends SkillManager {
|
||||
return true;
|
||||
|
||||
case NETHER_WART_BLOCK:
|
||||
NetherWarts warts = (NetherWarts) blockState.getData();
|
||||
NetherWarts warts = (NetherWarts) blockState.getBlockData();
|
||||
|
||||
if (greenTerra || greenThumbStage > 2) {
|
||||
warts.setState(NetherWartsState.STAGE_TWO);
|
||||
@ -364,7 +375,7 @@ public class HerbalismManager extends SkillManager {
|
||||
return true;
|
||||
|
||||
case COCOA:
|
||||
CocoaPlant plant = (CocoaPlant) blockState.getData();
|
||||
CocoaPlant plant = (CocoaPlant) blockState.getBlockData();
|
||||
|
||||
if (greenTerra || getGreenThumbStage() > 1) {
|
||||
plant.setSize(CocoaPlantSize.MEDIUM);
|
||||
|
Reference in New Issue
Block a user