|
|
|
@ -19,6 +19,7 @@ import net.minecraft.item.*;
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
import net.minecraft.nbt.NBTTagList;
|
|
|
|
import net.minecraft.nbt.NBTTagList;
|
|
|
|
import net.minecraft.nbt.NBTTagString;
|
|
|
|
import net.minecraft.nbt.NBTTagString;
|
|
|
|
|
|
|
|
import net.minecraft.network.play.server.S19PacketEntityStatus;
|
|
|
|
import net.minecraft.potion.Potion;
|
|
|
|
import net.minecraft.potion.Potion;
|
|
|
|
import net.minecraft.potion.PotionEffect;
|
|
|
|
import net.minecraft.potion.PotionEffect;
|
|
|
|
import net.minecraft.util.ChatComponentText;
|
|
|
|
import net.minecraft.util.ChatComponentText;
|
|
|
|
@ -92,10 +93,11 @@ public class CinderEventHandler implements IFuelHandler {
|
|
|
|
EntityLivingBase attacker = event.source.getEntity() instanceof EntityLivingBase ? (EntityLivingBase) event.source.getEntity() : null;
|
|
|
|
EntityLivingBase attacker = event.source.getEntity() instanceof EntityLivingBase ? (EntityLivingBase) event.source.getEntity() : null;
|
|
|
|
World world = entity.worldObj;
|
|
|
|
World world = entity.worldObj;
|
|
|
|
DamageSource source = event.source;
|
|
|
|
DamageSource source = event.source;
|
|
|
|
if (event.entity instanceof EntityPlayer && !source.isUnblockable()) {
|
|
|
|
if (event.entity instanceof EntityPlayer && !source.isUnblockable() || event.entity instanceof EntityPlayer && !source.isExplosion()) {
|
|
|
|
EntityPlayerMP player = (EntityPlayerMP) event.entity;
|
|
|
|
EntityPlayerMP player = (EntityPlayerMP) event.entity;
|
|
|
|
ItemStack sword = player.getHeldItem();
|
|
|
|
ItemStack sword = player.getHeldItem();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float playerYaw = player.getRotationYawHead();
|
|
|
|
float playerYaw = player.getRotationYawHead();
|
|
|
|
float attackerYaw = attacker.getRotationYawHead();
|
|
|
|
float attackerYaw = attacker.getRotationYawHead();
|
|
|
|
|
|
|
|
|
|
|
|
@ -115,16 +117,19 @@ public class CinderEventHandler implements IFuelHandler {
|
|
|
|
|
|
|
|
|
|
|
|
float additionalDamage = 0.0f;
|
|
|
|
float additionalDamage = 0.0f;
|
|
|
|
if (weapon.getItem() instanceof ItemAxe || weapon.getItem() instanceof LOTRItemAxe || weapon.getItem() instanceof LOTRItemBattleaxe) {
|
|
|
|
if (weapon.getItem() instanceof ItemAxe || weapon.getItem() instanceof LOTRItemAxe || weapon.getItem() instanceof LOTRItemBattleaxe) {
|
|
|
|
sword.damageItem((int) event.ammount, player);
|
|
|
|
sword.damageItem((int) (event.ammount *1.5), player); // Axes deal 150% the Durability damage
|
|
|
|
|
|
|
|
((EntityPlayerMP) player).playerNetServerHandler.sendPacket(new S19PacketEntityStatus(player, (byte) 29));
|
|
|
|
world.playSoundAtEntity(player, "random.anvil_land", 1F, 2F);
|
|
|
|
world.playSoundAtEntity(player, "random.anvil_land", 1F, 2F);
|
|
|
|
additionalDamage = 0.75f;
|
|
|
|
additionalDamage = 0.75f;
|
|
|
|
} else if (weapon.getItem() instanceof LOTRItemHammer) {
|
|
|
|
} else if (weapon.getItem() instanceof LOTRItemHammer) {
|
|
|
|
sword.damageItem((int) event.ammount, player);
|
|
|
|
sword.damageItem((int) event.ammount, player); // Hammers bypass the block better, but only deal 100% of the durability damage
|
|
|
|
|
|
|
|
((EntityPlayerMP) player).playerNetServerHandler.sendPacket(new S19PacketEntityStatus(player, (byte) 29));
|
|
|
|
world.playSoundAtEntity(player, "random.anvil_land", 1F, 2F);
|
|
|
|
world.playSoundAtEntity(player, "random.anvil_land", 1F, 2F);
|
|
|
|
additionalDamage = 0.5f; // 20% more damage per piece
|
|
|
|
additionalDamage = 0.5f; // 20% more damage per piece
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
additionalDamage = 0.0f;
|
|
|
|
additionalDamage = 0.0f;
|
|
|
|
sword.damageItem((int) event.ammount, player);
|
|
|
|
sword.damageItem((int) (event.ammount/2), player); //Swords only deal 50% of durability damage
|
|
|
|
|
|
|
|
((EntityPlayerMP) player).playerNetServerHandler.sendPacket(new S19PacketEntityStatus(player, (byte) 29));
|
|
|
|
world.playSoundAtEntity(player, "random.anvil_land", 1F, 2F);
|
|
|
|
world.playSoundAtEntity(player, "random.anvil_land", 1F, 2F);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|