aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2017-03-18 12:09:58 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2017-03-18 12:09:58 +1000
commit435eec1dfe0aec63d22875fb2189e69d2b1fa999 (patch)
tree10861db62cde2482869b75ded13df3e3c4eba9cb /src
parent776f96df847e2337549d4298d51015aff4d0c0d9 (diff)
downloadGT5-Unofficial-435eec1dfe0aec63d22875fb2189e69d2b1fa999.tar.gz
GT5-Unofficial-435eec1dfe0aec63d22875fb2189e69d2b1fa999.tar.bz2
GT5-Unofficial-435eec1dfe0aec63d22875fb2189e69d2b1fa999.zip
+ Added a delay to the mod update message upon login, so it's easier to see.
+ Added more Smoke and visual FX to the Primed Mining Explosives explosion. % Tweaked Primed Mining Explosive Renderer. + Added a randFloat to MathUtils.java.
Diffstat (limited to 'src')
-rw-r--r--src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java9
-rw-r--r--src/Java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java41
-rw-r--r--src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java29
-rw-r--r--src/Java/gtPlusPlus/core/proxy/ClientProxy.java3
-rw-r--r--src/Java/gtPlusPlus/core/util/math/MathUtils.java37
5 files changed, 95 insertions, 24 deletions
diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java b/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java
index 697ea4e2b2..7c9a268afb 100644
--- a/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java
+++ b/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java
@@ -5,8 +5,9 @@ import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.util.Utils;
import net.minecraft.client.renderer.RenderBlocks;
-import net.minecraft.client.renderer.entity.RenderTNTPrimed;
+import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityTNTPrimed;
@@ -14,8 +15,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.util.ResourceLocation;
@SideOnly(Side.CLIENT)
-public class RenderMiningExplosivesPrimed extends RenderTNTPrimed
-{
+public class RenderMiningExplosivesPrimed extends Render {
private final RenderBlocks blockRenderer = new RenderBlocks();
public RenderMiningExplosivesPrimed(){
@@ -28,8 +28,8 @@ public class RenderMiningExplosivesPrimed extends RenderTNTPrimed
* (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.
*/
- @Override
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_){
+ Utils.LOG_INFO("Rendering Mining Explosion.");
GL11.glPushMatrix();
GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
float f2;
@@ -78,7 +78,6 @@ public class RenderMiningExplosivesPrimed extends RenderTNTPrimed
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
- @Override
protected ResourceLocation getEntityTexture(final EntityTNTPrimed p_110775_1_){
return TextureMap.locationBlocksTexture;
}
diff --git a/src/Java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java b/src/Java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java
index 5a1543ea3c..89d25a728a 100644
--- a/src/Java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java
+++ b/src/Java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java
@@ -94,19 +94,30 @@ public class EntityPrimedMiningExplosive extends EntityTNTPrimed
this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
- this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
- this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
- this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
- this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
- this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
- this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
- this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
- this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
- this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
- this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
- this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
- this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
- this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
+ this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(0, 1), this.posY+MathUtils.randDouble(0, 1), this.posZ+MathUtils.randDouble(0, 1), 0.0D, 0.0D, 0.0D);
}
}
@@ -114,6 +125,10 @@ public class EntityPrimedMiningExplosive extends EntityTNTPrimed
{
final float f = 20.0F;
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true);
+ this.worldObj.createExplosion(this, this.posX+MathUtils.randDouble(-10, 10), this.posY, this.posZ+MathUtils.randDouble(-10, 10), f+MathUtils.randFloat(-5F, 5F), true);
+ this.worldObj.createExplosion(this, this.posX+MathUtils.randDouble(-10, 10), this.posY, this.posZ+MathUtils.randDouble(-10, 10), f+MathUtils.randFloat(-5F, 5F), true);
+ this.worldObj.createExplosion(this, this.posX+MathUtils.randDouble(-10, 10), this.posY, this.posZ+MathUtils.randDouble(-10, 10), f+MathUtils.randFloat(-5F, 5F), true);
+ this.worldObj.createExplosion(this, this.posX+MathUtils.randDouble(-10, 10), this.posY, this.posZ+MathUtils.randDouble(-10, 10), f+MathUtils.randFloat(-5F, 5F), true);
}
/**
diff --git a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java
index 0666acc7fa..b787acd02d 100644
--- a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java
@@ -1,6 +1,6 @@
package gtPlusPlus.core.handler.events;
-import java.util.UUID;
+import java.util.*;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
@@ -45,7 +45,7 @@ public class LoginEventHandler {
Utils.LOG_INFO("Latest version is: "+CORE.MASTER_VERSION);
}
Utils.LOG_INFO("You currently have: "+CORE.VERSION);
- PlayerUtils.messagePlayer(this.localPlayerRef, "You're not using the latest recommended version of GT++, consider updating.");
+ ShortTimer(this.localPlayerRef, 20);
}
else {
Utils.LOG_INFO("You're using the latest recommended version of GT++.");
@@ -100,5 +100,30 @@ public class LoginEventHandler {
}
}
+
+ //Handles notifying the player about a version update.
+ public Timer ShortTimer(EntityPlayer localPlayer, final int seconds) {
+ Timer timer;
+ timer = new Timer();
+ timer.schedule(new NotifyPlayer(localPlayer), seconds * 1000);
+ return timer;
+ }
+
+ //Timer Task for notifying the player.
+ class NotifyPlayer extends TimerTask {
+ final EntityPlayer toMessage;
+ public NotifyPlayer(EntityPlayer localPlayer) {
+ toMessage = localPlayer;
+ }
+
+ @Override
+ public void run() {
+ if (toMessage != null){
+ if (toMessage instanceof EntityPlayerMP){
+ PlayerUtils.messagePlayer(toMessage, "You're not using the latest recommended version of GT++, consider updating.");
+ }
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java
index fde950bace..3dd8f842c3 100644
--- a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java
+++ b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java
@@ -14,6 +14,7 @@ import gtPlusPlus.core.entity.EntityPrimedMiningExplosive;
import gtPlusPlus.core.handler.render.FirepitRender;
import gtPlusPlus.core.lib.LoadedMods;
import gtPlusPlus.core.tileentities.general.TileEntityFirepit;
+import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.particles.EntityParticleFXMysterious;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
@@ -67,7 +68,7 @@ public class ClientProxy extends CommonProxy{
//RenderingRegistry.registerEntityRenderingHandler(EntityBloodSteelMob.class, new RenderBloodSteelMob(new ModelBloodSteelMob(), 0));
//RenderingRegistry.registerEntityRenderingHandler(EntityBloodSteelHostileMob.class, new RenderBloodSteelMobHostile(new ModelBloodSteelMob(), 0));
//RenderingRegistry.registerEntityRenderingHandler(EntityGrenade.class, new RenderSnowball(ModItems.tutGrenade));
-
+ Utils.LOG_INFO("Registering Renderer for Mining Explosives.");
RenderingRegistry.registerEntityRenderingHandler(EntityPrimedMiningExplosive.class, new RenderMiningExplosivesPrimed());
//ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBloodSteelChest.class, new BloodSteelChestRenderer());
diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java
index 3c04266f38..7ed15ec27b 100644
--- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java
+++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java
@@ -4,6 +4,7 @@ import java.util.Map;
import java.util.Random;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.xmod.gregtech.api.objects.XSTR;
public class MathUtils {
@@ -20,7 +21,7 @@ public class MathUtils {
public static int randInt(final int min, final int max) {
// Usually this can be a field rather than a method variable
- final Random rand = new Random();
+ final Random rand = new XSTR();
// nextInt is normally exclusive of the top value,
// so add 1 to make it inclusive
@@ -47,7 +48,7 @@ public class MathUtils {
*/
public static long randLong(final long min, final long max) {
// Usually this can be a field rather than a method variable
- final Random rand = new Random();
+ final Random rand = new XSTR();
// nextInt is normally exclusive of the top value,
// so add 1 to make it inclusive
@@ -78,7 +79,7 @@ public class MathUtils {
*/
public static double randDouble(final double min, final double max) {
// Usually this can be a field rather than a method variable
- final Random rand = new Random();
+ final Random rand = new XSTR();
// nextInt is normally exclusive of the top value,
// so add 1 to make it inclusive
@@ -95,6 +96,36 @@ public class MathUtils {
} while (((bits-val)+(n-1)) < 0L);
return val;
}
+
+ /**
+ * Returns a psuedo-random number between min and max, inclusive.
+ * The difference between min and max can be at most
+ * Float.MAX_VALUE - 1.
+ *
+ * @param min Minimim value
+ * @param max Maximim value. Must be greater than min.
+ * @return Float between min and max, inclusive.
+ * @see java.util.Random#nextFloat(float)
+ */
+ public static float randFloat(final float min, final float max) {
+ // Usually this can be a field rather than a method variable
+ final Random rand = new XSTR();
+
+ // nextInt is normally exclusive of the top value,
+ // so add 1 to make it inclusive
+ final float randomNum = MathUtils.nextFloat(rand,(max - min) + 1) + min;
+ return randomNum;
+ }
+
+ private static float nextFloat(final Random rng, final float n) {
+ // error checking and 2^x checking removed for simplicity.
+ float bits, val;
+ do {
+ bits = (rng.nextLong() << 1) >>> 1;
+ val = bits % n;
+ } while (((bits-val)+(n-1)) < 0L);
+ return val;
+ }
/**