mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-13 17:04:24 +00:00
Remove the resizing for perfect dodge and add a 10% chance to dodge projectiles instead
This commit is contained in:
1 parent
7f87feaa0f
commit
08bdb0789a
2 files changed
+22
-33
No files matched your search
@@ -5,6 +5,7 @@ import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import net.minecraft.entity.boss.*;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.event.entity.living.*;
|
||||
@@ -103,4 +104,25 @@ public class TinkerArmorEvents
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void perfectDodge(LivingAttackEvent event)
|
||||
{
|
||||
if(!event.source.isProjectile())
|
||||
return;
|
||||
|
||||
// perfect dodge?
|
||||
if(!(event.entityLiving instanceof EntityPlayer))
|
||||
return;
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
ItemStack chest = player.getCurrentArmor(2);
|
||||
if(chest == null || !(chest.getItem() instanceof IModifyable) || !chest.hasTagCompound())
|
||||
return;
|
||||
|
||||
NBTTagCompound tags = chest.getTagCompound().getCompoundTag(((IModifyable) chest.getItem()).getBaseTagName());
|
||||
int dodge = tags.getInteger("Perfect Dodge");
|
||||
if(dodge > TConstruct.random.nextInt(10))
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user