aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core')
-rw-r--r--src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java11
-rw-r--r--src/Java/gtPlusPlus/core/client/renderer/RenderPlasmaBolt.java165
-rw-r--r--src/Java/gtPlusPlus/core/common/CommonProxy.java5
-rw-r--r--src/Java/gtPlusPlus/core/entity/EntityTeslaTowerLightning.java133
-rw-r--r--src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java24
-rw-r--r--src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java1
-rw-r--r--src/Java/gtPlusPlus/core/material/Material.java106
-rw-r--r--src/Java/gtPlusPlus/core/proxy/ClientProxy.java6
-rw-r--r--src/Java/gtPlusPlus/core/util/entity/EntityUtils.java37
9 files changed, 434 insertions, 54 deletions
diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java b/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java
index 42071428a7..359229adaa 100644
--- a/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java
+++ b/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java
@@ -6,6 +6,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.entity.EntityPrimedMiningExplosive;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureMap;
@@ -28,7 +29,7 @@ public class RenderMiningExplosivesPrimed extends Render {
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
- public void doRender(final EntityTNTPrimed entity, final double p_76986_2_, final double p_76986_4_, final double p_76986_6_, final float p_76986_8_, final float p_76986_9_){
+ public void doRender(final EntityPrimedMiningExplosive entity, final double p_76986_2_, final double p_76986_4_, final double p_76986_6_, final float p_76986_8_, final float p_76986_9_){
Logger.INFO("Rendering Mining Explosion. 2");
GL11.glPushMatrix();
GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
@@ -78,7 +79,7 @@ public class RenderMiningExplosivesPrimed extends Render {
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
- protected ResourceLocation getEntityTexture(final EntityTNTPrimed p_110775_1_){
+ protected ResourceLocation getEntityTexture(final EntityPrimedMiningExplosive p_110775_1_){
return TextureMap.locationBlocksTexture;
}
@@ -87,7 +88,8 @@ public class RenderMiningExplosivesPrimed extends Render {
*/
@Override
protected ResourceLocation getEntityTexture(final Entity p_110775_1_){
- return this.getEntityTexture((EntityTNTPrimed)p_110775_1_);
+ Logger.INFO("Rendering Mining Explosion. 4");
+ return this.getEntityTexture((EntityPrimedMiningExplosive)p_110775_1_);
}
/**
@@ -98,6 +100,7 @@ public class RenderMiningExplosivesPrimed extends Render {
*/
@Override
public void doRender(final Entity p_76986_1_, final double p_76986_2_, final double p_76986_4_, final double p_76986_6_, final float p_76986_8_, final float p_76986_9_){
- this.doRender((EntityTNTPrimed)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
+ Logger.INFO("Rendering Mining Explosion. 3");
+ this.doRender((EntityPrimedMiningExplosive)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderPlasmaBolt.java b/src/Java/gtPlusPlus/core/client/renderer/RenderPlasmaBolt.java
new file mode 100644
index 0000000000..673fdff733
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/client/renderer/RenderPlasmaBolt.java
@@ -0,0 +1,165 @@
+package gtPlusPlus.core.client.renderer;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.api.objects.CSPRNG;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.entity.EntityTeslaTowerLightning;
+
+import java.util.Random;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.entity.Render;
+import net.minecraft.entity.Entity;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+@SideOnly(Side.CLIENT)
+public class RenderPlasmaBolt extends Render {
+
+ public RenderPlasmaBolt(){
+ Logger.INFO("[Render] Create custom lightning renderer.");
+ }
+
+ /**
+ * Actually renders the given argument. This is a synthetic bridge method,
+ * always casting down its argument and then handing it off to a worker
+ * function which does the actual work. In all probabilty, the class Render
+ * is generic (Render<T extends Entity) and this method has signature public
+ * void func_76986_a(T entity, double d, double d1, double d2, float f,
+ * float f1). But JAD is pre 1.5 so doesn't do that.
+ */
+ public void doRender(EntityTeslaTowerLightning p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_,
+ float p_76986_8_, float p_76986_9_) {
+ Logger.INFO("Render 1");
+ Tessellator tessellator = Tessellator.instance;
+ GL11.glDisable(GL11.GL_TEXTURE_2D);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
+ double[] adouble = new double[8];
+ double[] adouble1 = new double[8];
+ double d3 = 0.0D;
+ double d4 = 0.0D;
+ Random random = CSPRNG.generate(new Random(p_76986_1_.boltVertex));
+
+ for (int i = 7; i >= 0; --i) {
+ adouble[i] = d3;
+ adouble1[i] = d4;
+ d3 += (double) (random.nextInt(11) - 5);
+ d4 += (double) (random.nextInt(11) - 5);
+ }
+
+ for (int k1 = 0; k1 < 4; ++k1) {
+ Random random1 = CSPRNG.generate(new Random(p_76986_1_.boltVertex));
+
+ for (int j = 0; j < 3; ++j) {
+ int k = 7;
+ int l = 0;
+
+ if (j > 0) {
+ k = 7 - j;
+ }
+
+ if (j > 0) {
+ l = k - 2;
+ }
+
+ double d5 = adouble[k] - d3;
+ double d6 = adouble1[k] - d4;
+
+ for (int i1 = k; i1 >= l; --i1) {
+ double d7 = d5;
+ double d8 = d6;
+
+ if (j == 0) {
+ d5 += (double) (random1.nextInt(11) - 5);
+ d6 += (double) (random1.nextInt(11) - 5);
+ }
+ else {
+ d5 += (double) (random1.nextInt(31) - 15);
+ d6 += (double) (random1.nextInt(31) - 15);
+ }
+
+ tessellator.startDrawing(5);
+ float f2 = 0.5F;
+ tessellator.setColorRGBA_F(0.9F * f2, 0.9F * f2, 1.0F * f2, 0.3F);
+ double d9 = 0.1D + (double) k1 * 0.2D;
+
+ if (j == 0) {
+ d9 *= (double) i1 * 0.1D + 1.0D;
+ }
+
+ double d10 = 0.1D + (double) k1 * 0.2D;
+
+ if (j == 0) {
+ d10 *= (double) (i1 - 1) * 0.1D + 1.0D;
+ }
+
+ for (int j1 = 0; j1 < 5; ++j1) {
+ double d11 = p_76986_2_ + 0.5D - d9;
+ double d12 = p_76986_6_ + 0.5D - d9;
+
+ if (j1 == 1 || j1 == 2) {
+ d11 += d9 * 2.0D;
+ }
+
+ if (j1 == 2 || j1 == 3) {
+ d12 += d9 * 2.0D;
+ }
+
+ double d13 = p_76986_2_ + 0.5D - d10;
+ double d14 = p_76986_6_ + 0.5D - d10;
+
+ if (j1 == 1 || j1 == 2) {
+ d13 += d10 * 2.0D;
+ }
+
+ if (j1 == 2 || j1 == 3) {
+ d14 += d10 * 2.0D;
+ }
+
+ tessellator.addVertex(d13 + d5, p_76986_4_ + (double) (i1 * 16), d14 + d6);
+ tessellator.addVertex(d11 + d7, p_76986_4_ + (double) ((i1 + 1) * 16), d12 + d8);
+ }
+
+ tessellator.draw();
+ }
+ }
+ }
+
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glEnable(GL11.GL_TEXTURE_2D);
+ }
+
+ /**
+ * Returns the location of an entity's texture. Doesn't seem to be called
+ * unless you call Render.bindEntityTexture.
+ */
+ protected ResourceLocation getEntityTexture(EntityTeslaTowerLightning p_110775_1_) {
+ return null;
+ }
+
+ /**
+ * Returns the location of an entity's texture. Doesn't seem to be called
+ * unless you call Render.bindEntityTexture.
+ */
+ protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
+ return this.getEntityTexture((EntityTeslaTowerLightning) p_110775_1_);
+ }
+
+ /**
+ * Actually renders the given argument. This is a synthetic bridge method,
+ * always casting down its argument and then handing it off to a worker
+ * function which does the actual work. In all probabilty, the class Render
+ * is generic (Render<T extends Entity) and this method has signature public
+ * void func_76986_a(T entity, double d, double d1, double d2, float f,
+ * float f1). But JAD is pre 1.5 so doesn't do that.
+ */
+ public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_,
+ float p_76986_9_) {
+ Logger.INFO("Render 2");
+ this.doRender((EntityTeslaTowerLightning) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_,
+ p_76986_9_);
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java
index 11be6f5f2d..532da59515 100644
--- a/src/Java/gtPlusPlus/core/common/CommonProxy.java
+++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java
@@ -71,6 +71,8 @@ public class CommonProxy {
registerEntities();
Logger.INFO("[Proxy] Calling Tile Entity registrator.");
registerTileEntities();
+ Logger.INFO("[Proxy] Calling Render registrator.");
+ registerRenderThings();
}
@@ -104,9 +106,6 @@ public class CommonProxy {
* End of Subscribe Event registration.
*/
- Logger.INFO("[Proxy] Calling Render registrator.");
- registerRenderThings();
-
//Compat Handling
COMPAT_HANDLER.registerMyModsOreDictEntries();
COMPAT_HANDLER.intermodOreDictionarySupport();
diff --git a/src/Java/gtPlusPlus/core/entity/EntityTeslaTowerLightning.java b/src/Java/gtPlusPlus/core/entity/EntityTeslaTowerLightning.java
new file mode 100644
index 0000000000..2a7effbe8a
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/entity/EntityTeslaTowerLightning.java
@@ -0,0 +1,133 @@
+package gtPlusPlus.core.entity;
+import java.util.List;
+
+import gtPlusPlus.api.damage.DamageTeslaTower;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.util.entity.EntityUtils;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.effect.EntityWeatherEffect;
+import net.minecraft.init.Blocks;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.EnumDifficulty;
+import net.minecraft.world.World;
+
+public class EntityTeslaTowerLightning extends EntityWeatherEffect
+{
+ /** Declares which state the lightning bolt is in. Whether it's in the air, hit the ground, etc. */
+ private int lightningState;
+ /** A random long that is used to change the vertex of the lightning rendered in RenderLightningBolt */
+ public long boltVertex;
+ /** Determines the time before the EntityLightningBolt is destroyed. It is a random integer decremented over time. */
+ private int boltLivingTime;
+
+ public EntityTeslaTowerLightning(World p_i1703_1_, double p_i1703_2_, double p_i1703_4_, double p_i1703_6_)
+ {
+ super(p_i1703_1_);
+ this.setLocationAndAngles(p_i1703_2_, p_i1703_4_, p_i1703_6_, 0.0F, 0.0F);
+ this.lightningState = 2;
+ this.boltVertex = this.rand.nextLong();
+ this.boltLivingTime = this.rand.nextInt(3) + 1;
+
+ //Puts fires out
+ if (!p_i1703_1_.isRemote && p_i1703_1_.getGameRules().getGameRuleBooleanValue("doFireTick") && (p_i1703_1_.difficultySetting == EnumDifficulty.NORMAL || p_i1703_1_.difficultySetting == EnumDifficulty.HARD) && p_i1703_1_.doChunksNearChunkExist(MathHelper.floor_double(p_i1703_2_), MathHelper.floor_double(p_i1703_4_), MathHelper.floor_double(p_i1703_6_), 10))
+ {
+ int i = MathHelper.floor_double(p_i1703_2_);
+ int j = MathHelper.floor_double(p_i1703_4_);
+ int k = MathHelper.floor_double(p_i1703_6_);
+
+ if (p_i1703_1_.getBlock(i, j, k).getMaterial() == Material.fire)
+ {
+ p_i1703_1_.setBlock(i, j, k, Blocks.air);
+ }
+
+ for (i = 0; i < 4; ++i)
+ {
+ j = MathHelper.floor_double(p_i1703_2_) + this.rand.nextInt(3) - 1;
+ k = MathHelper.floor_double(p_i1703_4_) + this.rand.nextInt(3) - 1;
+ int l = MathHelper.floor_double(p_i1703_6_) + this.rand.nextInt(3) - 1;
+
+ if (p_i1703_1_.getBlock(j, k, l).getMaterial() == Material.fire)
+ {
+ p_i1703_1_.setBlock(j, k, l, Blocks.air);
+ }
+ }
+ }
+ }
+
+ /**
+ * Called to update the entity's position/logic.
+ */
+ public void onUpdate()
+ {
+ //Logger.INFO("Zap");
+ super.onUpdate();
+
+ if (this.lightningState == 2)
+ {
+ this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
+ }
+ --this.lightningState;
+ if (this.lightningState < 0)
+ {
+ if (this.boltLivingTime == 0)
+ {
+ this.setDead();
+ }
+ else if (this.lightningState < -this.rand.nextInt(10))
+ {
+ --this.boltLivingTime;
+ this.lightningState = 1;
+ this.boltVertex = this.rand.nextLong();
+ //Puts fires out.
+ if (!this.worldObj.isRemote && this.worldObj.getGameRules().getGameRuleBooleanValue("doFireTick") && this.worldObj.doChunksNearChunkExist(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ), 10))
+ {
+ int i = MathHelper.floor_double(this.posX);
+ int j = MathHelper.floor_double(this.posY);
+ int k = MathHelper.floor_double(this.posZ);
+
+ if (this.worldObj.getBlock(i, j, k).getMaterial() == Material.fire)
+ {
+ this.worldObj.setBlock(i, j, k, Blocks.air);
+ }
+ }
+
+ }
+ }
+
+ if (this.lightningState >= 0)
+ {
+ if (this.worldObj.isRemote)
+ {
+ this.worldObj.lastLightningBolt = 2;
+ }
+ else
+ {
+ double d0 = 3.0D;
+ List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getBoundingBox(this.posX - d0, this.posY - d0, this.posZ - d0, this.posX + d0, this.posY + 6.0D + d0, this.posZ + d0));
+
+ for (int l = 0; l < list.size(); ++l)
+ {
+ Entity entity = (Entity)list.get(l);
+ //if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(entity, this))
+ EntityUtils.doFireDamage(entity, 5);
+ EntityUtils.doDamage(entity, new DamageTeslaTower(entity), 20);
+ }
+ }
+ }
+ }
+
+ protected void entityInit() {}
+
+ /**
+ * (abstract) Protected helper method to read subclass entity data from NBT.
+ */
+ protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {}
+
+ /**
+ * (abstract) Protected helper method to write subclass entity data to NBT.
+ */
+ protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {}
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java b/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java
index 5233c876e9..a33596b76a 100644
--- a/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java
+++ b/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java
@@ -15,14 +15,34 @@ public class InternalEntityRegistry {
public static void registerEntities(){
Logger.INFO("Registering GT++ Entities.");
- //EntityRegistry.registerModEntity(EntityMiningChargePrimed.class, "MiningCharge", 3, Main.modInstance, 64, 20, true);
+
+ EntityRegistry.registerGlobalEntityID(EntityPrimedMiningExplosive.class, "MiningCharge", EntityRegistry.findGlobalUniqueEntityId());
EntityRegistry.registerModEntity(EntityPrimedMiningExplosive.class, "MiningCharge", mEntityID++, GTplusplus.instance, 64, 20, true);
+
+
+ EntityRegistry.registerGlobalEntityID(EntitySulfuricAcidPotion.class, "throwablePotionSulfuric", EntityRegistry.findGlobalUniqueEntityId());
EntityRegistry.registerModEntity(EntitySulfuricAcidPotion.class, "throwablePotionSulfuric", mEntityID++, GTplusplus.instance, 64, 20, true);
+
+
+ EntityRegistry.registerGlobalEntityID(EntityHydrofluoricAcidPotion.class, "throwablePotionHydrofluoric", EntityRegistry.findGlobalUniqueEntityId());
EntityRegistry.registerModEntity(EntityHydrofluoricAcidPotion.class, "throwablePotionHydrofluoric", mEntityID++, GTplusplus.instance, 64, 20, true);
+
+
+ EntityRegistry.registerGlobalEntityID(EntityToxinballSmall.class, "toxinBall", EntityRegistry.findGlobalUniqueEntityId());
EntityRegistry.registerModEntity(EntityToxinballSmall.class, "toxinBall", mEntityID++, GTplusplus.instance, 64, 20, true);
+
+
+ EntityRegistry.registerGlobalEntityID(EntityStaballoyConstruct.class, "constructStaballoy", EntityRegistry.findGlobalUniqueEntityId());
EntityRegistry.registerModEntity(EntityStaballoyConstruct.class, "constructStaballoy", mEntityID++, GTplusplus.instance, 64, 20, true);
+
+
+ EntityRegistry.registerGlobalEntityID(EntitySickBlaze.class, "sickBlaze", EntityRegistry.findGlobalUniqueEntityId());
EntityRegistry.registerModEntity(EntitySickBlaze.class, "sickBlaze", mEntityID++, GTplusplus.instance, 64, 20, true);
-
+
+
+ EntityRegistry.registerGlobalEntityID(EntityTeslaTowerLightning.class, "plasmaBolt", EntityRegistry.findGlobalUniqueEntityId());
+ EntityRegistry.registerModEntity(EntityTeslaTowerLightning.class, "plasmaBolt", mEntityID++, GTplusplus.instance, 64, 5, true);
+
}
}
diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
index 14f281b2e9..c6aff47c5b 100644
--- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
+++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
@@ -101,6 +101,7 @@ public class COMPAT_HANDLER {
GregtechIndustrialCuttingFactory.run();
GregtechMiniRaFusion.run();
GregtechComponentAssembler.run();
+ GregtechTeslaTower.run();
//New Horizons Content
NewHorizonsAccelerator.run();
diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java
index b04ce3baac..c8637f5aeb 100644
--- a/src/Java/gtPlusPlus/core/material/Material.java
+++ b/src/Java/gtPlusPlus/core/material/Material.java
@@ -761,66 +761,86 @@ public class Material {
final public int calculateMeltingPoint(){
- int meltingPoint = 0;
- for (MaterialStack part : this.vMaterialInput){
- if (part != null){
- int incrementor = part.getStackMaterial().getMeltingPointC();
- meltingPoint += incrementor;
- Logger.WARNING("Melting Point for "+this.getLocalizedName()+" increased to "+ incrementor);
- }
- else {
- Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition.");
+ try {
+ int meltingPoint = 0;
+ for (MaterialStack part : this.vMaterialInput){
+ if (part != null){
+ int incrementor = part.getStackMaterial().getMeltingPointC();
+ meltingPoint += incrementor;
+ Logger.WARNING("Melting Point for "+this.getLocalizedName()+" increased to "+ incrementor);
+ }
+ else {
+ Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition.");
+ }
}
+ int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1);
+ Logger.WARNING("Dividing "+meltingPoint+" / "+divisor+" to get average melting point.");
+ meltingPoint = (meltingPoint/divisor);
+ return meltingPoint;
+ }
+ catch (Throwable r){
+ return 500;
}
- int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1);
- Logger.WARNING("Dividing "+meltingPoint+" / "+divisor+" to get average melting point.");
- meltingPoint = (meltingPoint/divisor);
- return meltingPoint;
}
final public int calculateBoilingPoint(){
- int boilingPoint = 0;
- for (MaterialStack part : this.vMaterialInput){
- if (part != null){
- boilingPoint += part.getStackMaterial().getBoilingPointC();
- }
- else {
- Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition.");
+ try {
+ int boilingPoint = 0;
+ for (MaterialStack part : this.vMaterialInput){
+ if (part != null){
+ boilingPoint += part.getStackMaterial().getBoilingPointC();
+ }
+ else {
+ Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition.");
+ }
}
+ int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1);
+ boilingPoint = (boilingPoint/divisor);
+ return boilingPoint;
+ }
+ catch (Throwable r){
+ return 2500;
}
- int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1);
- boilingPoint = (boilingPoint/divisor);
- return boilingPoint;
}
final public long calculateProtons(){
- long protonCount = 0;
- for (MaterialStack part : this.vMaterialInput){
- if (part != null){
- protonCount += (part.getStackMaterial().getProtons());
- }
- else {
- Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition.");
+ try {
+ long protonCount = 0;
+ for (MaterialStack part : this.vMaterialInput){
+ if (part != null){
+ protonCount += (part.getStackMaterial().getProtons());
+ }
+ else {
+ Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition.");
+ }
}
+ int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1);
+ protonCount = (protonCount/divisor);
+ return protonCount;
+ }
+ catch (Throwable r){
+ return 50;
}
- int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1);
- protonCount = (protonCount/divisor);
- return protonCount;
}
final public long calculateNeutrons(){
- long neutronCount = 0;
- for (MaterialStack part : this.vMaterialInput){
- if (part != null){
- neutronCount += (part.getStackMaterial().getNeutrons());
- }
- else {
- Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition.");
+ try {
+ long neutronCount = 0;
+ for (MaterialStack part : this.vMaterialInput){
+ if (part != null){
+ neutronCount += (part.getStackMaterial().getNeutrons());
+ }
+ else {
+ Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition.");
+ }
}
+ int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1);
+ neutronCount = (neutronCount/divisor);
+ return neutronCount;
+ }
+ catch (Throwable r){
+ return 75;
}
- int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1);
- neutronCount = (neutronCount/divisor);
- return neutronCount;
}
diff --git a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java
index 712df63e67..f20c3ef91a 100644
--- a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java
+++ b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java
@@ -17,8 +17,10 @@ import gtPlusPlus.core.client.renderer.*;
import gtPlusPlus.core.common.CommonProxy;
import gtPlusPlus.core.common.compat.COMPAT_PlayerAPI;
import gtPlusPlus.core.entity.EntityPrimedMiningExplosive;
+import gtPlusPlus.core.entity.EntityTeslaTowerLightning;
import gtPlusPlus.core.entity.monster.EntitySickBlaze;
import gtPlusPlus.core.entity.monster.EntityStaballoyConstruct;
+import gtPlusPlus.core.entity.projectile.EntityHydrofluoricAcidPotion;
import gtPlusPlus.core.entity.projectile.EntitySulfuricAcidPotion;
import gtPlusPlus.core.entity.projectile.EntityToxinballSmall;
import gtPlusPlus.core.handler.render.FirepitRender;
@@ -30,6 +32,7 @@ import gtPlusPlus.core.util.particles.EntityParticleFXMysterious;
import gtPlusPlus.xmod.gregtech.common.render.GTPP_CapeRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
+import net.minecraft.client.renderer.entity.RenderLightningBolt;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.entity.Entity;
@@ -96,7 +99,8 @@ public class ClientProxy extends CommonProxy implements Runnable{
RenderingRegistry.registerEntityRenderingHandler(EntityToxinballSmall.class, new RenderToxinball(1F));
Logger.INFO("Registering Custom Renderer for Sulfuric potion.");
RenderingRegistry.registerEntityRenderingHandler(EntitySulfuricAcidPotion.class, new RenderSnowball(ModItems.itemSulfuricPotion));
-
+ RenderingRegistry.registerEntityRenderingHandler(EntityHydrofluoricAcidPotion.class, new RenderSnowball(ModItems.itemHydrofluoricPotion));
+ RenderingRegistry.registerEntityRenderingHandler(EntityTeslaTowerLightning.class, new RenderLightningBolt());
//ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBloodSteelChest.class, new BloodSteelChestRenderer());
//MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.tutChest), new ItemRenderBloodSteelChest());
diff --git a/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java b/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java
index 60b05a308f..90b4b2b22c 100644
--- a/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java
+++ b/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java
@@ -1,12 +1,17 @@
package gtPlusPlus.core.util.entity;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
import cpw.mods.fml.common.registry.EntityRegistry;
import gregtech.api.util.GT_Utility;
import gtPlusPlus.core.util.array.BlockPos;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
import ic2.core.IC2Potion;
import ic2.core.item.armor.ItemArmorHazmat;
import net.minecraft.block.Block;
import net.minecraft.entity.*;
+import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
@@ -36,7 +41,7 @@ public class EntityUtils {
final int blockZ = MathHelper.floor_double(parEntity.posZ);
return parEntity.worldObj.getBlock(blockX, blockY, blockZ);
}
-
+
public static BlockPos findBlockPosUnderEntity(final Entity parEntity){
final int blockX = MathHelper.floor_double(parEntity.posX);
final int blockY = MathHelper.floor_double(parEntity.boundingBox.minY)-1;
@@ -72,4 +77,34 @@ public class EntityUtils {
return false;
}
+
+ /**
+ * Static Version of the method used in {@code doFireDamage(entity, int)} to save memory.
+ */
+ private static volatile Method dealFireDamage;
+
+ /**
+ * Reflective Call to do Fire Damage to an entity (Does not set entity on fire though)
+ */
+ public static boolean doFireDamage(Entity entity, int amount){
+ if (dealFireDamage == null){
+ try {
+ dealFireDamage = Entity.class.getDeclaredMethod("dealFireDamage", int.class);
+ dealFireDamage.setAccessible(true);
+ }
+ catch (NoSuchMethodException | SecurityException e) {}
+ }
+ else {
+ try {
+ dealFireDamage.invoke(entity, amount);
+ }
+ catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {}
+ }
+ return false;
+ }
+
+ public static void doDamage(Entity entity, DamageSource dmg, int i) {
+ entity.attackEntityFrom(dmg, i);
+ }
+
}