From 5157c646f7a85e2ce06d5e6cafd09847042f4548 Mon Sep 17 00:00:00 2001 From: Flaxbeard Date: Tue, 4 Oct 2016 22:26:17 -0500 Subject: [PATCH] Revert "Added ManaProficiencyEvent and reworked IManaProficiencyArmor to work on a per-rod basis" This reverts commit 504187dc5da7ad5fdacb32167f7937576f71652c. --- .../api/item/IManaProficiencyArmor.java | 32 ++---------- .../api/mana/ManaProficiencyEvent.java | 49 ------------------- 2 files changed, 4 insertions(+), 77 deletions(-) delete mode 100644 src/main/java/vazkii/botania/api/mana/ManaProficiencyEvent.java diff --git a/src/main/java/vazkii/botania/api/item/IManaProficiencyArmor.java b/src/main/java/vazkii/botania/api/item/IManaProficiencyArmor.java index 31890976d..82f8bcd17 100644 --- a/src/main/java/vazkii/botania/api/item/IManaProficiencyArmor.java +++ b/src/main/java/vazkii/botania/api/item/IManaProficiencyArmor.java @@ -10,14 +10,10 @@ */ package vazkii.botania.api.item; -import javax.annotation.Nullable; - -import vazkii.botania.api.mana.ManaProficiencyEvent; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.MinecraftForge; /** * An armor item that implements this gives the player wearing it mana proficiency, by @@ -28,42 +24,22 @@ import net.minecraftforge.common.MinecraftForge; */ public interface IManaProficiencyArmor { - @Deprecated - default boolean shouldGiveProficiency(ItemStack armorStack, EntityEquipmentSlot slot, EntityPlayer player) { - return false; - } - - default boolean shouldGiveProficiency(ItemStack armorStack, EntityEquipmentSlot slot, EntityPlayer player, @Nullable ItemStack rod) { - return shouldGiveProficiency(armorStack, slot, player); - } + public boolean shouldGiveProficiency(ItemStack stack, EntityEquipmentSlot slot, EntityPlayer player); public final static class Helper { - @Deprecated public static boolean hasProficiency(EntityPlayer player) { - return hasProficiency(player, null); - } - - public static boolean hasProficiency(EntityPlayer player, @Nullable ItemStack rod) { - boolean proficient = false; - for(EntityEquipmentSlot e: EntityEquipmentSlot.values()) { if(e.getSlotType() != EntityEquipmentSlot.Type.ARMOR) continue; ItemStack armor = player.getItemStackFromSlot(e); if(armor != null) { Item item = armor.getItem(); - if(item instanceof IManaProficiencyArmor && ((IManaProficiencyArmor) item).shouldGiveProficiency(armor, e, player, rod)) { - proficient = true; - break; - } + if(item instanceof IManaProficiencyArmor && ((IManaProficiencyArmor) item).shouldGiveProficiency(armor, e, player)) + return true; } } - - ManaProficiencyEvent event = new ManaProficiencyEvent(player, rod, proficient); - MinecraftForge.EVENT_BUS.post(event); - - return event.isProficient(); + return false; } } diff --git a/src/main/java/vazkii/botania/api/mana/ManaProficiencyEvent.java b/src/main/java/vazkii/botania/api/mana/ManaProficiencyEvent.java deleted file mode 100644 index 0600c7b98..000000000 --- a/src/main/java/vazkii/botania/api/mana/ManaProficiencyEvent.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * This class was created by . It's distributed as - * part of the Botania Mod. Get the Source Code in github: - * https://github.com/Vazkii/Botania - * - * Botania is Open Source and distributed under the - * Botania License: http://botaniamod.net/license.php - * - * File Created @ [Oct 4, 2016, 10:46:12 PM (GMT)] - */ -package vazkii.botania.api.mana; - -import java.util.List; - -import javax.annotation.Nullable; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.common.eventhandler.Event; - -public class ManaProficiencyEvent extends Event { - - private final EntityPlayer entityPlayer; - private ItemStack rod; - private boolean proficient; - - public ManaProficiencyEvent(EntityPlayer entityPlayer, @Nullable ItemStack rod, boolean proficient) { - this.entityPlayer = entityPlayer; - this.rod = rod; - this.proficient = proficient; - } - - public EntityPlayer getEntityPlayer() { - return entityPlayer; - } - - @Nullable - public ItemStack getRod() { - return rod; - } - - public boolean isProficient() { - return proficient; - } - - public void setProficient(boolean proficient) { - this.proficient = proficient; - } -}