mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-10-26 14:24:22 +00:00
Merge branch 'master' of github.com:williewillus/Botania
This commit is contained in:
commit
88f99a636c
2 files changed
+44
No files matched your search
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* This class was created by <Flaxbeard>. 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 @ [Jul 25, 2016, 9:02:12 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
public class ManaDiscountEvent extends Event {
|
||||
|
||||
private final EntityPlayer entityPlayer;
|
||||
private float discount;
|
||||
|
||||
public ManaDiscountEvent(EntityPlayer entityPlayer, float discount) {
|
||||
this.entityPlayer = entityPlayer;
|
||||
this.discount = discount;
|
||||
}
|
||||
|
||||
public EntityPlayer getEntityPlayer() {
|
||||
return entityPlayer;
|
||||
}
|
||||
|
||||
public float getDiscount() {
|
||||
return discount;
|
||||
}
|
||||
|
||||
public void setDiscount(float discount) {
|
||||
this.discount = discount;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ package vazkii.botania.api.mana;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
public final class ManaItemHandler {
|
||||
@@ -249,6 +250,10 @@ public final class ManaItemHandler {
|
||||
if(armor != null && armor.getItem() instanceof IManaDiscountArmor)
|
||||
discount += ((IManaDiscountArmor) armor.getItem()).getDiscount(armor, i, player);
|
||||
}
|
||||
|
||||
ManaDiscountEvent event = new ManaDiscountEvent(player, discount);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
discount = event.getDiscount();
|
||||
|
||||
return discount;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user