From 7e0c8425eca0e2ea097e4aad0d44ed8cdb0f4690 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Fri, 25 May 2018 13:40:27 +1000 Subject: + Added loader for Thaumcraft Researcher Machine. $ Fixed Staballoy constructs exploding as soon as they spawn. $ Fixed chicken renderer. $ Fixed a bug arising from getRandomFromArray(int[]) where it could get index OOB. --- .../entity/monster/EntityStaballoyConstruct.java | 204 +++++++++++---------- 1 file changed, 112 insertions(+), 92 deletions(-) (limited to 'src/Java/gtPlusPlus/core/entity') 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