diff options
Diffstat (limited to 'src/Java/gtPlusPlus')
14 files changed, 317 insertions, 170 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/XSTR.java b/src/Java/gtPlusPlus/api/objects/XSTR.java index 2a7684f20f..3ff0792f6e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/XSTR.java +++ b/src/Java/gtPlusPlus/api/objects/XSTR.java @@ -1,4 +1,4 @@ -package gtPlusPlus.xmod.gregtech.api.objects; +package gtPlusPlus.api.objects; /** * A subclass of java.util.random that implements the Xorshift random number * generator diff --git a/src/Java/gtPlusPlus/core/block/general/HellFire.java b/src/Java/gtPlusPlus/core/block/general/HellFire.java index d73d0eb085..a682a0d98d 100644 --- a/src/Java/gtPlusPlus/core/block/general/HellFire.java +++ b/src/Java/gtPlusPlus/core/block/general/HellFire.java @@ -17,10 +17,10 @@ import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.objects.XSTR; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.xmod.gregtech.api.objects.XSTR; import net.minecraft.block.Block; import net.minecraft.block.BlockFire; import net.minecraft.block.material.MapColor; diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java b/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java index 359229adaa..a60a2554d8 100644 --- a/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java +++ b/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java @@ -8,14 +8,13 @@ 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.entity.RenderTNTPrimed; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityTNTPrimed; import net.minecraft.util.ResourceLocation; @SideOnly(Side.CLIENT) -public class RenderMiningExplosivesPrimed extends Render { +public class RenderMiningExplosivesPrimed extends RenderTNTPrimed { private final RenderBlocks blockRenderer = new RenderBlocks(); public RenderMiningExplosivesPrimed(){ diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderPlasmaBolt.java b/src/Java/gtPlusPlus/core/client/renderer/RenderPlasmaBolt.java index 673fdff733..8a9c56e14c 100644 --- a/src/Java/gtPlusPlus/core/client/renderer/RenderPlasmaBolt.java +++ b/src/Java/gtPlusPlus/core/client/renderer/RenderPlasmaBolt.java @@ -30,7 +30,7 @@ public class RenderPlasmaBolt extends Render { */ 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"); + Logger.INFO("Render Plasma. 1"); Tessellator tessellator = Tessellator.instance; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); @@ -126,7 +126,6 @@ public class RenderPlasmaBolt extends Render { } } } - GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); @@ -145,6 +144,7 @@ public class RenderPlasmaBolt extends Render { * unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(Entity p_110775_1_) { + Logger.INFO("Render Plasma. 5"); return this.getEntityTexture((EntityTeslaTowerLightning) p_110775_1_); } @@ -158,7 +158,7 @@ public class RenderPlasmaBolt extends Render { */ 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"); + Logger.INFO("Render Plasma. 2"); this.doRender((EntityTeslaTowerLightning) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); } diff --git a/src/Java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java b/src/Java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java index 897e330643..87e325a5bd 100644 --- a/src/Java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java +++ b/src/Java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java @@ -15,6 +15,7 @@ public class EntityPrimedMiningExplosive extends EntityTNTPrimed public EntityPrimedMiningExplosive(final World world){ super(world); + this.fuse = 160; this.preventEntitySpawning = true; this.setSize(0.98F, 0.98F); this.yOffset = this.height / 2.0F; @@ -90,36 +91,86 @@ public class EntityPrimedMiningExplosive extends EntityTNTPrimed } else { - this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 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); - } + + int t = MathUtils.randInt(0, 15); + + if (t <= 2){ + int e = MathUtils.randInt(0, 3); + if (e <= 1){ + this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 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("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); + } + else if (e == 2){ + 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("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); + + } + } + else if (t <= 4){ + int e = MathUtils.randInt(0, 5); + if (e <= 1){ + this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 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("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); + } + else if (e == 2){ + 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("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); + + } + } + else if (t <= 6){ + int e = MathUtils.randInt(0, 4); + if (e <= 1){ + this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 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("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); + } + else if (e == 2){ + 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("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); + + } + } + else if (t <= 8){ + int e = MathUtils.randInt(0, 1); + if (e <= 1){ + this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 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("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); + } + else if (e == 2){ + 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("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); + + } + } + else if (t <= 10){ + int e = MathUtils.randInt(0, 6); + if (e <= 1){ + this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 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("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); + } + else if (e >= 2){ + 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("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); + + } + } + + } } private void explode() diff --git a/src/Java/gtPlusPlus/core/entity/EntityTeslaTowerLightning.java b/src/Java/gtPlusPlus/core/entity/EntityTeslaTowerLightning.java index 2a7effbe8a..0cd5bd85bf 100644 --- a/src/Java/gtPlusPlus/core/entity/EntityTeslaTowerLightning.java +++ b/src/Java/gtPlusPlus/core/entity/EntityTeslaTowerLightning.java @@ -1,8 +1,11 @@ package gtPlusPlus.core.entity; import java.util.List; +import java.util.Random; +import java.util.UUID; import gtPlusPlus.api.damage.DamageTeslaTower; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.XSTR; import gtPlusPlus.core.util.entity.EntityUtils; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; @@ -16,118 +19,149 @@ 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_) {} + /** 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; + + private final UUID boltID; + private final UUID boltOwnerID; + + private final Entity boltValidDamageTarget; + + + public EntityTeslaTowerLightning(World p_i1703_1_, double p_i1703_2_, double p_i1703_4_, double p_i1703_6_, Entity valid, UUID owner) + { + super(p_i1703_1_); + Logger.INFO("Plasma Bolt - Created."); + Random rand = new XSTR(p_i1703_1_.getSeed()); + this.setLocationAndAngles(p_i1703_2_, p_i1703_4_, p_i1703_6_, 0.0F, 0.0F); + this.lightningState = 2; + this.boltVertex = rand.nextLong(); + this.boltLivingTime = (1) + rand.nextInt(3) + 1; + this.boltValidDamageTarget = valid; + this.boltID = UUID.randomUUID(); + this.boltOwnerID = owner; + + //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)) + { + Logger.INFO("Plasma Bolt - Putting out fires?."); + 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_) + rand.nextInt(3) - 1; + k = MathHelper.floor_double(p_i1703_4_) + rand.nextInt(3) - 1; + int l = MathHelper.floor_double(p_i1703_6_) + 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(); + Logger.INFO("Plasma Bolt - Tick."); + Random rand = new XSTR(this.worldObj.getSeed()); + + if (this.lightningState == 2) + { + Logger.INFO("Plasma Bolt - Playing Sound."); + this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0F, 0.8F + rand.nextFloat() * 0.2F); + } + --this.lightningState; + + + if (this.lightningState >= 0) + { + Logger.INFO("Plasma Bolt - state >= 0."); + if (this.worldObj.isRemote) + { + Logger.INFO("Plasma Bolt - World is remote, resetting state to 2."); + this.worldObj.lastLightningBolt = 2; + } + else + { + Logger.INFO("Plasma Bolt - World is server side."); + double d0 = 3.0D; + List<Entity> 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 = list.get(l); + if (this.boltValidDamageTarget.getUniqueID().equals(entity.getUniqueID())){ + if (!entity.getUniqueID().equals(boltOwnerID)){ + Logger.INFO("Plasma Bolt - Hurting Entity."); + Logger.INFO("Plasma Bolt - "+entity.getCommandSenderName()+"."); + //if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(entity, this)) + EntityUtils.doFireDamage(entity, 5); + EntityUtils.doDamage(entity, new DamageTeslaTower(entity), 20); + } + } + } + + } + } + + if (this.lightningState < 0) + { + Logger.INFO("Plasma Bolt - state < 0."); + if (this.boltLivingTime == 0) + { + Logger.INFO("Plasma Bolt - setting dead."); + this.setDead(); + } + else if (this.lightningState < -rand.nextInt(10)) + { + Logger.INFO("Plasma Bolt - dunno."); + --this.boltLivingTime; + this.lightningState = 1; + this.boltVertex = 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)) + { + Logger.INFO("Plasma Bolt - Putting fires out [2]."); + 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); + } + } + + } + } + } + + 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/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index 5de70b467a..a681baaa98 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -6,6 +6,8 @@ import java.util.concurrent.ConcurrentHashMap; import com.mojang.authlib.GameProfile; import gregtech.api.GregTech_API; +import gtPlusPlus.api.objects.CSPRNG; +import gtPlusPlus.api.objects.XSTR; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.array.Pair; import gtPlusPlus.core.util.geo.GeoUtils; @@ -13,7 +15,6 @@ import gtPlusPlus.core.util.gregtech.recipehandlers.GregtechRecipe; import gtPlusPlus.core.util.networking.NetworkUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.IGregtech_RecipeAdder; -import gtPlusPlus.xmod.gregtech.api.objects.XSTR; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractGenerator; import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractTerminal; @@ -32,7 +33,7 @@ public class CORE { //Math Related public static final float PI = (float) Math.PI; - public static volatile Random RANDOM = new XSTR(); + public static volatile Random RANDOM = CSPRNG.generate(new XSTR()); //Env. Variables public static Configuration Config; diff --git a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java index 924a8070a4..5ea7c3552c 100644 --- a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java +++ b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java @@ -106,7 +106,7 @@ public class ClientProxy extends CommonProxy implements Runnable{ 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()); + RenderingRegistry.registerEntityRenderingHandler(EntityTeslaTowerLightning.class, new RenderPlasmaBolt()); //ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBloodSteelChest.class, new BloodSteelChestRenderer()); //MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.tutChest), new ItemRenderBloodSteelChest()); diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java index adb5548f1d..679757576f 100644 --- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java @@ -4,9 +4,11 @@ import java.util.Map; import java.util.Random; import gregtech.api.enums.GT_Values; +import gtPlusPlus.api.objects.CSPRNG; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.XSTR; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.gregtech.api.objects.XSTR; public class MathUtils { @@ -23,7 +25,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 XSTR(); + final Random rand = CSPRNG.generate(CORE.RANDOM); // nextInt is normally exclusive of the top value, // so add 1 to make it inclusive @@ -50,7 +52,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 XSTR(); + final Random rand = CSPRNG.generate(CORE.RANDOM); // nextInt is normally exclusive of the top value, // so add 1 to make it inclusive @@ -81,7 +83,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 XSTR(); + final Random rand = CSPRNG.generate(CORE.RANDOM); // nextInt is normally exclusive of the top value, // so add 1 to make it inclusive @@ -111,7 +113,7 @@ public class MathUtils { */ 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(); + final Random rand = CSPRNG.generate(CORE.RANDOM); // nextInt is normally exclusive of the top value, // so add 1 to make it inclusive diff --git a/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT.java b/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT.java new file mode 100644 index 0000000000..bbec200c8e --- /dev/null +++ b/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT.java @@ -0,0 +1,49 @@ +package gtPlusPlus.core.world.darkworld.gen.gt; + +import gregtech.api.GregTech_API; +import gtPlusPlus.xmod.gregtech.HANDLER_GT; + +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.concurrent.ConcurrentHashMap; +import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkProvider; + +public abstract class WorldGen_GT { + public final String mWorldGenName; + public final boolean mEnabled; + private final Map<String, Boolean> mDimensionMap = new ConcurrentHashMap<String, Boolean>(); + + public WorldGen_GT(String aName, List aList, boolean aDefault) { + this.mWorldGenName = aName; + this.mEnabled = HANDLER_GT.sCustomWorldgenFile.get("worldgen", this.mWorldGenName, aDefault); + if (this.mEnabled) { + aList.add(this); + } + + } + + public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, + int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { + return false; + } + + public boolean executeCavegen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, + int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { + return false; + } + + public boolean isGenerationAllowed(World aWorld, int aDimensionType, int aAllowedDimensionType) { + String aDimName = aWorld.provider.getDimensionName(); + Boolean tAllowed = (Boolean) this.mDimensionMap.get(aDimName); + if (tAllowed == null) { + boolean tValue = HANDLER_GT.sCustomWorldgenFile.get("worldgen.dimensions." + this.mWorldGenName, aDimName, + aDimensionType == aAllowedDimensionType); + this.mDimensionMap.put(aDimName, Boolean.valueOf(tValue)); + return tValue; + } else { + return tAllowed.booleanValue(); + } + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Base.java b/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Base.java index 93c34e6fcc..44d62663bd 100644 --- a/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Base.java +++ b/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Base.java @@ -6,10 +6,10 @@ import cpw.mods.fml.common.IWorldGenerator; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_Log; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.XSTR; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.world.darkworld.Dimension_DarkWorld; import gtPlusPlus.xmod.gregtech.HANDLER_GT; -import gtPlusPlus.xmod.gregtech.api.objects.XSTR; import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; diff --git a/src/Java/gtPlusPlus/core/world/explosions/MiningExplosion.java b/src/Java/gtPlusPlus/core/world/explosions/MiningExplosion.java index effe4e397f..c632482d4e 100644 --- a/src/Java/gtPlusPlus/core/world/explosions/MiningExplosion.java +++ b/src/Java/gtPlusPlus/core/world/explosions/MiningExplosion.java @@ -2,9 +2,10 @@ package gtPlusPlus.core.world.explosions; import java.util.*; +import gtPlusPlus.api.objects.CSPRNG; +import gtPlusPlus.api.objects.XSTR; import gtPlusPlus.core.entity.EntityPrimedMiningExplosive; import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.xmod.gregtech.api.objects.XSTR; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.enchantment.EnchantmentProtection; @@ -21,7 +22,7 @@ public class MiningExplosion extends Explosion { /** whether or not this explosion spawns smoke particles */ public boolean isSmoking = true; private final int field_77289_h = 16; - private final Random explosionRNG = new XSTR(); + private final Random explosionRNG = CSPRNG.generate(new XSTR()); private final World worldObj; public double explosionX; public double explosionY; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java index 83c2235d8c..df886220c2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java @@ -15,7 +15,7 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.objects.XSTR; +import gtPlusPlus.api.objects.XSTR; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_TeslaTower.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_TeslaTower.java index 471d30d4d5..a8c60f3d62 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_TeslaTower.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_TeslaTower.java @@ -29,6 +29,8 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.Gregtech import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -308,15 +310,20 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase { if (!((Entity) r).getUniqueID().equals(getOwner())){ if (((Entity) r).isEntityAlive() || r instanceof EntityLiving){ if (((Entity) r).getDistance(this.xLoc, this.yLoc, this.zLoc) <= this.mRange){ - if (!this.mMode){ - mInRange.put(new Pair<Long, Long>(((Entity) r).getUniqueID().getMostSignificantBits(), ((Entity) r).getUniqueID().getLeastSignificantBits()), (Entity) r); + if (r instanceof EntityItem){ + //Do nothing } else { - if (r instanceof EntityPlayer){ + if (!this.mMode){ mInRange.put(new Pair<Long, Long>(((Entity) r).getUniqueID().getMostSignificantBits(), ((Entity) r).getUniqueID().getLeastSignificantBits()), (Entity) r); } + else { + if (r instanceof EntityPlayer){ + mInRange.put(new Pair<Long, Long>(((Entity) r).getUniqueID().getMostSignificantBits(), ((Entity) r).getUniqueID().getLeastSignificantBits()), (Entity) r); + } + } } - } + } } } } @@ -358,10 +365,13 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase { if (f.isEntityAlive() && !f.getUniqueID().equals(getOwner())){ //if (world.canLightningStrikeAt(j1, l1+1, k1)){ - if (isEnergyEnough() && world.addWeatherEffect(new EntityTeslaTowerLightning(world, (double)j1, (double)l1, (double)k1))){ + //if (isEnergyEnough() && world.addWeatherEffect(new EntityTeslaTowerLightning(world, (double)j1, (double)l1, (double)k1))){ + if (isEnergyEnough() && world.addWeatherEffect(new EntityTeslaTowerLightning(world, (double)j1, (double)l1, (double)k1, f, getOwner()))){ + if (f == null || f.isDead || !f.isEntityAlive()){ this.mInRange.remove(new Pair<Long, Long>(f.getUniqueID().getMostSignificantBits(), f.getUniqueID().getLeastSignificantBits())); - this.setEUVar(this.getEUVar()-5000000); } + this.setEUVar(this.getEUVar()-5000000); + } //} } |