aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Java/gtPlusPlus/GTplusplus.java1
-rw-r--r--src/Java/gtPlusPlus/core/block/ModBlocks.java6
-rw-r--r--src/Java/gtPlusPlus/core/block/general/MiningExplosives.java165
-rw-r--r--src/Java/gtPlusPlus/core/common/CommonProxy.java5
-rw-r--r--src/Java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java145
-rw-r--r--src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java15
-rw-r--r--src/Java/gtPlusPlus/core/util/Utils.java386
-rw-r--r--src/Java/gtPlusPlus/core/util/geo/GeoUtils.java2
-rw-r--r--src/Java/gtPlusPlus/core/util/player/PlayerCache.java1
9 files changed, 530 insertions, 196 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java
index 9f367388a6..2db6893ab8 100644
--- a/src/Java/gtPlusPlus/GTplusplus.java
+++ b/src/Java/gtPlusPlus/GTplusplus.java
@@ -180,6 +180,7 @@ implements ActionListener
public void init(final FMLInitializationEvent event)
{
proxy.init(event);
+ proxy.registerEntities();
//MinecraftForge.EVENT_BUS.register(this);
//FMLCommonHandler.instance().bus().register(this);
proxy.registerNetworkStuff();
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java
index 5063dfae96..e6767c6038 100644
--- a/src/Java/gtPlusPlus/core/block/ModBlocks.java
+++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java
@@ -3,8 +3,7 @@ package gtPlusPlus.core.block;
import cpw.mods.fml.common.registry.GameRegistry;
import gtPlusPlus.core.block.base.BasicBlock.BlockTypes;
import gtPlusPlus.core.block.base.BlockBaseOre;
-import gtPlusPlus.core.block.general.FirePit;
-import gtPlusPlus.core.block.general.LightGlass;
+import gtPlusPlus.core.block.general.*;
import gtPlusPlus.core.block.machine.*;
import gtPlusPlus.core.fluids.FluidRegistryHandler;
import gtPlusPlus.core.lib.CORE;
@@ -38,6 +37,8 @@ public final class ModBlocks {
public static Block blockFirePit;
public static Block blockOreFluorite;
+
+ public static Block blockMiningExplosive;
@@ -63,6 +64,7 @@ public final class ModBlocks {
blockFirePit = new FirePit();
blockFishTrap = new FishTrap();
blockOreFluorite = new BlockBaseOre("oreFluorite", "Fluorite", Material.rock, BlockTypes.ORE, Utils.rgbtoHexValue(120, 120, 30), 3);
+ blockMiningExplosive = new MiningExplosives();
}
diff --git a/src/Java/gtPlusPlus/core/block/general/MiningExplosives.java b/src/Java/gtPlusPlus/core/block/general/MiningExplosives.java
new file mode 100644
index 0000000000..78014e7956
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/block/general/MiningExplosives.java
@@ -0,0 +1,165 @@
+package gtPlusPlus.core.block.general;
+
+import java.util.Random;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.entity.EntityPrimedMiningExplosive;
+import gtPlusPlus.core.lib.CORE;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockTNT;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.projectile.EntityArrow;
+import net.minecraft.init.Items;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.Explosion;
+import net.minecraft.world.World;
+
+public class MiningExplosives extends BlockTNT {
+ @SideOnly(Side.CLIENT)
+ private IIcon textureTop;
+ @SideOnly(Side.CLIENT)
+ private IIcon textureBottom;
+
+ public MiningExplosives(){
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ }
+
+ /**
+ * Gets the block's texture. Args: side, meta
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(final int p_149691_1_, final int p_149691_2_){
+ return p_149691_1_ == 0 ? this.textureBottom : (p_149691_1_ == 1 ? this.textureTop : this.blockIcon);
+ }
+
+ /**
+ * Called whenever the block is added into the world. Args: world, x, y, z
+ */
+ @Override
+ public void onBlockAdded(final World world, final int x, final int y, final int z){
+ super.onBlockAdded(world, x, y, z);
+
+ if (world.isBlockIndirectlyGettingPowered(x, y, z))
+ {
+ this.onBlockDestroyedByPlayer(world, x, y, z, 1);
+ world.setBlockToAir(x, y, z);
+ }
+ }
+
+ /**
+ * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
+ * their own) Args: x, y, z, neighbor Block
+ */
+ @Override
+ public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block neighbourblock){
+ if (world.isBlockIndirectlyGettingPowered(x, y, z))
+ {
+ this.onBlockDestroyedByPlayer(world, x, y, z, 1);
+ world.setBlockToAir(x, y, z);
+ }
+ }
+
+ /**
+ * Returns the quantity of items to drop on block destruction.
+ */
+ @Override
+ public int quantityDropped(final Random random){
+ return 1;
+ }
+
+ /**
+ * Called upon the block being destroyed by an explosion
+ */
+ @Override
+ public void onBlockDestroyedByExplosion(final World world, final int x, final int y, final int z, final Explosion bang){
+ if (!world.isRemote)
+ {
+ final EntityPrimedMiningExplosive EntityPrimedMiningExplosive = new EntityPrimedMiningExplosive(world, x + 0.5F, y + 0.5F, z + 0.5F, bang.getExplosivePlacedBy());
+ EntityPrimedMiningExplosive.fuse = world.rand.nextInt(EntityPrimedMiningExplosive.fuse / 4) + (EntityPrimedMiningExplosive.fuse / 8);
+ world.spawnEntityInWorld(EntityPrimedMiningExplosive);
+ }
+ }
+
+ /**
+ * Called right before the block is destroyed by a player. Args: world, x, y, z, metaData
+ */
+ @Override
+ public void onBlockDestroyedByPlayer(final World world, final int x, final int y, final int z, final int meta){
+ this.func_150114_a(world, x, y, z, meta, (EntityLivingBase)null);
+ }
+
+ //TODO Spawns Primed TNT?
+ @Override
+ public void func_150114_a(final World world, final int p_150114_2_, final int p_150114_3_, final int p_150114_4_, final int p_150114_5_, final EntityLivingBase entityLiving){
+ if (!world.isRemote)
+ {
+ if ((p_150114_5_ & 1) == 1)
+ {
+ final EntityPrimedMiningExplosive EntityPrimedMiningExplosive = new EntityPrimedMiningExplosive(world, p_150114_2_ + 0.5F, p_150114_3_ + 0.5F, p_150114_4_ + 0.5F, entityLiving);
+ world.spawnEntityInWorld(EntityPrimedMiningExplosive);
+ world.playSoundAtEntity(EntityPrimedMiningExplosive, "game.tnt.primed", 1.0F, 1.0F);
+ }
+ }
+ }
+
+ /**
+ * Called upon block activation (right click on the block.)
+ */
+ @Override
+ public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer clickingPlayer, final int p_149727_6_, final float p_149727_7_, final float p_149727_8_, final float p_149727_9_){
+ if ((clickingPlayer.getCurrentEquippedItem() != null) && (clickingPlayer.getCurrentEquippedItem().getItem() == Items.flint_and_steel))
+ {
+ this.func_150114_a(world, x, y, z, 1, clickingPlayer);
+ world.setBlockToAir(x, y, z);
+ clickingPlayer.getCurrentEquippedItem().damageItem(1, clickingPlayer);
+ return true;
+ }
+ else
+ {
+ return super.onBlockActivated(world, x, y, z, clickingPlayer, p_149727_6_, p_149727_7_, p_149727_8_, p_149727_9_);
+ }
+ }
+
+ /**
+ * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity
+ */
+ @Override
+ public void onEntityCollidedWithBlock(final World world, final int x, final int y, final int z, final Entity entityTriggering){
+ if ((entityTriggering instanceof EntityArrow) && !world.isRemote)
+ {
+ final EntityArrow entityarrow = (EntityArrow)entityTriggering;
+
+ if (entityarrow.isBurning())
+ {
+ this.func_150114_a(world, x, y, z, 1, entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase)entityarrow.shootingEntity : null);
+ world.setBlockToAir(x, y, z);
+ }
+ }
+ }
+
+ /**
+ * Return whether this block can drop from an explosion.
+ */
+ @Override
+ public boolean canDropFromExplosion(final Explosion bang){
+ return false;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(final IIconRegister iconRegister){
+ //
+ /*this.blockIcon = iconRegister.registerIcon(this.getTextureName() + "_side");
+ this.textureTop = iconRegister.registerIcon(this.getTextureName() + "_top");
+ this.textureBottom = iconRegister.registerIcon(this.getTextureName() + "_bottom");*/
+ this.blockIcon = iconRegister.registerIcon(CORE.MODID + ":" + "Chrono/" + "MetalSheet2");
+ this.textureTop = iconRegister.registerIcon(CORE.MODID + ":" + "Chrono/" + "MetalFunnel");
+ this.textureBottom = iconRegister.registerIcon(CORE.MODID + ":" + "Chrono/" + "MetalPanel");
+ }
+} \ 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 405578857e..88e0de163b 100644
--- a/src/Java/gtPlusPlus/core/common/CommonProxy.java
+++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java
@@ -6,6 +6,7 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.*;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.entity.InternalEntityRegistry;
import gtPlusPlus.core.handler.*;
import gtPlusPlus.core.handler.events.BlockEventHandler;
import gtPlusPlus.core.handler.events.PickaxeBlockBreakEventHandler;
@@ -103,6 +104,10 @@ public class CommonProxy {
public void registerNetworkStuff(){
GuiHandler.init();
}
+
+ public void registerEntities(){
+ InternalEntityRegistry.registerEntities();
+ }
public void registerTileEntities(){
ModTileEntities.init();
diff --git a/src/Java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java b/src/Java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java
new file mode 100644
index 0000000000..5a1543ea3c
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/entity/EntityPrimedMiningExplosive.java
@@ -0,0 +1,145 @@
+package gtPlusPlus.core.entity;
+
+import gtPlusPlus.core.util.math.MathUtils;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityTNTPrimed;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+
+public class EntityPrimedMiningExplosive extends EntityTNTPrimed
+{
+ /** How long the fuse is */
+ public int fuse;
+ private EntityLivingBase tntPlacedBy;
+
+ public EntityPrimedMiningExplosive(final World world){
+ super(world);
+ this.preventEntitySpawning = true;
+ this.setSize(0.98F, 0.98F);
+ this.yOffset = this.height / 2.0F;
+ }
+
+ public EntityPrimedMiningExplosive(final World world, final double x, final double y, final double z, final EntityLivingBase placingEntity)
+ {
+ this(world);
+ this.setPosition(x, y, z);
+ final float f = (float)(Math.random() * Math.PI * 2.0D);
+ this.motionX = -((float)Math.sin(f)) * 0.02F;
+ this.motionY = 0.20000000298023224D;
+ this.motionZ = -((float)Math.cos(f)) * 0.02F;
+ this.fuse = 160;
+ this.prevPosX = x;
+ this.prevPosY = y;
+ this.prevPosZ = z;
+ this.tntPlacedBy = placingEntity;
+ }
+
+ @Override
+ protected void entityInit() {}
+
+ /**
+ * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
+ * prevent them from trampling crops
+ */
+ @Override
+ protected boolean canTriggerWalking()
+ {
+ return false;
+ }
+
+ /**
+ * Returns true if other Entities should be prevented from moving through this Entity.
+ */
+ @Override
+ public boolean canBeCollidedWith()
+ {
+ return !this.isDead;
+ }
+
+ /**
+ * Called to update the entity's position/logic.
+ */
+ @Override
+ public void onUpdate()
+ {
+ this.prevPosX = this.posX;
+ this.prevPosY = this.posY;
+ this.prevPosZ = this.posZ;
+ this.motionY -= 0.03999999910593033D;
+ this.moveEntity(this.motionX, this.motionY, this.motionZ);
+ this.motionX *= 0.9800000190734863D;
+ this.motionY *= 0.9800000190734863D;
+ this.motionZ *= 0.9800000190734863D;
+
+ if (this.onGround)
+ {
+ this.motionX *= 0.699999988079071D;
+ this.motionZ *= 0.699999988079071D;
+ this.motionY *= -0.5D;
+ }
+
+ if (this.fuse-- <= 0)
+ {
+ this.setDead();
+
+ if (!this.worldObj.isRemote)
+ {
+ this.explode();
+ }
+ }
+ 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("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);
+ }
+ }
+
+ private void explode()
+ {
+ final float f = 20.0F;
+ this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true);
+ }
+
+ /**
+ * (abstract) Protected helper method to write subclass entity data to NBT.
+ */
+ @Override
+ protected void writeEntityToNBT(final NBTTagCompound tag)
+ {
+ tag.setByte("Fuse", (byte)this.fuse);
+ }
+
+ /**
+ * (abstract) Protected helper method to read subclass entity data from NBT.
+ */
+ @Override
+ protected void readEntityFromNBT(final NBTTagCompound tag)
+ {
+ this.fuse = tag.getByte("Fuse");
+ }
+
+ /**
+ * returns null or the entityliving it was placed or ignited by
+ */
+ @Override
+ public EntityLivingBase getTntPlacedBy()
+ {
+ return this.tntPlacedBy;
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java b/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java
new file mode 100644
index 0000000000..565b0177ea
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java
@@ -0,0 +1,15 @@
+package gtPlusPlus.core.entity;
+
+import gtPlusPlus.GTplusplus;
+import cpw.mods.fml.common.registry.EntityRegistry;
+
+public class InternalEntityRegistry {
+
+ public static void registerEntities(){
+
+ //EntityRegistry.registerModEntity(EntityMiningChargePrimed.class, "MiningCharge", 3, Main.modInstance, 64, 20, true);
+ EntityRegistry.registerModEntity(EntityPrimedMiningExplosive.class, "MiningCharge", 3, GTplusplus.instance, 64, 20, true);
+
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java
index 79dd93a2f1..f969d3e075 100644
--- a/src/Java/gtPlusPlus/core/util/Utils.java
+++ b/src/Java/gtPlusPlus/core/util/Utils.java
@@ -1,6 +1,18 @@
package gtPlusPlus.core.util;
-import gregtech.api.enums.*;
+import java.awt.Color;
+import java.awt.Graphics;
+import java.lang.reflect.Method;
+import java.util.*;
+
+import org.apache.commons.lang3.EnumUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.FMLLog;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.TC_Aspects;
import gregtech.api.enums.TC_Aspects.TC_AspectStack;
import gtPlusPlus.GTplusplus;
import gtPlusPlus.core.lib.CORE;
@@ -12,14 +24,7 @@ import gtPlusPlus.core.util.math.MathUtils;
import ic2.core.Ic2Items;
import ic2.core.init.InternalName;
import ic2.core.item.resources.ItemCell;
-
-import java.awt.Color;
-import java.awt.Graphics;
-import java.lang.reflect.Method;
-import java.util.*;
-
import net.minecraft.block.Block;
-import net.minecraft.block.Block.SoundType;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemStack;
@@ -31,13 +36,6 @@ import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fluids.*;
import net.minecraftforge.oredict.OreDictionary;
-import org.apache.commons.lang3.EnumUtils;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-import cpw.mods.fml.common.FMLCommonHandler;
-import cpw.mods.fml.common.FMLLog;
-
public class Utils {
public static final int WILDCARD_VALUE = Short.MAX_VALUE;
@@ -57,27 +55,27 @@ public class Utils {
if (CORE.MASTER_VERSION.toLowerCase().equals("offline")){
return false;
- }
+ }
if (CORE.MASTER_VERSION.equals(CORE.VERSION.toLowerCase())){
return true;
- }
+ }
return false;
}
- public static TC_AspectStack getTcAspectStack (TC_Aspects aspect, long size){
+ public static TC_AspectStack getTcAspectStack (final TC_Aspects aspect, final long size){
return getTcAspectStack(aspect.name(), (int) size);
}
- public static TC_AspectStack getTcAspectStack (String aspect, long size){
+ public static TC_AspectStack getTcAspectStack (final String aspect, final long size){
return getTcAspectStack(aspect, (int) size);
}
- public static TC_AspectStack getTcAspectStack (TC_Aspects aspect, int size){
+ public static TC_AspectStack getTcAspectStack (final TC_Aspects aspect, final int size){
return getTcAspectStack(aspect.name(), size);
}
- public static TC_AspectStack getTcAspectStack (String aspect, int size){
+ public static TC_AspectStack getTcAspectStack (final String aspect, final int size){
TC_AspectStack returnValue = null;
@@ -91,13 +89,13 @@ public class Utils {
else {
Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR");
returnValue = new TC_AspectStack(TC_Aspects.valueOf("COGNITO"), size);
- }
- } catch (NoSuchFieldError r){
+ }
+ } catch (final NoSuchFieldError r){
Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus");
}
}
else if (aspect.toUpperCase().equals("EXANIMUS")){
- //Adds in Compat for older GT Versions which Misspell aspects.
+ //Adds in Compat for older GT Versions which Misspell aspects.
try {
if (EnumUtils.isValidEnum(TC_Aspects.class, "EXANIMUS")){
Utils.LOG_WARNING("TC Aspect found - "+aspect);
@@ -106,15 +104,15 @@ public class Utils {
else {
Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR");
returnValue = new TC_AspectStack(TC_Aspects.valueOf("EXAMINIS"), size);
- }
- } catch (NoSuchFieldError r){
+ }
+ } catch (final NoSuchFieldError r){
Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus");
}
}
else if (aspect.toUpperCase().equals("PRAECANTATIO")){
- //Adds in Compat for older GT Versions which Misspell aspects.
+ //Adds in Compat for older GT Versions which Misspell aspects.
try {
if (EnumUtils.isValidEnum(TC_Aspects.class, "PRAECANTATIO")){
Utils.LOG_WARNING("TC Aspect found - "+aspect);
@@ -123,10 +121,10 @@ public class Utils {
else {
Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR");
returnValue = new TC_AspectStack(TC_Aspects.valueOf("PRAECANTIO"), size);
- }
- } catch (NoSuchFieldError r){
+ }
+ } catch (final NoSuchFieldError r){
Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus");
- }
+ }
}
else {
Utils.LOG_WARNING("TC Aspect found - "+aspect);
@@ -136,11 +134,11 @@ public class Utils {
return returnValue;
}
- public static boolean containsMatch(boolean strict, ItemStack[] inputs, ItemStack... targets)
+ public static boolean containsMatch(final boolean strict, final ItemStack[] inputs, final ItemStack... targets)
{
- for (ItemStack input : inputs)
+ for (final ItemStack input : inputs)
{
- for (ItemStack target : targets)
+ for (final ItemStack target : targets)
{
if (itemMatches(target, input, strict))
{
@@ -151,77 +149,77 @@ public class Utils {
return false;
}
- public static boolean itemMatches(ItemStack target, ItemStack input, boolean strict)
+ public static boolean itemMatches(final ItemStack target, final ItemStack input, final boolean strict)
{
- if (input == null || target == null)
+ if ((input == null) || (target == null))
{
return false;
}
- return (target.getItem() == input.getItem() && ((target.getItemDamage() == WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage()));
+ return ((target.getItem() == input.getItem()) && (((target.getItemDamage() == WILDCARD_VALUE) && !strict) || (target.getItemDamage() == input.getItemDamage())));
}
-
+
//Logging Functions
private static final Logger modLogger = makeLogger();
-
+
//Generate GT++ Logger
public static Logger makeLogger(){
- Logger gtPlusPlusLogger = LogManager.getLogger("GT++");
+ final Logger gtPlusPlusLogger = LogManager.getLogger("GT++");
return gtPlusPlusLogger;
}
-
- //Non-Dev Comments
- public static void LOG_INFO(String s){
+
+ //Non-Dev Comments
+ public static void LOG_INFO(final String s){
//if (CORE.DEBUG){
modLogger.info(s);
//}
}
- //Non-Dev Comments
- public static void LOG_MACHINE_INFO(String s){
+ //Non-Dev Comments
+ public static void LOG_MACHINE_INFO(final String s){
if (CORE.configSwitches.MACHINE_INFO || ClientProxy.playerName.toLowerCase().contains("draknyte1")){
modLogger.info("Machine Info: "+s);
}
}
//Developer Comments
- public static void LOG_WARNING(String s){
+ public static void LOG_WARNING(final String s){
if (CORE.DEBUG){
modLogger.warn(s);
}
}
//Errors
- public static void LOG_ERROR(String s){
+ public static void LOG_ERROR(final String s){
if (CORE.DEBUG){
modLogger.fatal(s);
}
}
//Developer Logger
- public static void LOG_SPECIFIC_WARNING(String whatToLog, String msg, int line){
- //if (!CORE.DEBUG){
+ public static void LOG_SPECIFIC_WARNING(final String whatToLog, final String msg, final int line){
+ //if (!CORE.DEBUG){
FMLLog.warning("GT++ |"+line+"| "+whatToLog+" | "+msg);
- //}
+ //}
}
- public static void paintBox(Graphics g, int MinA, int MinB, int MaxA, int MaxB){
- g.drawRect (MinA, MinB, MaxA, MaxB);
+ public static void paintBox(final Graphics g, final int MinA, final int MinB, final int MaxA, final int MaxB){
+ g.drawRect (MinA, MinB, MaxA, MaxB);
}
// Send a message to all players on the server
- public static void sendServerMessage(String translationKey) {
+ public static void sendServerMessage(final String translationKey) {
sendServerMessage(new ChatComponentText(translationKey));
}
// Send a message to all players on the server
- public static void sendServerMessage(IChatComponent chatComponent) {
+ public static void sendServerMessage(final IChatComponent chatComponent) {
MinecraftServer.getServer().getConfigurationManager().sendChatMsg(chatComponent);
}
/**
* Returns if that Liquid is IC2Steam.
*/
- public static boolean isIC2Steam(FluidStack aFluid) {
+ public static boolean isIC2Steam(final FluidStack aFluid) {
if (aFluid == null) {
return false;
}
@@ -231,7 +229,7 @@ public class Utils {
/**
* Returns a Liquid Stack with given amount of IC2Steam.
*/
- public static FluidStack getIC2Steam(long aAmount) {
+ public static FluidStack getIC2Steam(final long aAmount) {
return FluidRegistry.getFluidStack("ic2steam", (int)aAmount);
}
@@ -243,17 +241,17 @@ public class Utils {
'A',slot_1,'B',slot_2,'C',slot_3,
'D',slot_4,'E',slot_5,'F',slot_6,
'G',slot_7,'H',slot_8,'I',slot_9
- });
+ });
}*/
- public static String checkCorrectMiningToolForBlock(Block currentBlock, World currentWorld){
+ public static String checkCorrectMiningToolForBlock(final Block currentBlock, final World currentWorld){
String correctTool = "";
- if (!currentWorld.isRemote){
+ if (!currentWorld.isRemote){
try {
correctTool = currentBlock.getHarvestTool(0);
Utils.LOG_WARNING(correctTool);
- } catch (NullPointerException e){
+ } catch (final NullPointerException e){
}
}
@@ -262,17 +260,17 @@ public class Utils {
}
/**
- *
+ *
* @param colourStr e.g. "#FFFFFF"
* @return String - formatted "rgb(0,0,0)"
*/
- public static String hex2RgbFormatted(String hexString) {
- Color c = new Color(
- Integer.valueOf(hexString.substring(1, 3), 16),
- Integer.valueOf(hexString.substring(3, 5), 16),
+ public static String hex2RgbFormatted(final String hexString) {
+ final Color c = new Color(
+ Integer.valueOf(hexString.substring(1, 3), 16),
+ Integer.valueOf(hexString.substring(3, 5), 16),
Integer.valueOf(hexString.substring(5, 7), 16));
- StringBuffer sb = new StringBuffer();
+ final StringBuffer sb = new StringBuffer();
sb.append("rgb(");
sb.append(c.getRed());
sb.append(",");
@@ -284,11 +282,11 @@ public class Utils {
}
/**
- *
+ *
* @param colourStr e.g. "#FFFFFF"
- * @return
+ * @return
*/
- public static Color hex2Rgb(String colorStr) {
+ public static Color hex2Rgb(final String colorStr) {
return new Color(
Integer.valueOf( colorStr.substring( 1, 3 ), 16 ),
Integer.valueOf( colorStr.substring( 3, 5 ), 16 ),
@@ -296,72 +294,72 @@ public class Utils {
}
/**
- *
+ *
* @param colourInt e.g. 0XFFFFFF
* @return Colour
*/
- public static Color hex2Rgb(int colourInt) {
+ public static Color hex2Rgb(final int colourInt) {
return Color.decode(String.valueOf(colourInt));
}
/**
- *
+ *
* @param colourInt e.g. 0XFFFFFF
* @return short[]
*/
- public static short[] hex2RgbShort(int colourInt) {
- Color rgb = Color.decode(String.valueOf(colourInt));
- short[] rgba = {(short) rgb.getRed(), (short) rgb.getGreen(), (short) rgb.getBlue(), (short) rgb.getAlpha()};
+ public static short[] hex2RgbShort(final int colourInt) {
+ final Color rgb = Color.decode(String.valueOf(colourInt));
+ final short[] rgba = {(short) rgb.getRed(), (short) rgb.getGreen(), (short) rgb.getBlue(), (short) rgb.getAlpha()};
return rgba;
}
- public static Timer ShortTimer(int seconds) {
+ public static Timer ShortTimer(final int seconds) {
Timer timer;
timer = new Timer();
timer.schedule(new ShortTimerTask(), seconds * 1000);
return timer;
}
- public static String byteToHex(byte b) {
- int i = b & 0xFF;
+ public static String byteToHex(final byte b) {
+ final int i = b & 0xFF;
return Integer.toHexString(i);
}
- public static Object[] convertListToArray(List<Object> sourceList) {
- Object[] targetArray = sourceList.toArray(new Object[sourceList.size()]);
+ public static Object[] convertListToArray(final List<Object> sourceList) {
+ final Object[] targetArray = sourceList.toArray(new Object[sourceList.size()]);
return targetArray;
}
- public static List<Object> convertArrayToFixedSizeList(Object[] sourceArray) {
- List<Object> targetList = Arrays.asList(sourceArray);
+ public static List<Object> convertArrayToFixedSizeList(final Object[] sourceArray) {
+ final List<Object> targetList = Arrays.asList(sourceArray);
return targetList;
}
- public static List<Object> convertArrayToList(Object[] sourceArray) {
- List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray));
+ public static List<Object> convertArrayToList(final Object[] sourceArray) {
+ final List<Object> targetList = new ArrayList<>(Arrays.asList(sourceArray));
return targetList;
}
- public static List<Object> convertArrayListToList(ArrayList sourceArray) {
- List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray));
+ public static List<Object> convertArrayListToList(@SuppressWarnings("rawtypes") final ArrayList sourceArray) {
+ final List<Object> targetList = new ArrayList<>(Arrays.asList(sourceArray));
return targetList;
}
- public static void spawnCustomParticle(Entity entity){
+ public static void spawnCustomParticle(final Entity entity){
GTplusplus.proxy.generateMysteriousParticles(entity);
- }
+ }
- public static void spawnFX(World world, int x, int y, int z, String particleName, Object particleName2){
+ public static void spawnFX(final World world, final int x, final int y, final int z, final String particleName, Object particleName2){
if (!world.isRemote){
- if (particleName2 == null || particleName2.equals("")){
+ if ((particleName2 == null) || particleName2.equals("")){
particleName2 = particleName;
}
- int l = MathUtils.randInt(0, 4);
- double d0 = (double)((float)x + 0.5F);
- double d1 = (double)((float)y + 0.7F);
- double d2 = (double)((float)z + 0.5F);
- double d3 = 0.2199999988079071D;
- double d4 = 0.27000001072883606D;
+ final int l = MathUtils.randInt(0, 4);
+ final double d0 = x + 0.5F;
+ final double d1 = y + 0.7F;
+ final double d2 = z + 0.5F;
+ final double d3 = 0.2199999988079071D;
+ final double d4 = 0.27000001072883606D;
if (l == 1)
{
@@ -389,14 +387,14 @@ public class Utils {
}
}
- public static int rgbtoHexValue(int r, int g, int b){
- if (r > 255 || g > 255 || b > 255 || r < 0 || g < 0 || b < 0){
+ public static int rgbtoHexValue(final int r, final int g, final int b){
+ if ((r > 255) || (g > 255) || (b > 255) || (r < 0) || (g < 0) || (b < 0)){
return 0;
}
- Color c = new Color(r,g,b);
- String temp = Integer.toHexString( c.getRGB() & 0xFFFFFF ).toUpperCase();
+ final Color c = new Color(r,g,b);
+ String temp = Integer.toHexString( c.getRGB() & 0xFFFFFF ).toUpperCase();
- //System.out.println( "hex: " + Integer.toHexString( c.getRGB() & 0xFFFFFF ) + " hex value:"+temp);
+ //System.out.println( "hex: " + Integer.toHexString( c.getRGB() & 0xFFFFFF ) + " hex value:"+temp);
temp = Utils.appenedHexNotationToString(String.valueOf(temp));
Utils.LOG_WARNING("Made "+temp+" - Hopefully it's not a mess.");
Utils.LOG_WARNING("It will decode into "+Integer.decode(temp)+".");
@@ -406,26 +404,26 @@ public class Utils {
/*
* http://javadevnotes.com/java-left-pad-string-with-zeros-examples
*/
- public static String leftPadWithZeroes(String originalString, int length) {
- StringBuilder sb = new StringBuilder();
- while (sb.length() + originalString.length() < length) {
+ public static String leftPadWithZeroes(final String originalString, final int length) {
+ final StringBuilder sb = new StringBuilder();
+ while ((sb.length() + originalString.length()) < length) {
sb.append('0');
}
sb.append(originalString);
- String paddedString = sb.toString();
+ final String paddedString = sb.toString();
return paddedString;
}
/*
* Original Code by Chandana Napagoda - https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator.html
- */
- public static Map<Integer, String> hexColourGenerator(int colorCount){
- int maxColorValue = 16777215;
+ */
+ public static Map<Integer, String> hexColourGenerator(final int colorCount){
+ final int maxColorValue = 16777215;
// this is decimal value of the "FFFFFF"
- int devidedvalue = maxColorValue/colorCount;
+ final int devidedvalue = maxColorValue/colorCount;
int countValue = 0;
- HashMap<Integer, String> hexColorMap = new HashMap<Integer, String>();
- for(int a=0; a < colorCount && maxColorValue >= countValue ; a++){
+ final HashMap<Integer, String> hexColorMap = new HashMap<>();
+ for(int a=0; (a < colorCount) && (maxColorValue >= countValue) ; a++){
if(a != 0){
countValue+=devidedvalue;
hexColorMap.put(a,Integer.toHexString( 0x10000 | countValue).substring(1).toUpperCase());
@@ -440,33 +438,33 @@ public class Utils {
/*
* Original Code by Chandana Napagoda - https://cnapagoda.blogspot.com.au/2011/03/java-hex-color-code-generator.html
*/
- public static Map<Integer, String> hexColourGeneratorRandom(int colorCount){
- HashMap<Integer, String> hexColorMap = new HashMap<Integer, String>();
+ public static Map<Integer, String> hexColourGeneratorRandom(final int colorCount){
+ final HashMap<Integer, String> hexColorMap = new HashMap<>();
for(int a=0;a < colorCount; a++){
String code = ""+(int)(Math.random()*256);
code = code+code+code;
- int i = Integer.parseInt(code);
+ final int i = Integer.parseInt(code);
hexColorMap.put(a,Integer.toHexString( 0x1000000 | i).substring(1).toUpperCase());
Utils.LOG_WARNING(""+Integer.toHexString( 0x1000000 | i).substring(1).toUpperCase());
}
return hexColorMap;
}
- public static String appenedHexNotationToString(Object hexAsStringOrInt){
- String hexChar = "0x";
+ public static String appenedHexNotationToString(final Object hexAsStringOrInt){
+ final String hexChar = "0x";
String result;
if (hexAsStringOrInt.getClass() == String.class){
if (((String) hexAsStringOrInt).length() != 6){
- String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6);
+ final String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6);
result = temp;
}
result = hexChar+hexAsStringOrInt;
return result;
}
- else if (hexAsStringOrInt.getClass() == Integer.class){
+ else if (hexAsStringOrInt.getClass() == Integer.class){
if (((String) hexAsStringOrInt).length() != 6){
- String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6);
+ final String temp = leftPadWithZeroes((String) hexAsStringOrInt, 6);
result = temp;
}
result = hexChar+String.valueOf(hexAsStringOrInt);
@@ -477,22 +475,22 @@ public class Utils {
}
}
- public static Integer appenedHexNotationToInteger(int hexAsStringOrInt){
- String hexChar = "0x";
+ public static Integer appenedHexNotationToInteger(final int hexAsStringOrInt){
+ final String hexChar = "0x";
String result;
Utils.LOG_WARNING(String.valueOf(hexAsStringOrInt));
result = hexChar+String.valueOf(hexAsStringOrInt);
return Integer.getInteger(result);
}
- public static boolean doesEntryExistAlreadyInOreDictionary(String OreDictName){
+ public static boolean doesEntryExistAlreadyInOreDictionary(final String OreDictName){
if (OreDictionary.getOres(OreDictName).size() != 0) {
return true;
}
return false;
}
- public static boolean invertBoolean(boolean booleans){
+ public static boolean invertBoolean(final boolean booleans){
if (booleans == true){
return false;
}
@@ -500,34 +498,34 @@ public class Utils {
}
private static short cellID = 15;
- public static ItemStack createInternalNameAndFluidCell(String s){
+ public static ItemStack createInternalNameAndFluidCell(final String s){
Utils.LOG_WARNING("1");
- InternalName yourName = EnumHelper.addEnum(InternalName.class, s, new Class[0], new Object[0]);
+ final InternalName yourName = EnumHelper.addEnum(InternalName.class, s, new Class[0], new Object[0]);
Utils.LOG_WARNING("2 "+yourName.name());
- ItemCell item = (ItemCell)Ic2Items.cell.getItem();
+ final ItemCell item = (ItemCell)Ic2Items.cell.getItem();
Utils.LOG_WARNING("3 "+item.getUnlocalizedName());
try
{
Utils.LOG_WARNING("4");
- Class<? extends ItemCell> clz = item.getClass();
+ final Class<? extends ItemCell> clz = item.getClass();
Utils.LOG_WARNING("5 "+clz.getSimpleName());
- Method methode = clz.getDeclaredMethod("addCell", int.class, InternalName.class, Block[].class);
+ final Method methode = clz.getDeclaredMethod("addCell", int.class, InternalName.class, Block[].class);
Utils.LOG_WARNING("6 "+methode.getName());
methode.setAccessible(true);
Utils.LOG_WARNING("7 "+methode.isAccessible());
- ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]);
+ final ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]);
Utils.LOG_WARNING("Successfully created "+temp.getDisplayName()+"s.");
FluidContainerRegistry.registerFluidContainer(FluidUtils.getFluidStack(s.toLowerCase(), 0), temp.copy(), Ic2Items.cell.copy());
ItemUtils.addItemToOreDictionary(temp.copy(), "cell"+s);
return temp;
}
- catch(Exception e){
+ catch(final Exception e){
e.printStackTrace();
}
return null;
}
- public static String sanitizeString(String input){
+ public static String sanitizeString(final String input){
String temp;
String output;
@@ -545,39 +543,39 @@ public class Utils {
temp = temp.replace("[", "");
temp = temp.replace("]", "");
temp = temp.replace(" ", "");
- output = temp;
+ output = temp;
return output;
}
-
- public static String[] parseVersion(String version){
+
+ public static String[] parseVersion(final String version){
return parseVersion(version, "//.");
}
-
- public static String[] parseVersion(String version, String delimiter){
- String[] versionArray = version.split(delimiter);
+
+ public static String[] parseVersion(final String version, final String delimiter){
+ final String[] versionArray = version.split(delimiter);
return versionArray;
}
-
- public static Versioning compareModVersion (String currentVersion, String expectedVersion){
+
+ public static Versioning compareModVersion (final String currentVersion, final String expectedVersion){
return compareModVersion(currentVersion, expectedVersion, "//.");
}
-
- public static Versioning compareModVersion (String currentVersion, String expectedVersion, String delimiter){
- String[] a = parseVersion(currentVersion, delimiter);
- String[] b = parseVersion(expectedVersion, delimiter);
- int[] c = new int[a.length];
- int[] d = new int[b.length];
+
+ public static Versioning compareModVersion (final String currentVersion, final String expectedVersion, final String delimiter){
+ final String[] a = parseVersion(currentVersion, delimiter);
+ final String[] b = parseVersion(expectedVersion, delimiter);
+ final int[] c = new int[a.length];
+ final int[] d = new int[b.length];
for (int r=0;r<a.length;r++){
c[r]=Integer.parseInt(a[r]);
}
for (int r=0;r<b.length;r++){
d[r]=Integer.parseInt(b[r]);
}
- Versioning[] e = new Versioning[MathUtils.returnLargestNumber(c.length, d.length)];
+ final Versioning[] e = new Versioning[MathUtils.returnLargestNumber(c.length, d.length)];
for (int r=0;r<e.length;r++){
-
-
+
+
if (c[r] > d[r]){
e[r] = Versioning.NEWER;
}
@@ -588,7 +586,7 @@ public class Utils {
e[r] = Versioning.EQUAL;
}
}
-
+
for (int r=0;r<e.length;r++){
if (e[0] == Versioning.NEWER){
return Versioning.NEWER;
@@ -596,69 +594,69 @@ public class Utils {
else if (e[0] == Versioning.OLDER){
return Versioning.OLDER;
}
- else {
+ else {
if (e[r] == Versioning.OLDER){
-
+
}
-
+
return Versioning.NEWER;
}
}
-
- return null;
+
+ return null;
}
-
-
- public static ToolMaterial generateToolMaterialFromGT(Materials gtMaterial){
- String name = Utils.sanitizeString(gtMaterial.mDefaultLocalName);
- int harvestLevel = gtMaterial.mToolQuality;
- int durability = gtMaterial.mDurability;
- float damage = gtMaterial.mToolQuality;
- int efficiency = (int) gtMaterial.mToolSpeed;
- int enchantability = gtMaterial.mEnchantmentToolsLevel;
- ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, enchantability);
+
+
+ public static ToolMaterial generateToolMaterialFromGT(final Materials gtMaterial){
+ final String name = Utils.sanitizeString(gtMaterial.mDefaultLocalName);
+ final int harvestLevel = gtMaterial.mToolQuality;
+ final int durability = gtMaterial.mDurability;
+ final float damage = gtMaterial.mToolQuality;
+ final int efficiency = (int) gtMaterial.mToolSpeed;
+ final int enchantability = gtMaterial.mEnchantmentToolsLevel;
+ final ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, enchantability);
return temp;
}
- public static ToolMaterial generateToolMaterial(Material material){
- String name = material.getLocalizedName();
- int harvestLevel = material.vHarvestLevel;
- int durability = (int) material.vDurability;
- float damage = material.vToolQuality;
- int efficiency = (int) material.vToolQuality;
+ public static ToolMaterial generateToolMaterial(final Material material){
+ final String name = material.getLocalizedName();
+ final int harvestLevel = material.vHarvestLevel;
+ final int durability = (int) material.vDurability;
+ final float damage = material.vToolQuality;
+ final int efficiency = material.vToolQuality;
//int enchantability = material.mEnchantmentToolsLevel;
Utils.LOG_INFO("ToolMaterial stats for "+material.getLocalizedName()+" | harvestLevel:"+harvestLevel+" | durability:"+durability+" | toolQuality:"+damage+" | toolSpeed:"+damage);
- ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, 0);
+ final ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, 0);
return temp;
}
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
public static enum Versioning {
- EQUAL(0),
- NEWER(1),
- OLDER(-1);
- private int versioningInfo;
- private Versioning (final int versionStatus){
- this.versioningInfo = versionStatus;
- }
- public int getTexture() {
- return versioningInfo;
- }
- }
-
+ EQUAL(0),
+ NEWER(1),
+ OLDER(-1);
+ private final int versioningInfo;
+ private Versioning (final int versionStatus){
+ this.versioningInfo = versionStatus;
+ }
+ public int getTexture() {
+ return this.versioningInfo;
+ }
+ }
+
}
diff --git a/src/Java/gtPlusPlus/core/util/geo/GeoUtils.java b/src/Java/gtPlusPlus/core/util/geo/GeoUtils.java
index 9a7a16a8ab..701bce24d1 100644
--- a/src/Java/gtPlusPlus/core/util/geo/GeoUtils.java
+++ b/src/Java/gtPlusPlus/core/util/geo/GeoUtils.java
@@ -32,6 +32,7 @@ public class GeoUtils {
while ((numCharsRead = isr.read(charArray)) > 0) {
sb.append(charArray, 0, numCharsRead);
}
+ isr.close();
String result = sb.toString();
return result;
} catch (IOException e) {}
@@ -68,6 +69,7 @@ public class GeoUtils {
}
String temp = sb.toString();
String result = temp.replaceAll("(\\r|\\n)", "");
+ isr.close();
return result;
//Catch block for bad connection
} catch (IOException e) {
diff --git a/src/Java/gtPlusPlus/core/util/player/PlayerCache.java b/src/Java/gtPlusPlus/core/util/player/PlayerCache.java
index 99635d8fe9..c397e0f12f 100644
--- a/src/Java/gtPlusPlus/core/util/player/PlayerCache.java
+++ b/src/Java/gtPlusPlus/core/util/player/PlayerCache.java
@@ -37,6 +37,7 @@ public class PlayerCache {
final OutputStream out = new FileOutputStream(cache);
props.store(out, "Player Cache.");
Utils.LOG_INFO("PlayerCache.dat created for future use.");
+ out.close();
}
catch (final Exception e ) {
e.printStackTrace();