mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 11:03:43 +01:00 
			
		
		
		
	Added options to experience.yml for Dirt and Sand variations
Adds #2194
This commit is contained in:
		@@ -14,6 +14,7 @@ Version 1.5.01-dev
 | 
				
			|||||||
 + Added new feature to Herbalism. Instantly-regrown crops are protected from being broken for 1 second
 | 
					 + Added new feature to Herbalism. Instantly-regrown crops are protected from being broken for 1 second
 | 
				
			||||||
 + Added option to config.yml to show the /mcstats scoreboard automatically after logging in
 | 
					 + Added option to config.yml to show the /mcstats scoreboard automatically after logging in
 | 
				
			||||||
 + Added option to config.yml for Alchemy. Skills.Alchemy.Prevent_Hopper_Transfer_Bottles
 | 
					 + Added option to config.yml for Alchemy. Skills.Alchemy.Prevent_Hopper_Transfer_Bottles
 | 
				
			||||||
 | 
					 + Added options to experience.yml for Dirt and Sand variations
 | 
				
			||||||
 + Added support for `MATERIAL|data` format in treasures.yml
 | 
					 + Added support for `MATERIAL|data` format in treasures.yml
 | 
				
			||||||
 + Added API to experience events to get XP gain reason
 | 
					 + Added API to experience events to get XP gain reason
 | 
				
			||||||
 + Added API to check if an entity is bleeding
 | 
					 + Added API to check if an entity is bleeding
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -207,6 +207,41 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
 | 
				
			|||||||
    /* Alchemy */
 | 
					    /* Alchemy */
 | 
				
			||||||
    public double getPotionXP(PotionStage stage) { return config.getDouble("Experience.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D); }
 | 
					    public double getPotionXP(PotionStage stage) { return config.getDouble("Experience.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* Excavation */
 | 
				
			||||||
 | 
					    public int getDirtAndSandXp(MaterialData data) {
 | 
				
			||||||
 | 
					        Material type = data.getItemType();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (type == Material.DIRT) {
 | 
				
			||||||
 | 
					            switch (data.getData()) {
 | 
				
			||||||
 | 
					                case 0x0:
 | 
				
			||||||
 | 
					                    return config.getInt("Experience.Excavation.Dirt", 40);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                case 0x1:
 | 
				
			||||||
 | 
					                    return config.getInt("Experience.Excavation.Coarse_Dirt", 40);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                case 0x2:
 | 
				
			||||||
 | 
					                    return config.getInt("Experience.Excavation.Podzol", 40);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                default:
 | 
				
			||||||
 | 
					                    return 0;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else if (type == Material.SAND) {
 | 
				
			||||||
 | 
					            switch (data.getData()) {
 | 
				
			||||||
 | 
					                case 0x0:
 | 
				
			||||||
 | 
					                    return config.getInt("Experience.Excavation.Sand", 40);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                case 0x1:
 | 
				
			||||||
 | 
					                    return config.getInt("Experience.Excavation.Red_Sand", 40);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                default:
 | 
				
			||||||
 | 
					                    return 0;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return 0;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Fishing */
 | 
					    /* Fishing */
 | 
				
			||||||
    public int getFishXp(MaterialData data) {
 | 
					    public int getFishXp(MaterialData data) {
 | 
				
			||||||
        switch (data.getData()) {
 | 
					        switch (data.getData()) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,7 @@ package com.gmail.nossr50.skills.excavation;
 | 
				
			|||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.bukkit.Material;
 | 
				
			||||||
import org.bukkit.block.BlockState;
 | 
					import org.bukkit.block.BlockState;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.gmail.nossr50.mcMMO;
 | 
					import com.gmail.nossr50.mcMMO;
 | 
				
			||||||
@@ -50,7 +51,15 @@ public class Excavation {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected static int getBlockXP(BlockState blockState) {
 | 
					    protected static int getBlockXP(BlockState blockState) {
 | 
				
			||||||
        int xp = ExperienceConfig.getInstance().getXp(SkillType.EXCAVATION, blockState.getType());
 | 
					        Material material = blockState.getType();
 | 
				
			||||||
 | 
					        int xp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (material == Material.DIRT || material == Material.SAND) {
 | 
				
			||||||
 | 
					            xp = ExperienceConfig.getInstance().getDirtAndSandXp(blockState.getData());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else {
 | 
				
			||||||
 | 
					            xp = ExperienceConfig.getInstance().getXp(SkillType.EXCAVATION, material);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (xp == 0 && mcMMO.getModManager().isCustomExcavationBlock(blockState)) {
 | 
					        if (xp == 0 && mcMMO.getModManager().isCustomExcavationBlock(blockState)) {
 | 
				
			||||||
            xp = mcMMO.getModManager().getBlock(blockState).getXpGain();
 | 
					            xp = mcMMO.getModManager().getBlock(blockState).getXpGain();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -100,10 +100,13 @@ Experience:
 | 
				
			|||||||
    Excavation:
 | 
					    Excavation:
 | 
				
			||||||
        Clay: 40
 | 
					        Clay: 40
 | 
				
			||||||
        Dirt: 40
 | 
					        Dirt: 40
 | 
				
			||||||
 | 
					        Coarse_Dirt: 40
 | 
				
			||||||
 | 
					        Podzol: 40
 | 
				
			||||||
        Grass: 40
 | 
					        Grass: 40
 | 
				
			||||||
        Gravel: 40
 | 
					        Gravel: 40
 | 
				
			||||||
        Mycel: 40
 | 
					        Mycel: 40
 | 
				
			||||||
        Sand: 40
 | 
					        Sand: 40
 | 
				
			||||||
 | 
					        Red_Sand: 40
 | 
				
			||||||
        Snow: 20
 | 
					        Snow: 20
 | 
				
			||||||
        Snow_Block: 40
 | 
					        Snow_Block: 40
 | 
				
			||||||
        Soul_Sand: 40
 | 
					        Soul_Sand: 40
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user