mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-11-20 20:22:10 +00:00
Version 1.0.2a
This commit is contained in:
1 parent
9f8b81ccd2
commit
7fe244dd1a
7 files changed
+52
-14
No files matched your search
@@ -12,6 +12,7 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiChat;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
@@ -46,7 +47,7 @@ public class HudHandler {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawHUD(RenderGameOverlayEvent.Post event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if (event.type != RenderGameOverlayEvent.ElementType.ALL || mc.gameSettings.showDebugInfo) return;
|
||||
if (event.type != RenderGameOverlayEvent.ElementType.ALL || mc.gameSettings.showDebugInfo || mc.currentScreen instanceof GuiChat) return;
|
||||
|
||||
ScaledResolution resolution = event.resolution;
|
||||
width = resolution.getScaledWidth();
|
||||
|
||||
+13
-8
@@ -7,6 +7,7 @@ import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.network.ShieldHitPacket;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.integration.ModHelper;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
@@ -76,7 +77,9 @@ public class CustomArmorHandler {
|
||||
}
|
||||
|
||||
public static void onPlayerAttacked(LivingAttackEvent event){
|
||||
EntityPlayer player = (EntityPlayer)event.entityLiving;
|
||||
float hitAmount = ModHelper.applyModDamageAdjustments(event);
|
||||
|
||||
EntityPlayer player = (EntityPlayer)event.entityLiving;
|
||||
ArmorSummery summery = new ArmorSummery().getSummery(player);
|
||||
|
||||
if (applyArmorDamageBlocking(event, summery)) return;
|
||||
@@ -84,13 +87,15 @@ public class CustomArmorHandler {
|
||||
if (summery == null || summery.protectionPoints <= 0 || event.source == ADMIN_KILL) return;
|
||||
event.setCanceled(true);
|
||||
//Ensure that the /kill command can still kill the player
|
||||
if (event.ammount == Float.MAX_VALUE && !event.source.damageType.equals(ADMIN_KILL.damageType)){
|
||||
if (hitAmount == Float.MAX_VALUE && !event.source.damageType.equals(ADMIN_KILL.damageType)){
|
||||
player.attackEntityFrom(ADMIN_KILL, Float.MAX_VALUE);
|
||||
return;
|
||||
}
|
||||
if ((float)player.hurtResistantTime > (float)player.maxHurtResistantTime / 2.0F) return;
|
||||
|
||||
float newEntropy = Math.min(summery.entropy + Math.min(2, event.ammount/5) + player.worldObj.rand.nextFloat(), 100F);
|
||||
com.brandon3055.brandonscore.common.utills.LogHelper.info(1 + (hitAmount / 10));
|
||||
|
||||
float newEntropy = Math.min(summery.entropy + 1 + (hitAmount / 20), 100F);
|
||||
|
||||
//Divide the damage between the armor peaces based on how many of the protection points each peace has
|
||||
float totalAbsorbed = 0;
|
||||
@@ -100,7 +105,7 @@ public class CustomArmorHandler {
|
||||
ItemStack armorPeace = summery.armorStacks[i];
|
||||
|
||||
float dmgShear = summery.allocation[i] / summery.protectionPoints;
|
||||
float dmg = dmgShear * event.ammount;
|
||||
float dmg = dmgShear * hitAmount;
|
||||
|
||||
float absorbed = Math.min(dmg, summery.allocation[i]);
|
||||
totalAbsorbed += absorbed;
|
||||
@@ -118,8 +123,8 @@ public class CustomArmorHandler {
|
||||
if (remainingPoints > 0) {
|
||||
player.hurtResistantTime = 20;
|
||||
}
|
||||
else if (event.ammount-totalAbsorbed > 0){
|
||||
player.attackEntityFrom(event.source, event.ammount-totalAbsorbed);
|
||||
else if (hitAmount-totalAbsorbed > 0){
|
||||
player.attackEntityFrom(event.source, hitAmount-totalAbsorbed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,11 +152,11 @@ public class CustomArmorHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (totalCharge < 5000000) return;
|
||||
if (totalCharge < 10000000) return;
|
||||
|
||||
for (int i = 0; i < summery.armorStacks.length; i++){
|
||||
if (summery.armorStacks[i] != null) {
|
||||
((IEnergyContainerItem)summery.armorStacks[i].getItem()).extractEnergy(summery.armorStacks[i], (int) ((charge[i] / (double) totalCharge) * 5000000D), false);
|
||||
((IEnergyContainerItem)summery.armorStacks[i].getItem()).extractEnergy(summery.armorStacks[i], (int) ((charge[i] / (double) totalCharge) * 10000000), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -75,6 +75,7 @@ public class DraconicDistructionStaff extends MiningTool implements IInventoryTo
|
||||
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
|
||||
entity.hurtResistantTime = 0;
|
||||
ToolHandler.damageEntityBasedOnHealth(entity, player, 0.3F);
|
||||
ToolHandler.AOEAttack(player, entity, stack, IConfigurableItem.ProfileHelper.getInteger(stack, References.ATTACK_AOE, 0));
|
||||
return true;
|
||||
|
||||
+1
@@ -84,6 +84,7 @@ public class DraconicSword extends ItemSword implements IEnergyContainerItem, II
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
entity.hurtResistantTime = 0;
|
||||
ToolHandler.AOEAttack(player, entity, stack, IConfigurableItem.ProfileHelper.getInteger(stack, References.ATTACK_AOE, 0));
|
||||
ToolHandler.damageEntityBasedOnHealth(entity, player, 0.2F);
|
||||
return true;
|
||||
|
||||
@@ -4,18 +4,21 @@ import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
|
||||
/**
|
||||
* Created by brandon3055 on 29/9/2015.
|
||||
*/
|
||||
public class ModHelper {
|
||||
|
||||
public static boolean isTConInstalled;
|
||||
private static Item cleaver;
|
||||
public static boolean isTConInstalled;
|
||||
public static boolean isAvaritiaInstalled;
|
||||
private static Item cleaver;
|
||||
private static Item avaritiaSword;
|
||||
|
||||
public static void init(){
|
||||
isTConInstalled = Loader.isModLoaded("TConstruct");
|
||||
|
||||
isAvaritiaInstalled = Loader.isModLoaded("Avaritia");
|
||||
}
|
||||
|
||||
public static boolean isHoldingCleaver(EntityPlayer player){
|
||||
@@ -25,5 +28,23 @@ public class ModHelper {
|
||||
return cleaver != null && player.getHeldItem() != null && player.getHeldItem().getItem().equals(cleaver);
|
||||
}
|
||||
|
||||
public static boolean isHoldingAvaritiaSword(EntityPlayer player){
|
||||
if (!isAvaritiaInstalled) return false;
|
||||
else if (avaritiaSword == null) avaritiaSword = GameRegistry.findItem("Avaritia", "Infinity_Sword");
|
||||
|
||||
return avaritiaSword != null && player.getHeldItem() != null && player.getHeldItem().getItem().equals(avaritiaSword);
|
||||
}
|
||||
|
||||
public static float applyModDamageAdjustments(LivingAttackEvent event){
|
||||
EntityPlayer attacker = event.source.getEntity() instanceof EntityPlayer ? (EntityPlayer) event.source.getEntity() : null;
|
||||
|
||||
if (attacker != null && isHoldingAvaritiaSword(attacker)){
|
||||
event.entityLiving.hurtResistantTime = 0;
|
||||
return 300F;
|
||||
}
|
||||
|
||||
|
||||
return event.ammount;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user