aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/item
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2019-04-11 02:59:02 +1000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2019-04-11 02:59:02 +1000
commit3b7cff8412af5afbf99bfd40fee1193a6cd8c400 (patch)
tree2212e7359109d8c424848cae5ae2f9bbc43f83f6 /src/Java/gtPlusPlus/core/item
parent761a3c8b0c0eb02bd2897359a575126aae1af20f (diff)
downloadGT5-Unofficial-3b7cff8412af5afbf99bfd40fee1193a6cd8c400.tar.gz
GT5-Unofficial-3b7cff8412af5afbf99bfd40fee1193a6cd8c400.tar.bz2
GT5-Unofficial-3b7cff8412af5afbf99bfd40fee1193a6cd8c400.zip
+ Added some new Monster Killer Baubles. Kill nearby mobs for power, power cost scales with HP total, left and other EntityLiving stats.
+ Added new constructors for AutoMaps. + Added a Wrapper (AABB) for AxisAlignedBB. $ Fixed Hot Titanium Ingot recipe.
Diffstat (limited to 'src/Java/gtPlusPlus/core/item')
-rw-r--r--src/Java/gtPlusPlus/core/item/ModItems.java12
-rw-r--r--src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java78
2 files changed, 72 insertions, 18 deletions
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java
index e3c01b7ea5..68aacd6943 100644
--- a/src/Java/gtPlusPlus/core/item/ModItems.java
+++ b/src/Java/gtPlusPlus/core/item/ModItems.java
@@ -32,6 +32,7 @@ import gtPlusPlus.core.item.base.plates.BaseItemPlateDouble;
import gtPlusPlus.core.item.bauble.BatteryPackBaseBauble;
import gtPlusPlus.core.item.bauble.HealthBoostBauble;
import gtPlusPlus.core.item.bauble.ModularBauble;
+import gtPlusPlus.core.item.bauble.MonsterKillerBaseBauble;
import gtPlusPlus.core.item.chemistry.AgriculturalChem;
import gtPlusPlus.core.item.chemistry.CoalTar;
import gtPlusPlus.core.item.chemistry.GenericChem;
@@ -345,6 +346,15 @@ public final class ModItems {
public static CoreItem itemDetCable;
public static ItemThrowableBomb itemBomb;
+ public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Zombie;
+ public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Skeleton;
+ public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Spider;
+ public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Creeper;
+ public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Enderman;
+
+ public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Nether;
+ public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Infernal;
+
static {
Logger.INFO("Items!");
//Default item used when recipes fail, handy for debugging. Let's make sure they exist when this class is called upon.
@@ -829,7 +839,7 @@ public final class ModItems {
else {
itemHotTitaniumIngot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotHotTitanium", 1);
}
- GT_Values.RA.addBlastRecipe(ELEMENT.getInstance().TITANIUM.getIngot(1), null, itemHotTitaniumIngot, null, 10 * 20, 512, Materials.Titanium.mBlastFurnaceTemp);
+ GT_Values.RA.addBlastRecipe(ELEMENT.getInstance().TITANIUM.getIngot(1), CI.getNumberedCircuit(16), itemHotTitaniumIngot, null, 10 * 20, 500, Materials.Titanium.mBlastFurnaceTemp);
//Special Sillyness
if (true) {
diff --git a/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java b/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java
index 024f6aa907..2cffb8737f 100644
--- a/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java
+++ b/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java
@@ -3,14 +3,18 @@ package gtPlusPlus.core.item.bauble;
import java.util.List;
import baubles.api.BaubleType;
-import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.GT_Values;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.minecraft.AABB;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
import ic2.api.item.ElectricItem;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@@ -20,14 +24,13 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
public class MonsterKillerBaseBauble extends ElectricBaseBauble {
-
- private final int mTier;
+
private final Class[] mTargets;
- public MonsterKillerBaseBauble(Class[] aMonsterBaseClassArray, String aMonsterTypeName, int aPowerTier) {
- super(BaubleType.AMULET, aPowerTier, GT_Values.V[aPowerTier] * 20 * 300, "GTPP.MonsterKiller."+aMonsterTypeName+".name");
- mTier = aPowerTier;
- mTargets = aMonsterBaseClassArray;
+ public MonsterKillerBaseBauble(Class[] aMonsterBaseClassArray, String aMonsterTypeName, int aPowerTier) {
+ super(BaubleType.AMULET, aPowerTier, GT_Values.V[aPowerTier] * 20 * 300,
+ "GTPP.MonsterKiller." + aMonsterTypeName + ".name");
+ mTargets = aMonsterBaseClassArray;
}
@SideOnly(Side.CLIENT)
@@ -56,7 +59,7 @@ public class MonsterKillerBaseBauble extends ElectricBaseBauble {
@Override
public boolean canProvideEnergy(final ItemStack itemStack) {
- double aItemCharge = ElectricItem.manager.getCharge(itemStack);
+ double aItemCharge = ElectricItem.manager.getCharge(itemStack);
return aItemCharge > 0;
}
@@ -78,17 +81,18 @@ public class MonsterKillerBaseBauble extends ElectricBaseBauble {
String aString2 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.2");
String aString3 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.3");
String aString4 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.4");
- String aEU = StatCollector.translateToLocal("GTPP.info.eu");
- String aEUT = aEU+"/t";
+ String aEU = StatCollector.translateToLocal("GTPP.info.eu");
+ String aEUT = aEU + "/t";
list.add(EnumChatFormatting.GREEN + aString1 + EnumChatFormatting.GRAY);
- list.add(EnumChatFormatting.GREEN + aString2+" " + (int) getTransferLimit(stack) + aEUT + aString3 + EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.GREEN + aString2 + " " + (int) getTransferLimit(stack) + aEUT + aString3
+ + EnumChatFormatting.GRAY);
list.add("");
- list.add(""+EnumChatFormatting.GREEN + aString4 + " " + EnumChatFormatting.GRAY);
+ list.add("" + EnumChatFormatting.GREEN + aString4 + " " + EnumChatFormatting.GRAY);
for (Class cz : mTargets) {
- list.add("- "+EnumChatFormatting.DARK_GREEN + cz.getSimpleName() + EnumChatFormatting.GRAY);
+ list.add("- " + EnumChatFormatting.DARK_GREEN + cz.getSimpleName() + EnumChatFormatting.GRAY);
}
-
+
super.addInformation(stack, aPlayer, list, bool);
}
@@ -113,17 +117,57 @@ public class MonsterKillerBaseBauble extends ElectricBaseBauble {
}
@Override // TODO
- public void onWornTick(final ItemStack aBaubleStack, final EntityLivingBase aPlayer) {
+ public void onWornTick(final ItemStack aBaubleStack, final EntityLivingBase aPlayerEntity) {
+ if (aPlayerEntity == null) {
+ return;
+ }
+ EntityPlayer aPlayer = (EntityPlayer) aPlayerEntity;
if (!aPlayer.worldObj.isRemote) {
if (this.getCharge(aBaubleStack) >= getTransferLimit(aBaubleStack)) {
-
+ AABB aPlayerBox = new AABB(aPlayerEntity, 5, 5, 5);
+ if (this.mTargets != null && this.mTargets.length > 0) {
+ for (Class clazz : mTargets) {
+ AutoMap<?> aEnts = EntityUtils.getEntitiesWithinBoundingBox(clazz, aPlayerBox);
+ if (aEnts.isEmpty()) {
+ continue;
+ } else {
+ EntityLiving aClosest = null;
+ double aEntityDistance = Short.MIN_VALUE;
+ for (Object ent : aEnts) {
+ if (!EntityLiving.class.isInstance(ent)) {
+ continue;
+ } else {
+ double aCurEntDis = EntityUtils.getDistance(aPlayerEntity, (Entity) ent);
+ if (aEntityDistance == Short.MIN_VALUE || aCurEntDis < aEntityDistance) {
+ aEntityDistance = aCurEntDis;
+ aClosest = (EntityLiving) ent;
+ }
+ }
+ }
+ if (aClosest != null) {
+ float aEntHealth = aClosest.getHealth();
+ float aEntMaxHealth = aClosest.getMaxHealth();
+ double aEntHealthPerc = MathUtils.findPercentage(aEntHealth, aEntMaxHealth);
+ long aEuUsage = (long) (aEntHealthPerc * 50 * aEntMaxHealth);
+ if (this.discharge(aBaubleStack, aEuUsage, mTier, true, false, false) > 0) {
+ aClosest.setDead();
+ break;
+ }
+ } else {
+ continue;
+ }
+ }
+ }
+ }
+ } else {
+ return;
}
}
}
@Override
public String getTextureNameForBauble() {
- return CORE.MODID+":"+"";
+ return CORE.MODID + ":" + "baubles/itemAmulet";
}
}