diff --git a/README.md b/README.md index bd9c55b..3c5e98a 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,29 @@ ### Beta Food Advanced v1.3.0 Beta Food Advanced is a Minecraft Bukkit/Spigot/Paper plugin which reintroduces the beta food mechanics that were removed in Beta 1.8; Prior to this update, using food would directly heals health. BFA tries to bring this back - or atleast imitate it! Get it here: https://www.spigotmc.org/resources/beta-food-advanced.99622/ +### Benefits +- Only eat when you take damage. +- Customizable config. +- Custom resource pack that can be enforced or not. +- Relive your nostalgic memories +- You can call yourself an OG (Cool guy basically, get all the women). + ### To Do -- Enforce an configurable Server Resourcepack which removes the food icons all together. (DONE) +- Enforce an configurable Server resource pack which removes the food icons all together. (DONE) -### Simple explaination -BFA disables the player's food level from changing, upon eating any food item; the nutrition value is taken and applied directly to health, rendering hunger useless. I plan on creating a server resourcepack to remove the texture alltogether :) - -### The boring explaination +### Simple explanation +BetaFoodAdvanced removes the usage of the "Hunger bar" replacing it with a system that uses the health bar. On a player eating, the "nutrition value" that is gained is added directly to health. +### The boring explanation BFA is a fairly simple concept; we stop the player from being able to increase thier FoodLevel; this is done like this: ```java - @EventHandler - public void onPlayerEat(PlayerItemConsumeEvent event) { +@EventHandler +public void onPlayerEat(PlayerItemConsumeEvent event) { Player player = event.getPlayer(); + double maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue(); // Keep Player Food intact. Bukkit.getScheduler().runTaskLater(main, () -> { - player.setFoodLevel(8); // 4 food bars - - player.setHealth(player.getHealth() + (lm.get(event.getItem().getType().name().toUpperCase())) * 4); // Multiplying by 4 cus it is half steps. - }, 1); - - } + player.setFoodLevel(8); // 4 food bars + ..... ``` -A similar function is integrated for other events such as; PlayerRespawnEvent, PlayerJoinEvent, PlayerInteractEvent (used for cake). `setFoodLevel(8)` is used to set the FoodLevel to 8 (4 whole icons); the viable FoodLevel - low enough that you do not regenerate, yet high enough so you can sprint. We get the Nutrition Value from a HashMap (I could use NMS, but I couldn't get 'FoodItem' for some reason). +A similar function is integrated for other events such as; PlayerRespawnEvent, PlayerJoinEvent, PlayerInteractEvent (used for cake). `setFoodLevel(8)` is used to set the FoodLevel to 8 (4 whole icons); the viable FoodLevel - low enough that you do not regenerate, yet high enough so you can sprint. We get the Nutrition Value from a HashMap; I don't use NMS, because we all know it's **Shit**. diff --git a/src/main/java/me/eccentrici/betafood/events/OnEat.java b/src/main/java/me/eccentrici/betafood/events/OnEat.java index 3ddb01c..019b6e2 100644 --- a/src/main/java/me/eccentrici/betafood/events/OnEat.java +++ b/src/main/java/me/eccentrici/betafood/events/OnEat.java @@ -22,7 +22,7 @@ public class OnEat implements Listener { public OnEat(Main main) { this.main = main; - // Manually defining them in a HashMap. NMS wasn't working sadly. + // Manually defining them in a HashMap. lm.put("beetroot", 1); lm.put("dried_kelp", 1); lm.put("potato", 1);