aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2017-09-24 19:05:03 +1000
committerAlkalus <draknyte1@hotmail.com>2017-09-24 19:05:03 +1000
commitbf75cef777ce71bdb3be87519216c6f984d3994f (patch)
tree06dbf8175d4fbf32dc41463e403a125daf82a1cc /src/Java/gtPlusPlus
parent160aeab1167363fc38cf348a8fe413ab829c8612 (diff)
downloadGT5-Unofficial-bf75cef777ce71bdb3be87519216c6f984d3994f.tar.gz
GT5-Unofficial-bf75cef777ce71bdb3be87519216c6f984d3994f.tar.bz2
GT5-Unofficial-bf75cef777ce71bdb3be87519216c6f984d3994f.zip
+ Added a throwable potion of sulfuric acid.
Diffstat (limited to 'src/Java/gtPlusPlus')
-rw-r--r--src/Java/gtPlusPlus/core/entity/projectile/EntitySulfuricAcidPotion.java51
-rw-r--r--src/Java/gtPlusPlus/core/item/ModItems.java3
-rw-r--r--src/Java/gtPlusPlus/core/item/general/ItemSulfuricAcidPotion.java28
-rw-r--r--src/Java/gtPlusPlus/core/util/nbt/NBTUtils.java5
4 files changed, 84 insertions, 3 deletions
diff --git a/src/Java/gtPlusPlus/core/entity/projectile/EntitySulfuricAcidPotion.java b/src/Java/gtPlusPlus/core/entity/projectile/EntitySulfuricAcidPotion.java
new file mode 100644
index 0000000000..6f4c57f294
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/entity/projectile/EntitySulfuricAcidPotion.java
@@ -0,0 +1,51 @@
+package gtPlusPlus.core.entity.projectile;
+
+import gtPlusPlus.core.util.entity.EntityUtils;
+import gtPlusPlus.core.util.math.MathUtils;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.projectile.EntityThrowable;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.world.World;
+
+public class EntitySulfuricAcidPotion extends EntityThrowable {
+
+ public EntitySulfuricAcidPotion(World world) {
+ super(world);
+ }
+
+ public EntitySulfuricAcidPotion(World world, EntityLivingBase entity) {
+ super(world, entity);
+ }
+
+ public EntitySulfuricAcidPotion(World world, double posX, double posY, double posZ) {
+ super(world, posX, posY, posZ);
+ }
+
+ /**
+ * Called when this EntityThrowable hits a block or entity.
+ */
+ protected void onImpact(MovingObjectPosition object) {
+ if (object.entityHit != null) {
+ byte b0 = 6;
+ object.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float) b0);
+ EntityUtils.setEntityOnFire(object.entityHit, 10);
+ }
+
+ String mParticleType = "reddust";
+ int e=0;
+ for (int i = 0; i < 24; ++i) {
+ if ((e = MathUtils.randInt(0, 5)) <= 1){
+ if (e==0)
+ mParticleType = "largesmoke";
+ if (e==1)
+ mParticleType = "flame";
+ }
+ this.worldObj.spawnParticle(mParticleType, this.posX+MathUtils.randDouble(0, 2), this.posY+MathUtils.randDouble(0, 2), this.posZ+MathUtils.randDouble(0, 2), 0.0D, 0.0D, 0.0D);
+ }
+
+ if (!this.worldObj.isRemote) {
+ this.setDead();
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java
index 685d918ae6..cfd8fae7b0 100644
--- a/src/Java/gtPlusPlus/core/item/ModItems.java
+++ b/src/Java/gtPlusPlus/core/item/ModItems.java
@@ -228,6 +228,7 @@ public final class ModItems {
public static Item itemPlateVanadium;
+ public static Item itemSulfuricPotion;
@@ -294,7 +295,7 @@ public final class ModItems {
itemGemShards = new ItemGemShards("itemGemShards", "Gem Shards", AddToCreativeTab.tabMisc, 32, 0, "They glitter in the light", EnumRarity.rare, EnumChatFormatting.GRAY, false, Utils.rgbtoHexValue(182, 114, 18)).setTextureName(CORE.MODID + ":itemHeliumBlob");
itemHalfCompleteCasings = new ItemHalfCompleteCasings("itemHalfCompleteCasings", "Half Complete Casing", AddToCreativeTab.tabMisc, 32, 0, "This isn't quite finished yet.", EnumRarity.common, EnumChatFormatting.GRAY, false, Utils.rgbtoHexValue(255, 255, 255)).setTextureName("gregtech" + ":" + "gt.metaitem.01/" + "761");
-
+ itemSulfuricPotion = new ItemSulfuricAcidPotion("itemSulfuricPotion", "Thowable Vial of Sulfuric Acid", "Burn your foes alive!").setTextureName(CORE.MODID + ":itemSulfuricAcidPotion");
//Start meta Item Generation
ItemsFoods.load();
diff --git a/src/Java/gtPlusPlus/core/item/general/ItemSulfuricAcidPotion.java b/src/Java/gtPlusPlus/core/item/general/ItemSulfuricAcidPotion.java
new file mode 100644
index 0000000000..885919dccb
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/general/ItemSulfuricAcidPotion.java
@@ -0,0 +1,28 @@
+package gtPlusPlus.core.item.general;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.entity.projectile.EntitySulfuricAcidPotion;
+import gtPlusPlus.core.item.base.CoreItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+public class ItemSulfuricAcidPotion extends CoreItem {
+
+ public ItemSulfuricAcidPotion(String unlocalizedName, String displayName, String description) {
+ super(unlocalizedName, displayName, AddToCreativeTab.tabMisc, 16, 0, description, EnumRarity.common, EnumChatFormatting.GRAY, false, null);
+ }
+
+ public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) {
+ if (!player.capabilities.isCreativeMode) {
+ --item.stackSize;
+ }
+ world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
+ if (!world.isRemote) {
+ world.spawnEntityInWorld(new EntitySulfuricAcidPotion(world, player));
+ }
+ return item;
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/util/nbt/NBTUtils.java b/src/Java/gtPlusPlus/core/util/nbt/NBTUtils.java
index 636fb60e6b..72784c29a7 100644
--- a/src/Java/gtPlusPlus/core/util/nbt/NBTUtils.java
+++ b/src/Java/gtPlusPlus/core/util/nbt/NBTUtils.java
@@ -175,7 +175,7 @@ public class NBTUtils {
}
public static boolean tryIterateNBTData(ItemStack aStack) {
- try {
+ /*try {
NBTTagCompound aNBT = NBTUtils.getNBT(aStack);
if (aNBT != null) {
if (!aNBT.hasNoTags()) {
@@ -197,7 +197,8 @@ public class NBTUtils {
return true;
} catch (Throwable t) {
return false;
- }
+ }*/
+ return false;
}
}