mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-11-20 20:22:10 +00:00
... i can never think of messages for these things...
This commit is contained in:
1 parent
fdff8aeac7
commit
e277abb322
14 files changed
+562
-291
No files matched your search
@@ -119,6 +119,7 @@ public class GuiHudConfig extends GuiScreen {
|
||||
drawCenteredString(fontRendererObj, StatCollector.translateToLocal("gui.de.configureGuiElements.txt"), width/2, height/2-90, 0x00FFFF);
|
||||
drawCenteredString(fontRendererObj, StatCollector.translateToLocal("gui.de.hudDisplaySettings.txt"), width/2, height/2-77, 0xFFFFFF);
|
||||
drawCenteredString(fontRendererObj, StatCollector.translateToLocal("gui.de.shieldDisplaySettings.txt"), width/2, height/2-15, 0xFFFFFF);
|
||||
drawCenteredString(fontRendererObj, StatCollector.translateToLocal("gui.de.clickAndDragPurpleBoxes.txt"), width/2, height/2+85, 0xFFFFFF);
|
||||
|
||||
drawCenteredString(fontRendererObj, ConfigHandler.hudSettings[4]+"%", width/2 + 97, height/2-63, 0xFFFFFF);
|
||||
drawCenteredString(fontRendererObj, ConfigHandler.hudSettings[5]+"%", width/2 + 97, height/2-1, 0xFFFFFF);
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.brandon3055.brandonscore.client.utills.GuiHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.client.gui.GuiHudConfig;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.items.armor.IShieldedArmor;
|
||||
import com.brandon3055.draconicevolution.common.items.armor.ICustomArmor;
|
||||
import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock;
|
||||
import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -31,14 +31,13 @@ public class HudHandler {
|
||||
private static List<String> ltHudList = null;
|
||||
private static float toolTipFadeOut = 0F;
|
||||
private static float armorStatsFadeOut = 0F;
|
||||
public static boolean fadeHud = false;
|
||||
public static boolean fadeArmorStats = false;
|
||||
private static boolean showArmorHud = false;
|
||||
private static int armorPoints = 0;
|
||||
private static int maxArmorPoints = 0;
|
||||
private static int armorFatigue = 0;
|
||||
private static int ltProtPoints = 0;
|
||||
private static int ltFatigue = 0;
|
||||
private static boolean showShieldHud = false;
|
||||
private static int shieldPercentCharge = 0;
|
||||
private static float shieldPoints = 0F;
|
||||
private static float maxShieldPoints = 0F;
|
||||
private static float shieldEntropy = 0F;
|
||||
private static float ltShieldPoints = 0F;
|
||||
private static float ltEntropy = 0F;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
@@ -47,13 +46,13 @@ 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.HOTBAR || mc.gameSettings.showDebugInfo) return;// || (mc.currentScreen != null && !(mc.currentScreen instanceof GuiHudConfig))) return;
|
||||
ScaledResolution resolution = event.resolution;
|
||||
width = resolution.getScaledWidth();
|
||||
height = resolution.getScaledHeight();
|
||||
FontRenderer fontRenderer = mc.fontRenderer;
|
||||
|
||||
if (ConfigHandler.hudSettings[10] == 1 && hudList != null) {
|
||||
if (ConfigHandler.hudSettings[10] == 1 && hudList != null && toolTipFadeOut > 0) {
|
||||
int x = (int) (((float)ConfigHandler.hudSettings[0] / 1000F) * (float) width);
|
||||
int y = (int) (((float)ConfigHandler.hudSettings[1] / 1000F) * (float) height);
|
||||
|
||||
@@ -64,7 +63,7 @@ public class HudHandler {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if (ConfigHandler.hudSettings[11] == 1 && showArmorHud) {
|
||||
if (ConfigHandler.hudSettings[11] == 1 && showShieldHud) {
|
||||
int x = (int) (((float)ConfigHandler.hudSettings[2] / 1000F) * (float) width);
|
||||
int y = (int) (((float)ConfigHandler.hudSettings[3] / 1000F) * (float) height);
|
||||
|
||||
@@ -74,9 +73,12 @@ public class HudHandler {
|
||||
//x, y, x, y, scale, scale, fademode, fademode, rotateArmor, armorText
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void clientTick() {
|
||||
if (toolTipFadeOut > 0 && fadeHud) toolTipFadeOut-=0.1F;
|
||||
if (hudList != null && (ltHudList == null || !hudList.equals(ltHudList))) toolTipFadeOut = 10F;
|
||||
if (armorStatsFadeOut > 0 && fadeArmorStats) armorStatsFadeOut-=0.1F;
|
||||
if (ConfigHandler.hudSettings[6] > 0 && toolTipFadeOut > 1F - ((float)ConfigHandler.hudSettings[6] * 0.25F)) {
|
||||
|
||||
toolTipFadeOut-=0.1F;
|
||||
}
|
||||
if (hudList != null && (ltHudList == null || !hudList.equals(ltHudList))) toolTipFadeOut = 5F;
|
||||
//if (armorStatsFadeOut > 0 && fadeArmorStats) armorStatsFadeOut-=0.1F;
|
||||
//if (hudList != null && (ltHudList == null || !hudList.equals(ltHudList))) armorStatsFadeOut = 10F;todo armor refresh condition
|
||||
|
||||
ltHudList = hudList;
|
||||
@@ -97,6 +99,8 @@ public class HudHandler {
|
||||
hudList.add("");
|
||||
hudList.add("");
|
||||
hudList.add(StatCollector.translateToLocal("info.de.hudDisplayConfigTxt3.txt"));
|
||||
toolTipFadeOut = 1F;
|
||||
armorStatsFadeOut = 1F;
|
||||
}
|
||||
}
|
||||
else if (mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() instanceof IHudDisplayItem) {
|
||||
@@ -109,22 +113,23 @@ public class HudHandler {
|
||||
hudList = ((IHudDisplayBlock)mc.theWorld.getBlock(mop.blockX, mop.blockY, mop.blockZ)).getDisplayData(mc.theWorld, mop.blockX, mop.blockY, mop.blockZ);
|
||||
}
|
||||
|
||||
showArmorHud = false;
|
||||
maxArmorPoints = 0;
|
||||
armorPoints = 0;
|
||||
armorFatigue = 0;
|
||||
showShieldHud = false;
|
||||
maxShieldPoints = 0;
|
||||
shieldPoints = 0;
|
||||
shieldEntropy = 0;
|
||||
int peaces = 0;
|
||||
for (ItemStack stack : armorSlots){
|
||||
if (stack == null || !(stack.getItem() instanceof IShieldedArmor)) continue;
|
||||
if (stack == null || !(stack.getItem() instanceof ICustomArmor)) continue;
|
||||
peaces++;
|
||||
showArmorHud = true;
|
||||
IShieldedArmor armor = (IShieldedArmor) stack.getItem();
|
||||
maxArmorPoints += armor.getProtectionPoints(stack);
|
||||
armorPoints += ItemNBTHelper.getInteger(stack, "ProtectionPoints", 0);
|
||||
armorFatigue += ItemNBTHelper.getInteger(stack, "ArmorFatigue", 0);
|
||||
showShieldHud = true;
|
||||
ICustomArmor armor = (ICustomArmor) stack.getItem();
|
||||
maxShieldPoints += armor.getProtectionPoints(stack);
|
||||
shieldPoints += ItemNBTHelper.getFloat(stack, "ProtectionPoints", 0);
|
||||
shieldEntropy += ItemNBTHelper.getFloat(stack, "ShieldEntropy", 0);
|
||||
}
|
||||
if (armorPoints > 0 && maxArmorPoints > 0) armorPoints = (int)((armorPoints / (double)maxArmorPoints) * 100D);
|
||||
if (armorFatigue > 0 && peaces > 0) armorFatigue /= peaces;
|
||||
if (shieldPoints > 0 && maxShieldPoints > 0) shieldPercentCharge = Math.round((shieldPoints / maxShieldPoints) * 100F);
|
||||
else shieldPercentCharge = 0;
|
||||
if (shieldEntropy > 0 && peaces > 0) shieldEntropy /= peaces;
|
||||
|
||||
}
|
||||
|
||||
@@ -144,8 +149,8 @@ public class HudHandler {
|
||||
else GuiHelper.drawTexturedRect(x+(1*scale), y+(104*scale)+1, (int)(13*scale), (int)(15*scale), 2, 0, 11, 13, 0, GuiHelper.PXL128);
|
||||
|
||||
GuiHelper.drawTexturedRect(x, y, (int)(15*scale), (int)(104*scale), 0, 14, 15, 104, 0, GuiHelper.PXL128);
|
||||
GuiHelper.drawTexturedRect(x+2, y+2+(100- armorPoints), (int)(8*scale), (int)(armorPoints *scale), 15, 100- armorPoints, 8, armorPoints, 0, GuiHelper.PXL128);
|
||||
GuiHelper.drawTexturedRect(x+11, y+2+(100- armorFatigue), (int)(2*scale), (int)(armorFatigue *scale), 24, 100- armorFatigue, 2, armorFatigue, 0, GuiHelper.PXL128);
|
||||
GuiHelper.drawTexturedRect(x+2, y+2+(100- shieldPercentCharge), (int)(8*scale), shieldPercentCharge *scale, 15, 100-shieldPercentCharge, 8, shieldPercentCharge, 0, GuiHelper.PXL128);
|
||||
GuiHelper.drawTexturedRect(x+11, y+2+(100-(int)shieldEntropy), (int)(2*scale), (int)shieldEntropy * scale, 24, 100-(int)shieldEntropy, 2, (int)shieldEntropy, 0, GuiHelper.PXL128);
|
||||
|
||||
if (ConfigHandler.hudSettings[9] == 1) {
|
||||
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
@@ -154,11 +159,11 @@ public class HudHandler {
|
||||
if (rotated) GL11.glRotated(90, 0, 0, -1);
|
||||
GL11.glTranslated(-x, -y, 0);
|
||||
if (!rotated) {
|
||||
fontRenderer.drawStringWithShadow(armorPoints + "/" + maxArmorPoints, x + 16, y + 84, 0xFFFFFF);
|
||||
fontRenderer.drawStringWithShadow(armorFatigue + "%", x + 16, y + 94, 0xFFFFFF);
|
||||
fontRenderer.drawStringWithShadow(Math.round(shieldPoints) + "/" + (int)maxShieldPoints, x + 16, y + 84, 0xFFFFFF);
|
||||
fontRenderer.drawStringWithShadow((int)shieldEntropy + "%", x + 16, y + 94, 0xFFFFFF);
|
||||
}else {
|
||||
fontRenderer.drawStringWithShadow(armorPoints + "/" + maxArmorPoints, x - 102, y + 16, 0xFFFFFF);
|
||||
fontRenderer.drawStringWithShadow(armorFatigue + "%", x - fontRenderer.getStringWidth(armorFatigue + "%"), y + 16, 0xFFFFFF);
|
||||
fontRenderer.drawStringWithShadow(Math.round(shieldPoints) + "/" + (int)maxShieldPoints, x - 102, y + 16, 0xFFFFFF);
|
||||
fontRenderer.drawStringWithShadow((int)shieldEntropy + "%", x - fontRenderer.getStringWidth((int)shieldEntropy + "%"), y + 16, 0xFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ public class ConfigHandler {
|
||||
invertDPDSB = config.get(Configuration.CATEGORY_GENERAL, "InvertDPDSB", false, "Invert Dislocator Pedestal display name shift behavior").getBoolean(false);
|
||||
//First is tool hud second is armor hud
|
||||
//x, y, x, y, scale, scale, fademode, fademode, rotateArmor, armorText, hudEnabled, shieldEnabled
|
||||
hudSettings = config.get("Gui Stuff", "HUD Settings", new int[] {7, 874, 100, 100, 100, 100, 0, 0, 0, 0, 1, 1}, "Used to store the position of the armor ant tool HUD's. This should not be modified", Integer.MIN_VALUE, Integer.MAX_VALUE, true, 12).getIntList();
|
||||
hudSettings = config.get("Gui Stuff", "HUD Settings", new int[] { 996, 825, 69, 907, 90, 100, 3, 0, 1, 1, 1, 1}, "Used to store the position of the armor ant tool HUD's. This should not be modified", Integer.MIN_VALUE, Integer.MAX_VALUE, true, 12).getIntList();
|
||||
disableOreSpawnEnd = config.get(Configuration.CATEGORY_GENERAL, "Disable Ore Spawn (End)", false, "Set to true to prevent draconium ore from spawning in the end").getBoolean(false);
|
||||
disableOreSpawnNether = config.get(Configuration.CATEGORY_GENERAL, "Disable Ore Spawn (Nether)", false, "Set to true to prevent draconium ore from spawning in the nether").getBoolean(false);
|
||||
disableOreSpawnOverworld = config.get(Configuration.CATEGORY_GENERAL, "Disable Ore Spawn (Overworld)", false, "Set to true to prevent draconium ore from spawning in the overworld").getBoolean(false);
|
||||
|
||||
+111
-106
@@ -1,24 +1,24 @@
|
||||
package com.brandon3055.draconicevolution.common.handler;
|
||||
|
||||
|
||||
import com.brandon3055.brandonscore.BrandonsCore;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.items.armor.ArmorEffectHandler;
|
||||
import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerCapabilities;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
public class FMLEventHandler {
|
||||
|
||||
@@ -36,112 +36,117 @@ public class FMLEventHandler {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityUpdate(TickEvent.PlayerTickEvent event) {
|
||||
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
|
||||
if (event.phase != TickEvent.Phase.START) return;
|
||||
EntityPlayer player = event.player;
|
||||
//Reset Walk Speed----------------------------------------------------------------------------------------------
|
||||
|
||||
if (walkSpeed == null){
|
||||
walkSpeed = ReflectionHelper.findField(PlayerCapabilities.class, "walkSpeed", "g", "field_75097_g");
|
||||
walkSpeed.setAccessible(true);
|
||||
}
|
||||
if (walkSpeed != null) {
|
||||
try {
|
||||
walkSpeed.setFloat(player.capabilities, 0.1f);
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (ConcurrentModificationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
CustomArmorHandler.onPlayerTick(event);
|
||||
|
||||
//Apply Hill Step-----------------------------------------------------------------------------------------------
|
||||
|
||||
if (player.worldObj.isRemote) {
|
||||
boolean highStepListed = playersWithUphillStep.contains(player.getDisplayName()) && player.stepHeight >= 1f;
|
||||
boolean hasHighStep = ArmorEffectHandler.getHasHighStep(player);
|
||||
|
||||
if (hasHighStep && !highStepListed) {
|
||||
playersWithUphillStep.add(player.getDisplayName());
|
||||
player.stepHeight = 1f;
|
||||
}
|
||||
|
||||
if (!hasHighStep && highStepListed) {
|
||||
playersWithUphillStep.remove(player.getDisplayName());
|
||||
player.stepHeight = 0.5F;
|
||||
}
|
||||
}
|
||||
|
||||
//Apply Swiftness-----------------------------------------------------------------------------------------------
|
||||
|
||||
if (ArmorEffectHandler.getHasSwiftness(player)) {
|
||||
int i = ArmorEffectHandler.getSwiftnessLevel(player);
|
||||
|
||||
float percentIncrease = ArmorEffectHandler.getSwiftnessMultiplier(player) * ((i + 1) * 0.05f);
|
||||
//LogHelper.info(player.capabilities.getWalkSpeed()+" "+percentIncrease);
|
||||
|
||||
if (player.capabilities.isFlying && player.moveForward > 0F)
|
||||
{
|
||||
player.moveFlying(0F, 1F, percentIncrease / 2F);
|
||||
}
|
||||
|
||||
if (!player.onGround && player.ridingEntity == null) player.jumpMovementFactor = 0.02F + (percentIncrease * 0.2F);
|
||||
|
||||
if (walkSpeed != null) {
|
||||
try {
|
||||
walkSpeed.setFloat(player.capabilities, 0.1f + percentIncrease);
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (ConcurrentModificationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Apply Flight--------------------------------------------------------------------------------------------------
|
||||
|
||||
if (ArmorEffectHandler.getHasFlight(player)) {
|
||||
playersWithFlight.put(player, true);
|
||||
player.capabilities.allowFlying = true;
|
||||
if (ArmorEffectHandler.getFlightLock(player)) player.capabilities.isFlying = true;
|
||||
|
||||
if ((!player.onGround && player.capabilities.isFlying) && player.motionY != 0 && ((ArmorEffectHandler.getVAccSprint(player) && BrandonsCore.proxy.isCtrlDown()) || (!ArmorEffectHandler.getVAccSprint(player))))
|
||||
{
|
||||
float percentIncrease = ArmorEffectHandler.getVAccel(player);
|
||||
|
||||
if (BrandonsCore.proxy.isSpaceDown() && !BrandonsCore.proxy.isShiftDown())
|
||||
{
|
||||
player.motionY =(double)(percentIncrease * 2F);
|
||||
}
|
||||
|
||||
if (BrandonsCore.proxy.isShiftDown() && !BrandonsCore.proxy.isSpaceDown())
|
||||
{
|
||||
player.motionY = -(double)(percentIncrease * 2F);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (!playersWithFlight.containsKey(player)) {
|
||||
playersWithFlight.put(player, false);
|
||||
}
|
||||
|
||||
if (playersWithFlight.get(player) && !player.worldObj.isRemote) {
|
||||
playersWithFlight.put(player, false);
|
||||
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
player.capabilities.allowFlying = false;
|
||||
player.capabilities.isFlying = false;
|
||||
player.sendPlayerAbilities();
|
||||
}
|
||||
}
|
||||
}
|
||||
// EntityPlayer player = event.player;
|
||||
// //Reset Walk Speed----------------------------------------------------------------------------------------------
|
||||
//
|
||||
// if (walkSpeed == null){
|
||||
// walkSpeed = ReflectionHelper.findField(PlayerCapabilities.class, "walkSpeed", "g", "field_75097_g");
|
||||
// walkSpeed.setAccessible(true);
|
||||
// }
|
||||
// if (walkSpeed != null) {
|
||||
// try {
|
||||
// walkSpeed.setFloat(player.capabilities, 0.1f);
|
||||
// }
|
||||
// catch (IllegalAccessException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// catch (ConcurrentModificationException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //Apply Hill Step-----------------------------------------------------------------------------------------------
|
||||
//
|
||||
// if (player.worldObj.isRemote) {
|
||||
// boolean highStepListed = playersWithUphillStep.contains(player.getDisplayName()) && player.stepHeight >= 1f;
|
||||
// boolean hasHighStep = CustomArmorHandler.getHasHighStep(player);
|
||||
//
|
||||
// if (hasHighStep && !highStepListed) {
|
||||
// playersWithUphillStep.add(player.getDisplayName());
|
||||
// player.stepHeight = 1f;
|
||||
// }
|
||||
//
|
||||
// if (!hasHighStep && highStepListed) {
|
||||
// playersWithUphillStep.remove(player.getDisplayName());
|
||||
// player.stepHeight = 0.5F;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //Apply Swiftness-----------------------------------------------------------------------------------------------
|
||||
//
|
||||
// if (CustomArmorHandler.getHasSwiftness(player)) {
|
||||
// int i = CustomArmorHandler.getSwiftnessLevel(player);
|
||||
//
|
||||
// float percentIncrease = CustomArmorHandler.getSwiftnessMultiplier(player) * ((i + 1) * 0.05f);
|
||||
// //LogHelper.info(player.capabilities.getWalkSpeed()+" "+percentIncrease);
|
||||
//
|
||||
// if (player.capabilities.isFlying && player.moveForward > 0F)
|
||||
// {
|
||||
// player.moveFlying(0F, 1F, percentIncrease / 2F);
|
||||
// }
|
||||
//
|
||||
// if (!player.onGround && player.ridingEntity == null) player.jumpMovementFactor = 0.02F + (percentIncrease * 0.2F);
|
||||
//
|
||||
// if (walkSpeed != null) {
|
||||
// try {
|
||||
// walkSpeed.setFloat(player.capabilities, 0.1f + percentIncrease);
|
||||
// }
|
||||
// catch (IllegalAccessException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// catch (ConcurrentModificationException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //Apply Flight--------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// if (CustomArmorHandler.getHasFlight(player)) {
|
||||
// playersWithFlight.put(player, true);
|
||||
// player.capabilities.allowFlying = true;
|
||||
// if (CustomArmorHandler.getFlightLock(player)) player.capabilities.isFlying = true;
|
||||
//
|
||||
// if ((!player.onGround && player.capabilities.isFlying) && player.motionY != 0 && ((CustomArmorHandler.getVAccSprint(player) && BrandonsCore.proxy.isCtrlDown()) || (!CustomArmorHandler.getVAccSprint(player))))
|
||||
// {
|
||||
// float percentIncrease = CustomArmorHandler.getVAccel(player);
|
||||
//
|
||||
// if (BrandonsCore.proxy.isSpaceDown() && !BrandonsCore.proxy.isShiftDown())
|
||||
// {
|
||||
// player.motionY =(double)(percentIncrease * 2F);
|
||||
// }
|
||||
//
|
||||
// if (BrandonsCore.proxy.isShiftDown() && !BrandonsCore.proxy.isSpaceDown())
|
||||
// {
|
||||
// player.motionY = -(double)(percentIncrease * 2F);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// } else {
|
||||
//
|
||||
// if (!playersWithFlight.containsKey(player)) {
|
||||
// playersWithFlight.put(player, false);
|
||||
// }
|
||||
//
|
||||
// if (playersWithFlight.get(player) && !player.worldObj.isRemote) {
|
||||
// playersWithFlight.put(player, false);
|
||||
//
|
||||
// if (!player.capabilities.isCreativeMode) {
|
||||
// player.capabilities.allowFlying = false;
|
||||
// player.capabilities.isFlying = false;
|
||||
// player.sendPlayerAbilities();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerLogin(PlayerEvent.PlayerLoggedInEvent event)
|
||||
{
|
||||
|
||||
+35
-22
@@ -12,12 +12,13 @@ import com.brandon3055.draconicevolution.common.achievements.Achievements;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityCustomDragon;
|
||||
import com.brandon3055.draconicevolution.common.entity.EntityDragonHeart;
|
||||
import com.brandon3055.draconicevolution.common.entity.ExtendedPlayer;
|
||||
import com.brandon3055.draconicevolution.common.items.armor.ArmorEffectHandler;
|
||||
import com.brandon3055.draconicevolution.common.items.armor.CustomArmorHandler;
|
||||
import com.brandon3055.draconicevolution.common.network.MountUpdatePacket;
|
||||
import com.brandon3055.draconicevolution.common.network.SpeedRequestPacket;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileGrinder;
|
||||
import com.brandon3055.draconicevolution.common.utills.LogHelper;
|
||||
import com.brandon3055.draconicevolution.common.world.ChaosWorldGenHandler;
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -50,9 +51,7 @@ import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.event.entity.living.*;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
@@ -132,34 +131,51 @@ public class MinecraftForgeEventHandler {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingJumpEvent(LivingEvent.LivingJumpEvent event) {
|
||||
if (!(event.entityLiving instanceof EntityPlayer)) return;
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
public void onLivingHurt(LivingHurtEvent event){
|
||||
if (event.entityLiving instanceof EntityPlayer){
|
||||
CustomArmorHandler.onPlayerHurt(event);
|
||||
}
|
||||
}
|
||||
|
||||
if (ArmorEffectHandler.getHasJumpBoost(player))
|
||||
{
|
||||
int i = ArmorEffectHandler.getJumpLevel(player);
|
||||
event.entityLiving.motionY += ArmorEffectHandler.getJumpMultiplier(player) * ((0.1f) * (2 + i));
|
||||
@SubscribeEvent(priority = EventPriority.LOW)
|
||||
public void onLivingDeath(LivingDeathEvent event){
|
||||
if (event.entityLiving instanceof EntityPlayer){
|
||||
CustomArmorHandler.onPlayerDeath(event);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityDamaged(LivingAttackEvent event) {
|
||||
public void onLivingJumpEvent(LivingEvent.LivingJumpEvent event) {
|
||||
if (!(event.entityLiving instanceof EntityPlayer)) return;
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
|
||||
if (CustomArmorHandler.getHasJumpBoost(player))
|
||||
{
|
||||
int i = CustomArmorHandler.getJumpLevel(player);
|
||||
event.entityLiving.motionY += CustomArmorHandler.getJumpMultiplier(player) * ((0.1f) * (2 + i));
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOW)
|
||||
public void onLivingAttack(LivingAttackEvent event) {
|
||||
if (!(event.entityLiving instanceof EntityPlayer)) return;
|
||||
|
||||
CustomArmorHandler.onPlayerAttacked(event);
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
if (event.source.isFireDamage() && ArmorEffectHandler.getFireImunity(player))
|
||||
|
||||
if (event.source.isFireDamage() && CustomArmorHandler.getFireImunity(player))
|
||||
{
|
||||
event.setCanceled(true);
|
||||
event.entityLiving.extinguish();
|
||||
}
|
||||
|
||||
if (event.source.damageType.equals("fall") && ArmorEffectHandler.getHasJumpBoost(player))
|
||||
if (event.source.damageType.equals("fall") && CustomArmorHandler.getHasJumpBoost(player))
|
||||
{
|
||||
if (event.ammount < (ArmorEffectHandler.getJumpLevel(player) + 1) * 2) event.setCanceled(true);
|
||||
if (event.ammount < (CustomArmorHandler.getJumpLevel(player) + 1) * 2) event.setCanceled(true);
|
||||
}
|
||||
|
||||
if ((event.source.damageType.equals("inWall") || event.source.damageType.equals("drown")) && (ArmorEffectHandler.isWyvernArmor(player, 4) || ArmorEffectHandler.isDraconicArmor(player, 4)))
|
||||
if ((event.source.damageType.equals("inWall") || event.source.damageType.equals("drown")) && (CustomArmorHandler.isWyvernArmor(player, 4) || CustomArmorHandler.isDraconicArmor(player, 4)))
|
||||
{
|
||||
if (event.ammount <= 2f) event.setCanceled(true);
|
||||
}
|
||||
@@ -176,10 +192,7 @@ public class MinecraftForgeEventHandler {
|
||||
|
||||
for (Object o : event.entity.worldObj.playerEntities)
|
||||
{
|
||||
LogHelper.info(o);
|
||||
if (o instanceof EntityPlayer)
|
||||
((EntityPlayer) o).addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("msg.de.dragonDeath.txt")));
|
||||
|
||||
if (o instanceof EntityPlayer) ((EntityPlayer) o).addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("msg.de.dragonDeath.txt")));
|
||||
}
|
||||
|
||||
int count = 30 + event.entity.worldObj.rand.nextInt(30);
|
||||
@@ -382,11 +395,11 @@ public class MinecraftForgeEventHandler {
|
||||
float newDigSpeed = event.originalSpeed;
|
||||
if (event.entityPlayer.isInsideOfMaterial(Material.water))
|
||||
{
|
||||
if (ArmorEffectHandler.isDraconicArmor(event.entityPlayer, 4)) newDigSpeed *= 5f;
|
||||
if (CustomArmorHandler.isDraconicArmor(event.entityPlayer, 4)) newDigSpeed *= 5f;
|
||||
}
|
||||
if (!event.entityPlayer.onGround)
|
||||
{
|
||||
if (ArmorEffectHandler.isDraconicArmor(event.entityPlayer, 3)) newDigSpeed *= 5f;
|
||||
if (CustomArmorHandler.isDraconicArmor(event.entityPlayer, 3)) newDigSpeed *= 5f;
|
||||
}
|
||||
event.newSpeed = newDigSpeed;
|
||||
}
|
||||
|
||||
-91
@@ -1,91 +0,0 @@
|
||||
package com.brandon3055.draconicevolution.common.items.armor;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 13/11/2014.
|
||||
*/
|
||||
public class ArmorEffectHandler {
|
||||
|
||||
// slotHelm = 4;
|
||||
// slotChest = 3;
|
||||
// slotLeggs = 2;
|
||||
// slotBoots = 1;
|
||||
|
||||
//Flight------------------------------------------------------------------------------------------------------------
|
||||
public static boolean getHasFlight(EntityPlayer player){
|
||||
return isDraconicArmor(player, 3);// && ((IEnergyContainerItem)player.getEquipmentInSlot(3).getItem()).extractEnergy(player.getEquipmentInSlot(3), 80, !player.capabilities.isFlying) == 80;
|
||||
}
|
||||
|
||||
public static float getVAccel(EntityPlayer player){
|
||||
return ItemNBTHelper.getFloat(player.getEquipmentInSlot(3), "VerticalAcceleration", 0.3F);
|
||||
}
|
||||
|
||||
public static boolean getVAccSprint(EntityPlayer player){
|
||||
return ItemNBTHelper.getBoolean(player.getEquipmentInSlot(3), "EffectiveOnSprint", false);
|
||||
}
|
||||
|
||||
public static boolean getFlightLock(EntityPlayer player){
|
||||
return ItemNBTHelper.getBoolean(player.getEquipmentInSlot(3), "ArmorFlightLock", false);
|
||||
}
|
||||
|
||||
//Swiftness---------------------------------------------------------------------------------------------------------
|
||||
public static boolean getHasSwiftness(EntityPlayer player){
|
||||
return isDraconicArmor(player, 2) || isWyvernArmor(player, 2);
|
||||
}
|
||||
|
||||
public static int getSwiftnessLevel(EntityPlayer player){
|
||||
int i = isWyvernArmor(player, 2) ? 2 : isDraconicArmor(player, 2) ? 4 : 0;
|
||||
return (player.isSprinting() || !ItemNBTHelper.getBoolean(player.getEquipmentInSlot(2), "ArmorSprintOnly", false)) ? i * 2 : i;
|
||||
}
|
||||
|
||||
public static float getSwiftnessMultiplier(EntityPlayer player){
|
||||
return ItemNBTHelper.getFloat(player.getEquipmentInSlot(2), "ArmorSpeedMult", 1f);
|
||||
}
|
||||
|
||||
//Jump Boost--------------------------------------------------------------------------------------------------------
|
||||
public static boolean getHasJumpBoost(EntityPlayer player){
|
||||
return (isDraconicArmor(player, 1) || isWyvernArmor(player, 1)) && extractEnergy(player, (getJumpLevel(player)+1)*80, 1);
|
||||
}
|
||||
|
||||
public static int getJumpLevel(EntityPlayer player){
|
||||
int i = isWyvernArmor(player, 1) ? 2 : isDraconicArmor(player, 1) ? 4 : 0;
|
||||
return (player.isSprinting() || !ItemNBTHelper.getBoolean(player.getEquipmentInSlot(1), "ArmorSprintOnly", false)) ? i * 2 : i;
|
||||
}
|
||||
|
||||
public static float getJumpMultiplier(EntityPlayer player){
|
||||
return ItemNBTHelper.getFloat(player.getEquipmentInSlot(1), "ArmorJumpMult", 1f);
|
||||
}
|
||||
|
||||
//Fire Immunity-----------------------------------------------------------------------------------------------------
|
||||
public static boolean getFireImunity(EntityPlayer player){
|
||||
if (isDraconicArmor(player, 3) && extractEnergy(player, 80, 3)) return true;
|
||||
return (isWyvernArmor(player, 1) && isWyvernArmor(player, 2) && isWyvernArmor(player, 3) && isWyvernArmor(player, 4));
|
||||
}
|
||||
|
||||
//Hill Step---------------------------------------------------------------------------------------------------------
|
||||
public static boolean getHasHighStep(EntityPlayer player){
|
||||
return isDraconicArmor(player, 1) && ItemNBTHelper.getBoolean(player.getEquipmentInSlot(1), "ArmorHillStep", true);
|
||||
}
|
||||
|
||||
//Armor & Energy----------------------------------------------------------------------------------------------------
|
||||
public static boolean isWyvernArmor(EntityPlayer player, int slot){
|
||||
int slotType = 4 - slot;
|
||||
ItemStack armor = player.getEquipmentInSlot(slot);
|
||||
return armor != null && armor.getItem() instanceof WyvernArmor && ((WyvernArmor)armor.getItem()).armorType == slotType;
|
||||
}
|
||||
|
||||
public static boolean isDraconicArmor(EntityPlayer player, int slot){
|
||||
int slotType = 4 - slot;
|
||||
ItemStack armor = player.getEquipmentInSlot(slot);
|
||||
return armor != null && armor.getItem() instanceof DraconicArmor && ((DraconicArmor)armor.getItem()).armorType == slotType;
|
||||
}
|
||||
|
||||
public static boolean extractEnergy(EntityPlayer player, int amount, int slot){
|
||||
if (player.getEquipmentInSlot(slot).getItem() instanceof IEnergyContainerItem) return ((IEnergyContainerItem)player.getEquipmentInSlot(slot).getItem()).extractEnergy(player.getEquipmentInSlot(slot), amount, false) == amount;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+334
@@ -0,0 +1,334 @@
|
||||
package com.brandon3055.draconicevolution.common.items.armor;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
|
||||
import com.brandon3055.draconicevolution.common.utills.IUpgradableItem;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.ChatStyle;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
|
||||
/**
|
||||
* Created by Brandon on 13/11/2014.
|
||||
*/
|
||||
public class CustomArmorHandler {
|
||||
private static final DamageSource ADMIN_KILL = new DamageSource("administrative.kill");
|
||||
|
||||
public static void onPlayerHurt(LivingHurtEvent event) {
|
||||
// EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
// ShieldSummery summery = new ShieldSummery().getSummery(player);
|
||||
// if (summery == null || summery.protectionPoints <= 0) return;
|
||||
// float newEntropy = Math.min(summery.entropy + Math.min(3, event.ammount/5) + player.worldObj.rand.nextFloat(), 100F);
|
||||
//
|
||||
// //Divide the damage between the armor peaces based on how many of the protection points each peace has
|
||||
// float totalAbsorbed = 0;
|
||||
// for (int i = 0; i < summery.allocation.length; i++){
|
||||
// if (summery.allocation[i] == 0) continue;
|
||||
// ItemStack armorPeace = summery.armorStacks[i];
|
||||
//
|
||||
// float dmgShear = summery.allocation[i] / summery.protectionPoints;
|
||||
// float dmg = dmgShear * event.ammount;
|
||||
//
|
||||
// float absorbed = Math.min(dmg, summery.allocation[i]);
|
||||
// dmg -= absorbed;
|
||||
// totalAbsorbed += absorbed;
|
||||
// summery.allocation[i]-=absorbed;
|
||||
// ItemNBTHelper.setFloat(armorPeace, "ProtectionPoints", summery.allocation[i]);
|
||||
// ItemNBTHelper.setInteger(armorPeace, "ShieldHitTimer", 20);
|
||||
// ItemNBTHelper.setFloat(armorPeace, "ShieldEntropy", newEntropy);
|
||||
//
|
||||
//// if (dmg > 0 && absorbed >= dmgShear*20F){
|
||||
//// int energyCost = (int)(dmg * OVER_DRAIN_COST);
|
||||
//// int extracted = ((IEnergyContainerItem)armorPeace.getItem()).extractEnergy(armorPeace, energyCost, false);
|
||||
//// dmg = (energyCost-extracted) / OVER_DRAIN_COST;
|
||||
//// totalAbsorbed += extracted / OVER_DRAIN_COST;
|
||||
//// ItemNBTHelper.setFloat(armorPeace, "ShieldEntropy", 100);
|
||||
//// }
|
||||
//
|
||||
//// LogHelper.info(dmg);
|
||||
// }
|
||||
//
|
||||
// event.ammount-=totalAbsorbed;
|
||||
// if (event.ammount <= 0) event.setCanceled(true);
|
||||
// player.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).removeModifier(new AttributeModifier(KB_ATTRIB_UUID, SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(), 100, 0));
|
||||
// LogHelper.info("hurt");
|
||||
}
|
||||
|
||||
public static void onPlayerAttacked(LivingAttackEvent event){
|
||||
EntityPlayer player = (EntityPlayer)event.entityLiving;
|
||||
ShieldSummery summery = new ShieldSummery().getSummery(player);
|
||||
|
||||
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)){
|
||||
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);
|
||||
|
||||
//Divide the damage between the armor peaces based on how many of the protection points each peace has
|
||||
float totalAbsorbed = 0;
|
||||
int remainingPoints = 0;
|
||||
for (int i = 0; i < summery.allocation.length; i++){
|
||||
if (summery.allocation[i] == 0) continue;
|
||||
ItemStack armorPeace = summery.armorStacks[i];
|
||||
|
||||
float dmgShear = summery.allocation[i] / summery.protectionPoints;
|
||||
float dmg = dmgShear * event.ammount;
|
||||
|
||||
float absorbed = Math.min(dmg, summery.allocation[i]);
|
||||
totalAbsorbed += absorbed;
|
||||
summery.allocation[i]-=absorbed;
|
||||
remainingPoints += summery.allocation[i];
|
||||
ItemNBTHelper.setFloat(armorPeace, "ProtectionPoints", summery.allocation[i]);
|
||||
ItemNBTHelper.setFloat(armorPeace, "ShieldEntropy", newEntropy);
|
||||
}
|
||||
|
||||
if (remainingPoints > 0) {
|
||||
player.hurtResistantTime = 20;
|
||||
}
|
||||
else if (event.ammount-totalAbsorbed > 0){
|
||||
player.attackEntityFrom(event.source, event.ammount-totalAbsorbed);
|
||||
}
|
||||
}
|
||||
|
||||
public static void onPlayerDeath(LivingDeathEvent event) {
|
||||
EntityPlayer player = (EntityPlayer)event.entityLiving;
|
||||
ShieldSummery summery = new ShieldSummery().getSummery(player);
|
||||
|
||||
if (summery == null || event.source == ADMIN_KILL) return;
|
||||
|
||||
int[] charge = new int[summery.armorStacks.length];
|
||||
int totalCharge = 0;
|
||||
for (int i = 0; i < summery.armorStacks.length; i++){
|
||||
if (summery.armorStacks[i] != null) {
|
||||
charge[i] = ((IEnergyContainerItem)summery.armorStacks[i].getItem()).getEnergyStored(summery.armorStacks[i]);
|
||||
totalCharge += charge[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (totalCharge < 5000000) 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);
|
||||
}
|
||||
}
|
||||
|
||||
player.addChatComponentMessage(new ChatComponentTranslation("msg.de.shieldDepleted.txt").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_RED)));
|
||||
event.setCanceled(true);
|
||||
player.setHealth(1);
|
||||
}
|
||||
|
||||
public static void onPlayerTick(TickEvent.PlayerTickEvent event) {
|
||||
EntityPlayer player = event.player;
|
||||
ShieldSummery summery = new ShieldSummery().getSummery(player);
|
||||
if (summery == null || (summery.maxProtectionPoints - summery.protectionPoints < 0.01 && summery.entropy == 0) || player.worldObj.isRemote) return;
|
||||
|
||||
float totalPointsToAdd = Math.min(summery.maxProtectionPoints - summery.protectionPoints, summery.maxProtectionPoints / 60F);
|
||||
totalPointsToAdd *= (1F - (summery.entropy / 100F));
|
||||
totalPointsToAdd = Math.min(totalPointsToAdd, summery.totalEnergyStored / 1000);
|
||||
if (totalPointsToAdd < 0F) totalPointsToAdd = 0F;
|
||||
|
||||
summery.entropy -= (summery.meanRecoveryPoints * 0.01F);
|
||||
if (summery.entropy < 0) summery.entropy = 0;
|
||||
|
||||
for (int i = 0; i < summery.armorStacks.length; i++){
|
||||
ItemStack stack = summery.armorStacks[i];
|
||||
if (stack == null || summery.totalEnergyStored <= 0) continue;
|
||||
float maxForPeace = ((ICustomArmor)stack.getItem()).getProtectionPoints(stack);
|
||||
((IEnergyContainerItem)stack.getItem()).extractEnergy(stack, (int)((summery.energyAllocation[i] / (double)summery.totalEnergyStored) * (totalPointsToAdd * 1000)), false);
|
||||
float pointsForPeace = (summery.pointsDown[i] / Math.max(1, summery.maxProtectionPoints - summery.protectionPoints)) * totalPointsToAdd;
|
||||
summery.allocation[i] += pointsForPeace;
|
||||
if (summery.allocation[i] > maxForPeace || maxForPeace - summery.allocation[i] < 0.1F) summery.allocation[i] = maxForPeace;
|
||||
ItemNBTHelper.setFloat(stack, "ProtectionPoints", summery.allocation[i]);
|
||||
if (player.hurtResistantTime <= 0)ItemNBTHelper.setFloat(stack, "ShieldEntropy", summery.entropy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Re Add the armor effects!
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// slotHelm = 4;
|
||||
// slotChest = 3;
|
||||
// slotLeggs = 2;
|
||||
// slotBoots = 1;
|
||||
|
||||
//Flight------------------------------------------------------------------------------------------------------------
|
||||
public static boolean getHasFlight(EntityPlayer player){
|
||||
return isDraconicArmor(player, 3);// && ((IEnergyContainerItem)player.getEquipmentInSlot(3).getItem()).extractEnergy(player.getEquipmentInSlot(3), 80, !player.capabilities.isFlying) == 80;
|
||||
}
|
||||
|
||||
public static float getVAccel(EntityPlayer player){
|
||||
return ItemNBTHelper.getFloat(player.getEquipmentInSlot(3), "VerticalAcceleration", 0.3F);
|
||||
}
|
||||
|
||||
public static boolean getVAccSprint(EntityPlayer player){
|
||||
return ItemNBTHelper.getBoolean(player.getEquipmentInSlot(3), "EffectiveOnSprint", false);
|
||||
}
|
||||
|
||||
public static boolean getFlightLock(EntityPlayer player){
|
||||
return ItemNBTHelper.getBoolean(player.getEquipmentInSlot(3), "ArmorFlightLock", false);
|
||||
}
|
||||
|
||||
//Swiftness---------------------------------------------------------------------------------------------------------
|
||||
public static boolean getHasSwiftness(EntityPlayer player){
|
||||
return isDraconicArmor(player, 2) || isWyvernArmor(player, 2);
|
||||
}
|
||||
|
||||
public static int getSwiftnessLevel(EntityPlayer player){
|
||||
int i = isWyvernArmor(player, 2) ? 2 : isDraconicArmor(player, 2) ? 4 : 0;
|
||||
return (player.isSprinting() || !ItemNBTHelper.getBoolean(player.getEquipmentInSlot(2), "ArmorSprintOnly", false)) ? i * 2 : i;
|
||||
}
|
||||
|
||||
public static float getSwiftnessMultiplier(EntityPlayer player){
|
||||
return ItemNBTHelper.getFloat(player.getEquipmentInSlot(2), "ArmorSpeedMult", 1f);
|
||||
}
|
||||
|
||||
//Jump Boost--------------------------------------------------------------------------------------------------------
|
||||
public static boolean getHasJumpBoost(EntityPlayer player){
|
||||
return (isDraconicArmor(player, 1) || isWyvernArmor(player, 1)) && extractEnergy(player, (getJumpLevel(player)+1)*80, 1);
|
||||
}
|
||||
|
||||
public static int getJumpLevel(EntityPlayer player){
|
||||
int i = isWyvernArmor(player, 1) ? 2 : isDraconicArmor(player, 1) ? 4 : 0;
|
||||
return (player.isSprinting() || !ItemNBTHelper.getBoolean(player.getEquipmentInSlot(1), "ArmorSprintOnly", false)) ? i * 2 : i;
|
||||
}
|
||||
|
||||
public static float getJumpMultiplier(EntityPlayer player){
|
||||
return ItemNBTHelper.getFloat(player.getEquipmentInSlot(1), "ArmorJumpMult", 1f);
|
||||
}
|
||||
|
||||
//Fire Immunity-----------------------------------------------------------------------------------------------------
|
||||
public static boolean getFireImunity(EntityPlayer player){
|
||||
if (isDraconicArmor(player, 3) && extractEnergy(player, 80, 3)) return true;
|
||||
return (isWyvernArmor(player, 1) && isWyvernArmor(player, 2) && isWyvernArmor(player, 3) && isWyvernArmor(player, 4));
|
||||
}
|
||||
|
||||
//Hill Step---------------------------------------------------------------------------------------------------------
|
||||
public static boolean getHasHighStep(EntityPlayer player){
|
||||
return isDraconicArmor(player, 1) && ItemNBTHelper.getBoolean(player.getEquipmentInSlot(1), "ArmorHillStep", true);
|
||||
}
|
||||
|
||||
//Armor & Energy----------------------------------------------------------------------------------------------------
|
||||
public static boolean isWyvernArmor(EntityPlayer player, int slot){
|
||||
int slotType = 4 - slot;
|
||||
ItemStack armor = player.getEquipmentInSlot(slot);
|
||||
return armor != null && armor.getItem() instanceof WyvernArmor && ((WyvernArmor)armor.getItem()).armorType == slotType;
|
||||
}
|
||||
|
||||
public static boolean isDraconicArmor(EntityPlayer player, int slot){
|
||||
int slotType = 4 - slot;
|
||||
ItemStack armor = player.getEquipmentInSlot(slot);
|
||||
return armor != null && armor.getItem() instanceof DraconicArmor && ((DraconicArmor)armor.getItem()).armorType == slotType;
|
||||
}
|
||||
|
||||
public static boolean extractEnergy(EntityPlayer player, int amount, int slot){
|
||||
if (player.getEquipmentInSlot(slot).getItem() instanceof IEnergyContainerItem) return ((IEnergyContainerItem)player.getEquipmentInSlot(slot).getItem()).extractEnergy(player.getEquipmentInSlot(slot), amount, false) == amount;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static class ShieldSummery {
|
||||
/**Max protection points from all equipped armor peaces*/
|
||||
public float maxProtectionPoints;
|
||||
/**Total protection points from all equipped armor peaces*/
|
||||
public float protectionPoints;
|
||||
/**Number of quipped armor peaces*/
|
||||
public int peaces;
|
||||
/**Point Allocation, The number of points on each peace*/
|
||||
public float[] allocation;
|
||||
/***/
|
||||
public float[] pointsDown;
|
||||
/**The armor peaces (Index will contain null if peace is not present)*/
|
||||
public ItemStack[] armorStacks;
|
||||
/**Mean Fatigue*/
|
||||
public float entropy;
|
||||
/**Mean Recovery Points*/
|
||||
public int meanRecoveryPoints;
|
||||
/**Total RF stored in the armor*/
|
||||
public int totalEnergyStored;
|
||||
/**RF stored in each armor peace*/
|
||||
public int[] energyAllocation;
|
||||
|
||||
public ShieldSummery getSummery(EntityPlayer player){
|
||||
ItemStack[] armorSlots = player.inventory.armorInventory;
|
||||
protectionPoints = 0;
|
||||
peaces = 0;
|
||||
float totalEntropy = 0;
|
||||
int totalRecoveryPoints = 0;
|
||||
meanRecoveryPoints = 0;
|
||||
allocation = new float[armorSlots.length];
|
||||
armorStacks = new ItemStack[armorSlots.length];
|
||||
pointsDown = new float[armorSlots.length];
|
||||
energyAllocation = new int[armorSlots.length];
|
||||
totalEnergyStored = 0;
|
||||
|
||||
for (int i = 0; i < armorSlots.length; i++){
|
||||
ItemStack stack = armorSlots[i];
|
||||
if (stack == null || !(stack.getItem() instanceof ICustomArmor)) continue;
|
||||
peaces++;
|
||||
allocation[i] = ItemNBTHelper.getFloat(stack, "ProtectionPoints", 0);
|
||||
protectionPoints += allocation[i];
|
||||
totalEntropy += ItemNBTHelper.getFloat(stack, "ShieldEntropy", 0);
|
||||
armorStacks[i] = stack;
|
||||
totalRecoveryPoints += IUpgradableItem.EnumUpgrade.SHIELD_RECOVERY.getUpgradePoints(stack);
|
||||
float maxPoints = ((ICustomArmor)stack.getItem()).getProtectionPoints(stack);
|
||||
pointsDown[i] = maxPoints - allocation[i];
|
||||
maxProtectionPoints += maxPoints;
|
||||
energyAllocation[i] = ((IEnergyContainerItem)stack.getItem()).getEnergyStored(stack);
|
||||
totalEnergyStored += energyAllocation[i];
|
||||
}
|
||||
|
||||
if (peaces == 0) return null;
|
||||
|
||||
entropy = totalEntropy / peaces;
|
||||
meanRecoveryPoints = totalRecoveryPoints / peaces;
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
-14
@@ -52,7 +52,7 @@ import java.util.List;
|
||||
@Optional.Interface(iface = "thaumcraft.api.IGoggles", modid = "Thaumcraft"),
|
||||
@Optional.Interface(iface = "thaumcraft.api.nodes.IRevealer", modid = "Thaumcraft")
|
||||
})
|
||||
public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyContainerItem, IConfigurableItem, IInventoryTool, IGoggles, IRevealer, IUpgradableItem, IShieldedArmor {//TODO Wings
|
||||
public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyContainerItem, IConfigurableItem, IInventoryTool, IGoggles, IRevealer, IUpgradableItem, ICustomArmor {//TODO Wings
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon helmIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -149,16 +149,16 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyCo
|
||||
return getEnergyStored(stack) < getMaxEnergyStored(stack);
|
||||
}
|
||||
|
||||
protected double getAbsorptionPercent() {
|
||||
protected float getProtectionShare() {
|
||||
switch (armorType) {
|
||||
case 0:
|
||||
return 0.15D;
|
||||
return 0.15F;
|
||||
case 1:
|
||||
return 0.40D;
|
||||
return 0.40F;
|
||||
case 2:
|
||||
return 0.30D;
|
||||
return 0.30F;
|
||||
case 3:
|
||||
return 0.15D;
|
||||
return 0.15F;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -167,20 +167,20 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyCo
|
||||
|
||||
@Override
|
||||
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
|
||||
int maxAbsorption = 25 * getEnergyStored(armor) / energyPerDamage;
|
||||
int maxAbsorption = 0;//25 * getEnergyStored(armor) / energyPerDamage;
|
||||
if (source.damageType.equals(DamageSource.fall.damageType) && armor.getItem() == ModItems.draconicBoots) return new ArmorProperties(0, 1D, maxAbsorption);
|
||||
if (source.isUnblockable()) return new ArmorProperties(0, (getAbsorptionPercent()*totalAbsorption)/2, maxAbsorption);
|
||||
return new ArmorProperties(0, getAbsorptionPercent()*totalAbsorption, maxAbsorption);
|
||||
if (source.isUnblockable()) return new ArmorProperties(0, (getProtectionShare()*totalAbsorption)/2, maxAbsorption);
|
||||
return new ArmorProperties(0, getProtectionShare()*totalAbsorption, maxAbsorption);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
|
||||
return this.getEnergyStored(armor) > 10000 ? (int)(getAbsorptionPercent() * 20D) : (int) ((float)this.getEnergyStored(armor) / 10000F * (float)(getAbsorptionPercent() * 20D));
|
||||
return this.getEnergyStored(armor) > 10000 ? (int)(getProtectionShare() * 20D) : (int) ((float)this.getEnergyStored(armor) / 10000F * (float)(getProtectionShare() * 20D));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
|
||||
extractEnergy(stack, damage * energyPerDamage, false);
|
||||
//extractEnergy(stack, damage * energyPerDamage, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -444,16 +444,18 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyCo
|
||||
@Override
|
||||
public int getBaseUpgradePoints(int upgradeIndex) {
|
||||
if (upgradeIndex == EnumUpgrade.RF_CAPACITY.index) return 2;
|
||||
else if (upgradeIndex == EnumUpgrade.SHIELD_CAPACITY.index) return (int)(getProtectionShare() * 25) + (armorType == 2 ? 2 : 0);
|
||||
else if (upgradeIndex == EnumUpgrade.SHIELD_RECOVERY.index) return 5;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProtectionPoints(ItemStack stack) {
|
||||
return 10;
|
||||
public float getProtectionPoints(ItemStack stack) {
|
||||
return EnumUpgrade.SHIELD_CAPACITY.getUpgradePoints(stack) * 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecoveryPoints(ItemStack stack) {
|
||||
return 10;
|
||||
return EnumUpgrade.SHIELD_RECOVERY.getUpgradePoints(stack);
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -5,18 +5,16 @@ import net.minecraft.item.ItemStack;
|
||||
/**
|
||||
* Created by brandon3055 on 5/2/2016.
|
||||
*/
|
||||
public interface IShieldedArmor {
|
||||
public interface ICustomArmor {
|
||||
|
||||
/**Returns the max number of protection points this armor piece can provide
|
||||
* 1 protection point equals 1 half heart of protection.
|
||||
* */
|
||||
public int getProtectionPoints(ItemStack stack);
|
||||
public float getProtectionPoints(ItemStack stack);
|
||||
|
||||
/**Reruns the number of Upgrade points applied to shield recovery*/
|
||||
public int getRecoveryPoints(ItemStack stack);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
TODO
|
||||
\
|
||||
+17
-15
@@ -39,7 +39,7 @@ import java.util.List;
|
||||
/**
|
||||
* Created by Brandon on 3/07/2014.
|
||||
*/
|
||||
public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyContainerItem, IConfigurableItem, IInventoryTool, IUpgradableItem, IShieldedArmor {
|
||||
public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyContainerItem, IConfigurableItem, IInventoryTool, IUpgradableItem, ICustomArmor {
|
||||
private IIcon helmIcon;
|
||||
private IIcon chestIcon;
|
||||
private IIcon leggsIcon;
|
||||
@@ -132,16 +132,16 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyCont
|
||||
return getEnergyStored(stack) < getMaxEnergyStored(stack);
|
||||
}
|
||||
|
||||
protected double getAbsorptionPercent() {
|
||||
protected float getProtectionShare() {
|
||||
switch (armorType) {
|
||||
case 0:
|
||||
return 0.15D;
|
||||
return 0.15F;
|
||||
case 1:
|
||||
return 0.40D;
|
||||
return 0.40F;
|
||||
case 2:
|
||||
return 0.30D;
|
||||
return 0.30F;
|
||||
case 3:
|
||||
return 0.15D;
|
||||
return 0.15F;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -150,22 +150,22 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyCont
|
||||
|
||||
@Override
|
||||
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
|
||||
int maxAbsorption = 25 * getEnergyStored(armor) / energyPerDamage;
|
||||
int maxAbsorption = 0;//25 * getEnergyStored(armor) / energyPerDamage;
|
||||
if (source.damageType.equals(DamageSource.fall.damageType) && armor.getItem() == ModItems.wyvernBoots) return new ArmorProperties(0, 0.8D, maxAbsorption);
|
||||
if (source.isUnblockable()) return new ArmorProperties(0, (getAbsorptionPercent()*totalAbsorption)/4, maxAbsorption);
|
||||
return new ArmorProperties(0, getAbsorptionPercent()*totalAbsorption, maxAbsorption);
|
||||
if (source.isUnblockable()) return new ArmorProperties(0, (getProtectionShare()*totalAbsorption)/4, maxAbsorption);
|
||||
return new ArmorProperties(0, getProtectionShare()*totalAbsorption, maxAbsorption);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
|
||||
return this.getEnergyStored(armor) > 10000 ? (int)(getAbsorptionPercent() * 20D) : (int) ((float)this.getEnergyStored(armor) / 10000F * (float)(getAbsorptionPercent() * 20D));
|
||||
return this.getEnergyStored(armor) > 10000 ? (int)(getProtectionShare() * 20D) : (int) ((float)this.getEnergyStored(armor) / 10000F * (float)(getProtectionShare() * 20D));
|
||||
|
||||
// return (int)(getAbsorptionPercent() * 20D);
|
||||
// return (int)(getProtectionShare() * 20D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
|
||||
extractEnergy(stack, damage * energyPerDamage, false);
|
||||
//extractEnergy(stack, damage * energyPerDamage, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -370,16 +370,18 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyCont
|
||||
@Override
|
||||
public int getBaseUpgradePoints(int upgradeIndex) {
|
||||
if (upgradeIndex == EnumUpgrade.RF_CAPACITY.index) return 2;
|
||||
else if (upgradeIndex == EnumUpgrade.SHIELD_CAPACITY.index) return (int)(getProtectionShare() * 10) + (armorType == 2 ? 1 : 0);
|
||||
else if (upgradeIndex == EnumUpgrade.SHIELD_RECOVERY.index) return 5;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProtectionPoints(ItemStack stack) {
|
||||
return 10;
|
||||
public float getProtectionPoints(ItemStack stack) {
|
||||
return EnumUpgrade.SHIELD_CAPACITY.getUpgradePoints(stack) * 20F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecoveryPoints(ItemStack stack) {
|
||||
return 10;
|
||||
return EnumUpgrade.SHIELD_RECOVERY.getUpgradePoints(stack);
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -135,7 +135,7 @@ public class ToolHandler {
|
||||
world.setBlockToAir(x, y, z);
|
||||
|
||||
if (!world.isRemote && !player.capabilities.isCreativeMode && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {
|
||||
for (final ItemStack item : items) {
|
||||
for (ItemStack item : items) {
|
||||
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, item));
|
||||
}
|
||||
}
|
||||
@@ -172,8 +172,6 @@ public class ToolHandler {
|
||||
if (rf > item.getEnergyStored(stack)) baseAttack = item.getEnergyStored(stack) / References.ENERGYPERATTACK;
|
||||
if (baseAttack <= 0) baseAttack = 1;
|
||||
|
||||
LogHelper.info(baseAttack * References.ENERGYPERATTACK);
|
||||
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage(player), baseAttack);
|
||||
if (EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, stack) > 0) entity.setFire(EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, stack) * 15);
|
||||
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ public class DraconicSword extends ItemSword implements IEnergyContainerItem, II
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
ToolHandler.AOEAttack(player, entity, stack, 3);
|
||||
ToolHandler.AOEAttack(player, entity, stack, ItemNBTHelper.getInteger(stack, References.ATTACK_AOE, 0));
|
||||
ToolHandler.damageEntityBasedOnHealth(entity, player, 0.2F);
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ public class WyvernSword extends ItemSword implements IEnergyContainerItem, IInv
|
||||
@Override
|
||||
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
|
||||
{
|
||||
ToolHandler.AOEAttack(player, entity, stack, 1);
|
||||
ToolHandler.AOEAttack(player, entity, stack, ItemNBTHelper.getInteger(stack, References.ATTACK_AOE, 0));
|
||||
ToolHandler.damageEntityBasedOnHealth(entity, player, 0.1F);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user