mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 02:53:43 +01:00 
			
		
		
		
	2.1.68 - You can use food in the off hand with the diet abilities now.
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
				
			|||||||
Version 2.1.68
 | 
					Version 2.1.68
 | 
				
			||||||
    Updated Japanese locale (thanks Snake)
 | 
					    Updated Japanese locale (thanks Snake)
 | 
				
			||||||
 | 
					    Fixed a bug where consuming food in the off hand did not trigger the Diet abilities
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Version 2.1.67
 | 
					Version 2.1.67
 | 
				
			||||||
    The XP bar now reflects whether or not the player is receiving the early game boost
 | 
					    The XP bar now reflects whether or not the player is receiving the early game boost
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							@@ -2,7 +2,7 @@
 | 
				
			|||||||
    <modelVersion>4.0.0</modelVersion>
 | 
					    <modelVersion>4.0.0</modelVersion>
 | 
				
			||||||
    <groupId>com.gmail.nossr50.mcMMO</groupId>
 | 
					    <groupId>com.gmail.nossr50.mcMMO</groupId>
 | 
				
			||||||
    <artifactId>mcMMO</artifactId>
 | 
					    <artifactId>mcMMO</artifactId>
 | 
				
			||||||
    <version>2.1.68-SNAPSHOT</version>
 | 
					    <version>2.1.68</version>
 | 
				
			||||||
    <name>mcMMO</name>
 | 
					    <name>mcMMO</name>
 | 
				
			||||||
    <url>https://github.com/mcMMO-Dev/mcMMO</url>
 | 
					    <url>https://github.com/mcMMO-Dev/mcMMO</url>
 | 
				
			||||||
    <scm>
 | 
					    <scm>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,6 +18,7 @@ import com.gmail.nossr50.skills.mining.MiningManager;
 | 
				
			|||||||
import com.gmail.nossr50.skills.taming.Taming;
 | 
					import com.gmail.nossr50.skills.taming.Taming;
 | 
				
			||||||
import com.gmail.nossr50.skills.taming.TamingManager;
 | 
					import com.gmail.nossr50.skills.taming.TamingManager;
 | 
				
			||||||
import com.gmail.nossr50.util.BlockUtils;
 | 
					import com.gmail.nossr50.util.BlockUtils;
 | 
				
			||||||
 | 
					import com.gmail.nossr50.util.MaterialMapStore;
 | 
				
			||||||
import com.gmail.nossr50.util.Misc;
 | 
					import com.gmail.nossr50.util.Misc;
 | 
				
			||||||
import com.gmail.nossr50.util.Permissions;
 | 
					import com.gmail.nossr50.util.Permissions;
 | 
				
			||||||
import com.gmail.nossr50.util.player.UserManager;
 | 
					import com.gmail.nossr50.util.player.UserManager;
 | 
				
			||||||
@@ -825,12 +826,24 @@ public class EntityListener implements Listener {
 | 
				
			|||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Determine which hand is eating food
 | 
				
			||||||
 | 
					        //The main hand is used over the off hand if they both have food, so check the main hand first
 | 
				
			||||||
 | 
					        Material foodInHand;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(mcMMO.getMaterialMapStore().isFood(player.getInventory().getItemInMainHand().getType())) {
 | 
				
			||||||
 | 
					            foodInHand = player.getInventory().getItemInMainHand().getType();
 | 
				
			||||||
 | 
					        } else if(mcMMO.getMaterialMapStore().isFood(player.getInventory().getItemInOffHand().getType())) {
 | 
				
			||||||
 | 
					            foodInHand = player.getInventory().getItemInOffHand().getType();
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            return; //Not Food
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*
 | 
					        /*
 | 
				
			||||||
         * Some foods have 3 ranks Some foods have 5 ranks The number of ranks
 | 
					         * Some foods have 3 ranks Some foods have 5 ranks The number of ranks
 | 
				
			||||||
         * is based on how 'common' the item is We can adjust this quite easily
 | 
					         * is based on how 'common' the item is We can adjust this quite easily
 | 
				
			||||||
         * if we find something is giving too much of a bonus
 | 
					         * if we find something is giving too much of a bonus
 | 
				
			||||||
         */
 | 
					         */
 | 
				
			||||||
        switch (player.getInventory().getItemInMainHand().getType()) {
 | 
					        switch (foodInHand) {
 | 
				
			||||||
            case BAKED_POTATO: /*
 | 
					            case BAKED_POTATO: /*
 | 
				
			||||||
                                * RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @
 | 
					                                * RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @
 | 
				
			||||||
                                * 1000
 | 
					                                * 1000
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,6 +21,7 @@ public class MaterialMapStore {
 | 
				
			|||||||
    private HashSet<String> blockCrackerWhiteList;
 | 
					    private HashSet<String> blockCrackerWhiteList;
 | 
				
			||||||
    private HashSet<String> canMakeShroomyWhiteList;
 | 
					    private HashSet<String> canMakeShroomyWhiteList;
 | 
				
			||||||
    private HashSet<String> multiBlockEntities;
 | 
					    private HashSet<String> multiBlockEntities;
 | 
				
			||||||
 | 
					    private HashSet<String> foodItemWhiteList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public MaterialMapStore()
 | 
					    public MaterialMapStore()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@@ -32,6 +33,7 @@ public class MaterialMapStore {
 | 
				
			|||||||
        blockCrackerWhiteList = new HashSet<>();
 | 
					        blockCrackerWhiteList = new HashSet<>();
 | 
				
			||||||
        canMakeShroomyWhiteList = new HashSet<>();
 | 
					        canMakeShroomyWhiteList = new HashSet<>();
 | 
				
			||||||
        multiBlockEntities = new HashSet<>();
 | 
					        multiBlockEntities = new HashSet<>();
 | 
				
			||||||
 | 
					        foodItemWhiteList = new HashSet<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        fillHardcodedHashSets();
 | 
					        fillHardcodedHashSets();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -86,6 +88,50 @@ public class MaterialMapStore {
 | 
				
			|||||||
        fillBlockCrackerWhiteList();
 | 
					        fillBlockCrackerWhiteList();
 | 
				
			||||||
        fillShroomyWhiteList();
 | 
					        fillShroomyWhiteList();
 | 
				
			||||||
        fillMultiBlockEntitiesList();
 | 
					        fillMultiBlockEntitiesList();
 | 
				
			||||||
 | 
					        fillFoodWhiteList();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private void fillFoodWhiteList() {
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("apple");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("baked_potato");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("beetroot");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("beetroot_soup");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("bread");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("cake");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("carrot");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("chorus_fruit");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("cooked_chicken");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("cooked_cod");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("cooked_mutton");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("cooked_porkchop");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("cooked_rabbit");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("cooked_salmon");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("cookie");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("dried_kelp");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("golden_apple");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("enchanted_golden_apple");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("golden_carrot");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("melon_slice");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("mushroom_stew");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("poisonous_potato");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("potato");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("pumpkin_pie");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("rabbit_stew");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("raw_beef");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("raw_chicken");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("raw_cod");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("raw_mutton");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("raw_porkchop");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("raw_rabbit");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("raw_salmon");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("rotten_flesh");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("suspicious_stew");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("sweet_berries");
 | 
				
			||||||
 | 
					        foodItemWhiteList.add("tropical_fish");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean isFood(Material material) {
 | 
				
			||||||
 | 
					        return foodItemWhiteList.contains(material.getKey().getKey());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void fillMultiBlockEntitiesList()
 | 
					    private void fillMultiBlockEntitiesList()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user