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/RenderGiantChicken.java79
-rw-r--r--src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java204
-rw-r--r--src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java1
-rw-r--r--src/Java/gtPlusPlus/core/util/math/MathUtils.java6
4 files changed, 119 insertions, 171 deletions
diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderGiantChicken.java b/src/Java/gtPlusPlus/core/client/renderer/RenderGiantChicken.java
index d3c1e852d9..59621ef830 100644
--- a/src/Java/gtPlusPlus/core/client/renderer/RenderGiantChicken.java
+++ b/src/Java/gtPlusPlus/core/client/renderer/RenderGiantChicken.java
@@ -4,13 +4,9 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderChicken;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLiving;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.util.MathHelper;
+import net.minecraft.entity.passive.EntityChicken;
import net.minecraft.util.ResourceLocation;
-import gtPlusPlus.core.entity.monster.EntityGiantChickenBase;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
@SideOnly(Side.CLIENT)
@@ -37,80 +33,11 @@ public class RenderGiantChicken extends RenderChicken {
}
/**
- * 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(EntityGiantChickenBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
- {
- this.doRender((EntityLiving)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
- }
-
- /**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
- protected ResourceLocation getEntityTexture(EntityGiantChickenBase p_110775_1_)
+ @Override
+ protected ResourceLocation getEntityTexture(EntityChicken p_110775_1_)
{
return chickenTexturesEx;
}
-
- /**
- * Defines what float the third param in setRotationAngles of ModelBase is
- */
- protected float handleRotationFloat(EntityGiantChickenBase p_77044_1_, float p_77044_2_)
- {
- float f1 = p_77044_1_.field_70888_h + (p_77044_1_.field_70886_e - p_77044_1_.field_70888_h) * p_77044_2_;
- float f2 = p_77044_1_.field_70884_g + (p_77044_1_.destPos - p_77044_1_.field_70884_g) * p_77044_2_;
- return (MathHelper.sin(f1) + 1.0F) * f2;
- }
-
- /**
- * 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(EntityLiving p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
- {
- this.doRender((EntityGiantChickenBase)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
- }
-
- /**
- * Defines what float the third param in setRotationAngles of ModelBase is
- */
- protected float handleRotationFloat(EntityLivingBase p_77044_1_, float p_77044_2_)
- {
- return this.handleRotationFloat((EntityGiantChickenBase)p_77044_1_, p_77044_2_);
- }
-
- /**
- * 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(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
- {
- this.doRender((EntityGiantChickenBase)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
- }
-
- /**
- * 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((EntityGiantChickenBase)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_)
- {
- this.doRender((EntityGiantChickenBase)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/entity/monster/EntityStaballoyConstruct.java b/src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java
index 385c3f4441..ff632fe283 100644
--- a/src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java
+++ b/src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java
@@ -30,11 +30,11 @@ public class EntityStaballoyConstruct extends EntityIronGolem {
/*
* Determines whether or not the entity is in a fluid at all.
*/
- private volatile boolean inFluid = false;
- private volatile boolean mReflectFirstUpdate = true;
- private volatile boolean isReadyToExplode = false;
- private volatile int fuse = 60;
- private volatile int attackTimer;
+ private boolean inFluid = false;
+ private boolean mReflectFirstUpdate = true;
+ private boolean isReadyToExplode = false;
+ private int fuse = 60;
+ private int attackTimer;
public EntityStaballoyConstruct(World world) {
super(world);
@@ -256,7 +256,7 @@ public class EntityStaballoyConstruct extends EntityIronGolem {
@Override
public void setPlayerCreated(boolean p_70849_1_) {
-
+
}
/**
@@ -289,83 +289,101 @@ public class EntityStaballoyConstruct extends EntityIronGolem {
this.isImmuneToFire = true;
}
- if (this.getHealth() <= (this.getMaxHealth()*MathUtils.randDouble(0.02, 0.15))){
- float r = MathUtils.randFloat(0, 1);
- if (r <= 0.1){
- this.isReadyToExplode = true;
+ if (!this.worldObj.isRemote) {
+ final float hp = getHealth();
+ final float modifier = MathUtils.randInt(5,10)/100F;
+ final float amountToExplode = (hp*modifier);
+
+ if (hp <= amountToExplode && !isReadyToExplode){
+ if (this.ticksExisted >= 50) {
+ //Logger.INFO("Construct has low hp, trying to enable explosions. HP: "+this.getHealth()+", Max: "+this.getMaxHealth()+", Mod: "+modifier);
+ //Logger.INFO("Construct required HP to be <= "+amountToExplode);
+ float r = MathUtils.randFloat(0, 10);
+ if (r <= 0.1){
+ this.isReadyToExplode = true;
+ //Logger.INFO("Construct can now explode.");
+ }
+ }
}
- }
+ //Handle Exploding
+ else if (hp <= amountToExplode && isReadyToExplode){
+ //Logger.INFO("Trying to explode. ["+this.fuse+"]");
+ if (this.fuse-- <= 0){
+ //Logger.INFO("Fuse has run out.");
+ this.setDead();
+ if (!this.worldObj.isRemote)
+ {
+ this.explode();
+ }
+ }
+ else {
+ //Logger.INFO("Ticking fuse and spawning particles.");
- //Handle Exploding
- if (isReadyToExplode){
- if (this.fuse-- <= 0){
- this.setDead();
+ int maxFuse = 60;
+ int fuseUsed = maxFuse-this.fuse;
+ float var2 = (float) (fuseUsed * 0.1);
- if (!this.worldObj.isRemote)
- {
- this.explode();
- }
- }
- else {
-
- int maxFuse = 60;
- int fuseUsed = maxFuse-this.fuse;
- float var2 = (float) (fuseUsed * 0.1);
-
- this.setSize(1.4F+(var2/2), 2.9F+(var2/2));
-
- float r = MathUtils.randFloat(0, 1);
- int r2 = MathUtils.randInt(5, 15);
- for (int o=0;o<r2;o++){
- if (r <= 0.3){
- this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
+ this.setSize(1.4F+(var2/2), 2.9F+(var2/2));
- }
- else if (r <= 0.6){
- this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
+ float r = MathUtils.randFloat(0, 1);
+ int r2 = MathUtils.randInt(5, 15);
+ for (int o=0;o<r2;o++){
+ if (r <= 0.3){
+ this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
- }
- if (r <= 0.3){
- this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
+ }
+ else if (r <= 0.6){
+ this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
- }
- else if (r <= 0.7){
- this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
+ }
+ if (r <= 0.3){
+ this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
- }
- if (r <= 0.2){
- this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
+ }
+ else if (r <= 0.7){
+ this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
- }
- else if (r <= 0.5){
- this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
+ }
+ if (r <= 0.2){
+ this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
- }
- else if (r <= 0.7){
- this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
+ }
+ else if (r <= 0.5){
+ this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
+
+ }
+ else if (r <= 0.7){
+ this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
+ }
}
- }
-
- }
- }
- //Get a private field from a super class if it exists.
- try {
- if (ReflectionUtils.getField(Class.forName("net.minecraft.entity.Entity"), "firstUpdate") != null && mReflectFirstUpdate == true){
- Field x = ReflectionUtils.getField(Class.forName("net.minecraft.entity.Entity"), "firstUpdate");
- try {
- this.mReflectFirstUpdate = (boolean) x.get(this);
- Logger.REFLECTION("Successfully got 'firstUpdate' variable state via reflection.");
+ }
+ }
+ else {
+
+ }
+
+ //Get a private field from a super class if it exists.
+ try {
+ if (mFirstUpdateField == null) {
+ mFirstUpdateField = ReflectionUtils.getField(Class.forName("net.minecraft.entity.Entity"), "firstUpdate");
+ }
+ if (mFirstUpdateField != null && mReflectFirstUpdate == true){
+ try {
+ this.mReflectFirstUpdate = (boolean) mFirstUpdateField.get(this);
+ }
+ catch (IllegalArgumentException | IllegalAccessException e) {}
}
- catch (IllegalArgumentException | IllegalAccessException e) {}
}
+ catch (NoSuchFieldException | ClassNotFoundException e) {}
}
- catch (NoSuchFieldException | ClassNotFoundException e) {}
super.onEntityUpdate();
}
+ private Field mFirstUpdateField;
+
@Override
public int getMaxSpawnedInChunk() {
return 1;
@@ -483,43 +501,45 @@ public class EntityStaballoyConstruct extends EntityIronGolem {
/* float f = 12.0F;
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true);*/
- final float f = 6.5F;
- ExplosionHandler explode = new ExplosionHandler();
- explode.createExplosion(this.worldObj, this, this.posX, this.posY, this.posZ, f, true, true);
-
- float r = MathUtils.randFloat(0, 1);
- int r2 = MathUtils.randInt(20, 40);
- for (int o=0;o<r2;o++){
- if (r <= 0.3){
- this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(0, 3), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
+ if (!this.worldObj.isRemote) {
+ final float f = 6.5F;
+ ExplosionHandler explode = new ExplosionHandler();
+ explode.createExplosion(this.worldObj, this, this.posX, this.posY, this.posZ, f, true, true);
- }
- else if (r <= 0.6){
- this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
+ float r = MathUtils.randFloat(0, 1);
+ int r2 = MathUtils.randInt(20, 40);
+ for (int o=0;o<r2;o++){
+ if (r <= 0.3){
+ this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(0, 3), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
- }
- if (r <= 0.3){
- this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
+ }
+ else if (r <= 0.6){
+ this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
- }
- else if (r <= 0.7){
- this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
+ }
+ if (r <= 0.3){
+ this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
- }
- if (r <= 0.2){
- this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
+ }
+ else if (r <= 0.7){
+ this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
- }
- else if (r <= 0.5){
- this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
+ }
+ if (r <= 0.2){
+ this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
- }
- else if (r <= 0.7){
- this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
+ }
+ else if (r <= 0.5){
+ this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
+
+ }
+ else if (r <= 0.7){
+ this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
+ }
}
}
-
+
}
@Override
diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
index efbb4add7e..1d4ebaaa0c 100644
--- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
+++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
@@ -115,6 +115,7 @@ public class COMPAT_HANDLER {
GregtechBufferDynamos.run();
GregtechAmazonWarehouse.run();
GregtechIndustrialCryogenicFreezer.run();
+ GregtechThaumcraftDevices.run();
//New Horizons Content
NewHorizonsAccelerator.run();
diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java
index 16e7f665ea..cda463ff10 100644
--- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java
+++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java
@@ -365,13 +365,13 @@ public class MathUtils {
}
public static int getRandomFromArray(int[] mValues) {
- int[] mLargeChanceArray = new int[mValues.length*1000];
+ int[] mLargeChanceArray = new int[(mValues.length-1)*1000];
int mValueSelection;
for (int g = 0; g < mLargeChanceArray.length; g++) {
- mValueSelection = randInt(0, mValues.length);
+ mValueSelection = randInt(0, mValues.length-1);
mLargeChanceArray[g] = mValues[mValueSelection];
}
- return mLargeChanceArray[randInt(0, mLargeChanceArray.length)];
+ return mLargeChanceArray[randInt(0, mLargeChanceArray.length-1)];
}