diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core')
142 files changed, 3079 insertions, 1289 deletions
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index 81d3a84dc9..cbd21a8888 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -1,6 +1,7 @@ package gtPlusPlus.core.block; import cpw.mods.fml.common.registry.GameRegistry; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.base.BasicBlock.BlockTypes; import gtPlusPlus.core.block.base.BlockBaseOre; import gtPlusPlus.core.block.general.BlockCompressedObsidian; @@ -66,7 +67,7 @@ public final class ModBlocks { public static Block blockNet; public static void init() { - Utils.LOG_INFO("Initializing Blocks."); + Logger.INFO("Initializing Blocks."); //blockGriefSaver = new TowerDevice().setBlockName("blockGriefSaver").setCreativeTab(AddToCreativeTab.tabBlock).setBlockTextureName("blockDefault"); registerBlocks(); @@ -74,7 +75,7 @@ public final class ModBlocks { public static void registerBlocks(){ - Utils.LOG_INFO("Registering Blocks."); + Logger.INFO("Registering Blocks."); GameRegistry.registerBlock(MatterFabricatorEffectBlock = new LightGlass(Material.glass, false).setHardness(0.1F).setBlockTextureName(CORE.MODID + ":" + "blockMFEffect").setStepSound(Block.soundTypeGlass), "blockMFEffect"); //Fluids diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseFluid.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseFluid.java new file mode 100644 index 0000000000..6f837e8709 --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseFluid.java @@ -0,0 +1,102 @@ +package gtPlusPlus.core.block.base; + +import java.util.Random; + +import cofh.lib.render.particle.EntityDropParticleFX; +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.item.base.itemblock.ItemBlockMeta; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.BlockFluidClassic; +import net.minecraftforge.fluids.Fluid; + +public class BlockBaseFluid extends BlockFluidClassic { + + private final String name; + private final IIcon textureArray[] = new IIcon[6]; + + protected float particleRed = 1.0F; + protected float particleGreen = 1.0F; + protected float particleBlue = 1.0F; + + public BlockBaseFluid(String materialName, Fluid fluid, Material material) { + super(fluid, material); + this.setLightOpacity(2); + this.name = Utils.sanitizeString(materialName); + this.setBlockName("fluid"+this.name); + this.setCreativeTab(AddToCreativeTab.tabBlock); + GameRegistry.registerBlock(this, ItemBlockMeta.class, "fluid"+this.name); + } + + public BlockFluidClassic setParticleColor(int arg0) { + return this.setParticleColor((arg0 >> 16 & 255) / 255.0F, (arg0 >> 8 & 255) / 255.0F, + (arg0 >> 0 & 255) / 255.0F); + } + + public BlockFluidClassic setParticleColor(float arg0, float arg1, float arg2) { + this.particleRed = arg0; + this.particleGreen = arg1; + this.particleBlue = arg2; + return this; + } + + @Override + public boolean canCreatureSpawn(EnumCreatureType arg0, IBlockAccess arg1, int arg2, int arg3, int arg4) { + return false; + } + + public boolean preInit() { + return true; + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return side <= 1 ? this.textureArray[0] : this.textureArray[1]; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iicon) { + this.textureArray[0] = iicon.registerIcon(CORE.MODID + ":" + "fluid/" + "Fluid_" + this.name + "_Still"); + this.textureArray[1] = iicon.registerIcon(CORE.MODID + ":" + "fluid/" + "Fluid_" + this.name + "_Flow"); + //IconRegistry.addIcon("Fluid" + this.name, this.modName + ":fluid/Fluid_" + this.name + "_Still", arg0); + //IconRegistry.addIcon("Fluid" + this.name + "1", this.modName + ":fluid/Fluid_" + this.name + "_Flow", arg0); + } + + @Override + @Optional.Method(modid = "CoFHCore") + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World arg0, int arg1, int arg2, int arg3, Random arg4) { + super.randomDisplayTick(arg0, arg1, arg2, arg3, arg4); + double arg5 = arg1 + arg4.nextFloat(); + double arg7 = arg2 - 1.05D; + double arg9 = arg3 + arg4.nextFloat(); + if (super.density < 0) { + arg7 = arg2 + 2.1D; + } + + if (arg4.nextInt(20) == 0 + && arg0.isSideSolid(arg1, arg2 + super.densityDir, arg3, + super.densityDir == -1 ? ForgeDirection.UP : ForgeDirection.DOWN) + && !arg0.getBlock(arg1, arg2 + 2 * super.densityDir, arg3).getMaterial().blocksMovement()) { + EntityDropParticleFX arg11 = new EntityDropParticleFX(arg0, arg5, arg7, arg9, this.particleRed, + this.particleGreen, this.particleBlue, super.densityDir); + FMLClientHandler.instance().getClient().effectRenderer.addEffect(arg11); + } + + } + +} diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java index ff2f06d2d2..9c58e1a930 100644 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java +++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java @@ -8,26 +8,31 @@ import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.item.base.itemblock.ItemBlockGtBlock; import gtPlusPlus.core.item.base.itemblock.ItemBlockGtFrameBox; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; -import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.world.IBlockAccess; public class BlockBaseModular extends BasicBlock{ + protected Material blockMaterial; + protected int blockColour; protected BlockTypes thisBlock; protected String thisBlockMaterial; protected final String thisBlockType; - + public BlockBaseModular(final Material material, final BlockTypes blockType, final int colour) { + this(material.getUnlocalizedName(), material.getLocalizedName(), net.minecraft.block.material.Material.iron, blockType, colour, 2); + } + public BlockBaseModular(final String unlocalizedName, final String blockMaterial, final BlockTypes blockType, final int colour) { - this(unlocalizedName, blockMaterial, Material.iron, blockType, colour, 2); + this(unlocalizedName, blockMaterial, net.minecraft.block.material.Material.iron, blockType, colour, 2); } - public BlockBaseModular(final String unlocalizedName, final String blockMaterial, final Material vanillaMaterial, final BlockTypes blockType, final int colour, final int miningLevel) { + public BlockBaseModular(final String unlocalizedName, final String blockMaterial, final net.minecraft.block.material.Material vanillaMaterial, final BlockTypes blockType, final int colour, final int miningLevel) { super(unlocalizedName, vanillaMaterial); this.setHarvestLevel(blockType.getHarvestTool(), miningLevel); this.setBlockTextureName(CORE.MODID+":"+blockType.getTexture()); diff --git a/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java b/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java index 8ac4e2df8d..ea3d9c3ee9 100644 --- a/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java +++ b/src/Java/gtPlusPlus/core/block/general/antigrief/TowerDevice.java @@ -7,10 +7,10 @@ import java.util.Random; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.general.TileEntityReverter; -import gtPlusPlus.core.util.Utils; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -266,7 +266,7 @@ public class TowerDevice extends Block { public TileEntity createTileEntity(final World world, final int metadata) { if (metadata == 0) { - Utils.LOG_INFO("I have been created. [Antigriefer]"+this.getLocalizedName()); + Logger.INFO("I have been created. [Antigriefer]"+this.getLocalizedName()); return new TileEntityReverter(); } return null; diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_ModularityTable.java b/src/Java/gtPlusPlus/core/block/machine/Machine_ModularityTable.java index 1b4c5ebd01..bd41980325 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_ModularityTable.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_ModularityTable.java @@ -5,10 +5,10 @@ import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.GTplusplus; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; -import gtPlusPlus.core.util.Utils; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -70,7 +70,7 @@ public class Machine_ModularityTable extends BlockContainer final TileEntity te = world.getTileEntity(x, y, z); if ((te != null) && (te instanceof TileEntityModularityTable)){ player.openGui(GTplusplus.instance, 1, world, x, y, z); - Utils.LOG_INFO("Player opened GUI"); + Logger.INFO("Player opened GUI"); return true; } return false; diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_ProjectTable.java b/src/Java/gtPlusPlus/core/block/machine/Machine_ProjectTable.java index 939015adf7..712d32aba7 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_ProjectTable.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_ProjectTable.java @@ -6,11 +6,11 @@ import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.GTplusplus; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.player.PlayerUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import ic2.core.item.tool.ItemToolWrench; @@ -95,7 +95,7 @@ public class Machine_ProjectTable extends BlockContainer player.openGui(GTplusplus.instance, 0, world, x, y, z); return true; } - Utils.LOG_INFO("Holding a Wrench, doing wrench things instead."); + Logger.INFO("Holding a Wrench, doing wrench things instead."); } return false; } diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_TradeTable.java b/src/Java/gtPlusPlus/core/block/machine/Machine_TradeTable.java index 724b438b13..4cad0977ed 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_TradeTable.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_TradeTable.java @@ -3,10 +3,10 @@ package gtPlusPlus.core.block.machine; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.GTplusplus; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.base.BlockBaseNBT; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; -import gtPlusPlus.core.util.Utils; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EnumCreatureType; @@ -55,7 +55,7 @@ public class Machine_TradeTable extends BlockBaseNBT return true; } else { - Utils.LOG_INFO("Bad TE"); + Logger.INFO("Bad TE"); } return false; } diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java index b5c54ad9a8..06df4ca480 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java @@ -6,11 +6,11 @@ import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.GTplusplus; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.player.PlayerUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import ic2.core.item.tool.ItemToolWrench; @@ -95,7 +95,7 @@ public class Machine_Workbench extends BlockContainer player.openGui(GTplusplus.instance, 3, world, x, y, z); return true; } - Utils.LOG_INFO("Holding a Wrench, doing wrench things instead."); + Logger.INFO("Holding a Wrench, doing wrench things instead."); } return false; } diff --git a/src/Java/gtPlusPlus/core/client/model/ModelStaballoyConstruct.java b/src/Java/gtPlusPlus/core/client/model/ModelStaballoyConstruct.java index ab56e11a9a..72693e3de7 100644 --- a/src/Java/gtPlusPlus/core/client/model/ModelStaballoyConstruct.java +++ b/src/Java/gtPlusPlus/core/client/model/ModelStaballoyConstruct.java @@ -65,7 +65,8 @@ public class ModelStaballoyConstruct extends ModelIronGolem /** * Sets the models various rotation angles then renders the model. */ - public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_) + @Override + public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_) { this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_, p_78088_1_); this.ironGolemHead.render(p_78088_7_); @@ -81,7 +82,8 @@ public class ModelStaballoyConstruct extends ModelIronGolem * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how * "far" arms and legs can swing at most. */ - public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) + @Override + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) { this.ironGolemHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); this.ironGolemHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); @@ -95,15 +97,16 @@ public class ModelStaballoyConstruct extends ModelIronGolem * Used for easily adding entity-dependent animations. The second and third float params here are the same second * and third as in the setRotationAngles method. */ - public void setLivingAnimations(EntityLivingBase p_78086_1_, float p_78086_2_, float p_78086_3_, float p_78086_4_) + @Override + public void setLivingAnimations(EntityLivingBase p_78086_1_, float p_78086_2_, float p_78086_3_, float p_78086_4_) { EntityIronGolem entityirongolem = (EntityIronGolem)p_78086_1_; int i = entityirongolem.getAttackTimer(); if (i > 0) { - this.ironGolemRightArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - p_78086_4_, 10.0F); - this.ironGolemLeftArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - p_78086_4_, 10.0F); + this.ironGolemRightArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a(i - p_78086_4_, 10.0F); + this.ironGolemLeftArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a(i - p_78086_4_, 10.0F); } else { @@ -111,7 +114,7 @@ public class ModelStaballoyConstruct extends ModelIronGolem if (j > 0) { - this.ironGolemRightArm.rotateAngleX = -0.8F + 0.025F * this.func_78172_a((float)j, 70.0F); + this.ironGolemRightArm.rotateAngleX = -0.8F + 0.025F * this.func_78172_a(j, 70.0F); this.ironGolemLeftArm.rotateAngleX = 0.0F; } else diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java b/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java index bbbde96c8e..42071428a7 100644 --- a/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java +++ b/src/Java/gtPlusPlus/core/client/renderer/RenderMiningExplosivesPrimed.java @@ -4,8 +4,8 @@ import org.lwjgl.opengl.GL11; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.util.Utils; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.texture.TextureMap; @@ -19,7 +19,7 @@ public class RenderMiningExplosivesPrimed extends Render { public RenderMiningExplosivesPrimed(){ this.shadowSize = 0.5F; - Utils.LOG_INFO("Rendering Mining Explosion. 1"); + Logger.INFO("Rendering Mining Explosion. 1"); } /** @@ -29,7 +29,7 @@ public class RenderMiningExplosivesPrimed extends Render { * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ 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. 2"); + Logger.INFO("Rendering Mining Explosion. 2"); GL11.glPushMatrix(); GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_); float f2; diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderPotionthrow.java b/src/Java/gtPlusPlus/core/client/renderer/RenderPotionthrow.java index 378d03f1df..e86a3fa7ab 100644 --- a/src/Java/gtPlusPlus/core/client/renderer/RenderPotionthrow.java +++ b/src/Java/gtPlusPlus/core/client/renderer/RenderPotionthrow.java @@ -1,5 +1,8 @@ package gtPlusPlus.core.client.renderer; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.Tessellator; @@ -12,8 +15,6 @@ import net.minecraft.item.ItemPotion; import net.minecraft.potion.PotionHelper; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; @SideOnly(Side.CLIENT) public class RenderPotionthrow extends Render @@ -38,7 +39,8 @@ public class RenderPotionthrow extends Render * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ - public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) + @Override + 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_) { IIcon iicon = this.mRenderItem.getIconFromDamage(this.mDamage); @@ -54,9 +56,9 @@ public class RenderPotionthrow extends Render if (iicon == ItemPotion.func_94589_d("bottle_splash")) { int i = PotionHelper.func_77915_a(((EntityPotion)p_76986_1_).getPotionDamage(), false); - float f2 = (float)(i >> 16 & 255) / 255.0F; - float f3 = (float)(i >> 8 & 255) / 255.0F; - float f4 = (float)(i & 255) / 255.0F; + float f2 = (i >> 16 & 255) / 255.0F; + float f3 = (i >> 8 & 255) / 255.0F; + float f4 = (i & 255) / 255.0F; GL11.glColor3f(f2, f3, f4); GL11.glPushMatrix(); this.func_77026_a(tessellator, ItemPotion.func_94589_d("overlay")); @@ -73,7 +75,8 @@ public class RenderPotionthrow extends Render /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ - protected ResourceLocation getEntityTexture(Entity p_110775_1_) + @Override + protected ResourceLocation getEntityTexture(Entity p_110775_1_) { return TextureMap.locationItemsTexture; } @@ -91,10 +94,10 @@ public class RenderPotionthrow extends Render GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); p_77026_1_.startDrawingQuads(); p_77026_1_.setNormal(0.0F, 1.0F, 0.0F); - p_77026_1_.addVertexWithUV((double)(0.0F - f5), (double)(0.0F - f6), 0.0D, (double)f, (double)f3); - p_77026_1_.addVertexWithUV((double)(f4 - f5), (double)(0.0F - f6), 0.0D, (double)f1, (double)f3); - p_77026_1_.addVertexWithUV((double)(f4 - f5), (double)(f4 - f6), 0.0D, (double)f1, (double)f2); - p_77026_1_.addVertexWithUV((double)(0.0F - f5), (double)(f4 - f6), 0.0D, (double)f, (double)f2); + p_77026_1_.addVertexWithUV(0.0F - f5, 0.0F - f6, 0.0D, f, f3); + p_77026_1_.addVertexWithUV(f4 - f5, 0.0F - f6, 0.0D, f1, f3); + p_77026_1_.addVertexWithUV(f4 - f5, f4 - f6, 0.0D, f1, f2); + p_77026_1_.addVertexWithUV(0.0F - f5, f4 - f6, 0.0D, f, f2); p_77026_1_.draw(); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderStaballoyConstruct.java b/src/Java/gtPlusPlus/core/client/renderer/RenderStaballoyConstruct.java index 20a3a0b2f4..8de64eef26 100644 --- a/src/Java/gtPlusPlus/core/client/renderer/RenderStaballoyConstruct.java +++ b/src/Java/gtPlusPlus/core/client/renderer/RenderStaballoyConstruct.java @@ -1,5 +1,8 @@ package gtPlusPlus.core.client.renderer; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.client.model.ModelStaballoyConstruct; @@ -8,13 +11,9 @@ import gtPlusPlus.core.lib.CORE; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.*; import net.minecraft.init.Blocks; import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; @SideOnly(Side.CLIENT) public class RenderStaballoyConstruct extends RenderLiving { @@ -37,7 +36,7 @@ public class RenderStaballoyConstruct extends RenderLiving { */ public void doRender(EntityStaballoyConstruct p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { - super.doRender((EntityLiving) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + super.doRender(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); } /** @@ -51,7 +50,7 @@ public class RenderStaballoyConstruct extends RenderLiving { protected void rotateCorpse(EntityStaballoyConstruct p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) { super.rotateCorpse(p_77043_1_, p_77043_2_, p_77043_3_, p_77043_4_); - if ((double) p_77043_1_.limbSwingAmount >= 0.01D) { + if (p_77043_1_.limbSwingAmount >= 0.01D) { float f3 = 13.0F; float f4 = p_77043_1_.limbSwing - p_77043_1_.limbSwingAmount * (1.0F - p_77043_4_) + 6.0F; float f5 = (Math.abs(f4 % f3 - f3 * 0.5F) - f3 * 0.25F) / (f3 * 0.25F); @@ -74,7 +73,7 @@ public class RenderStaballoyConstruct extends RenderLiving { int i = p_77029_1_.getBrightnessForRender(p_77029_2_); int j = i % 65536; int k = i / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.bindTexture(TextureMap.locationBlocksTexture); this.field_147909_c.renderBlockAsItem(Blocks.red_flower, 0, 1.0F); @@ -91,15 +90,18 @@ public class RenderStaballoyConstruct extends RenderLiving { * 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(EntityLiving p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { this.doRender((EntityStaballoyConstruct) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); } + @Override protected void renderEquippedItems(EntityLivingBase p_77029_1_, float p_77029_2_) { this.renderEquippedItems((EntityStaballoyConstruct) p_77029_1_, p_77029_2_); } + @Override protected void rotateCorpse(EntityLivingBase p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) { this.rotateCorpse((EntityStaballoyConstruct) p_77043_1_, p_77043_2_, p_77043_3_, p_77043_4_); } @@ -112,6 +114,7 @@ public class RenderStaballoyConstruct extends RenderLiving { * 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(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { this.doRender((EntityStaballoyConstruct) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); @@ -121,6 +124,7 @@ public class RenderStaballoyConstruct extends RenderLiving { * Returns the location of an entity's texture. Doesn't seem to be called * unless you call Render.bindEntityTexture. */ + @Override protected ResourceLocation getEntityTexture(Entity p_110775_1_) { return this.getEntityTexture((EntityStaballoyConstruct) p_110775_1_); } @@ -133,6 +137,7 @@ public class RenderStaballoyConstruct extends RenderLiving { * 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(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { this.doRender((EntityStaballoyConstruct) 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/commands/CommandMath.java b/src/Java/gtPlusPlus/core/commands/CommandMath.java index 966f73c589..27c963bf81 100644 --- a/src/Java/gtPlusPlus/core/commands/CommandMath.java +++ b/src/Java/gtPlusPlus/core/commands/CommandMath.java @@ -3,7 +3,7 @@ package gtPlusPlus.core.commands; import java.util.ArrayList; import java.util.List; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.player.PlayerUtils; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; @@ -82,23 +82,23 @@ public class CommandMath implements ICommand System.out.println("Processing on Server side - Home Teleport engaged by: "+P.getDisplayName()); final int XP_TOTAL = P.experienceTotal; - Utils.LOG_WARNING("Total Xp:" + XP_TOTAL); + Logger.WARNING("Total Xp:" + XP_TOTAL); final ChunkCoordinates X = P.getPlayerCoordinates(); - Utils.LOG_WARNING("Player Location: "+X); + Logger.WARNING("Player Location: "+X); ChunkCoordinates Y = null; - Utils.LOG_WARNING("Bed Location: "+Y); + Logger.WARNING("Bed Location: "+Y); try { if (P.getBedLocation(0) == null){ Y = W.getSpawnPoint(); - Utils.LOG_WARNING("Spawn Location: "+Y); + Logger.WARNING("Spawn Location: "+Y); } else if (P.getBedLocation(0) != null){ Y = P.getBedLocation(0); - Utils.LOG_WARNING("Bed Location: "+Y); + Logger.WARNING("Bed Location: "+Y); } else { Y = W.getSpawnPoint(); - Utils.LOG_WARNING("Spawn Location: "+Y); + Logger.WARNING("Spawn Location: "+Y); } } catch(final NullPointerException e) { @@ -106,37 +106,37 @@ public class CommandMath implements ICommand } if (Y == null) { Y = W.getSpawnPoint(); - Utils.LOG_WARNING("Spawn Location: "+Y); + Logger.WARNING("Spawn Location: "+Y); } final int x1 = X.posX; - Utils.LOG_WARNING("X1: "+x1); + Logger.WARNING("X1: "+x1); final int x2 = Y.posX; - Utils.LOG_WARNING("X2: "+x2); + Logger.WARNING("X2: "+x2); final int y1 = X.posY; - Utils.LOG_WARNING("Y1: "+y1); + Logger.WARNING("Y1: "+y1); final int y2 = Y.posY; - Utils.LOG_WARNING("Y2: "+y2); + Logger.WARNING("Y2: "+y2); final int z1 = X.posZ; - Utils.LOG_WARNING("Z1: "+z1); + Logger.WARNING("Z1: "+z1); final int z2 = Y.posZ; - Utils.LOG_WARNING("Z2: "+z2); + Logger.WARNING("Z2: "+z2); final double d = Math.sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1))+((z2-z1)*(z2-z1))); final String xpCost = String.valueOf((int)(d*0.15)); - Utils.LOG_WARNING("d:" + d); - Utils.LOG_WARNING("-----------------------------------------"); - Utils.LOG_WARNING("Actual math formulae"); - Utils.LOG_WARNING(String.valueOf(d)); - Utils.LOG_WARNING("-----------------------------------------"); - Utils.LOG_WARNING("Xp Cost based on answer B."); - Utils.LOG_WARNING(String.valueOf(d*0.15) + " | " + String.valueOf(xpCost)); - Utils.LOG_WARNING("-----------------------------------------"); - Utils.LOG_WARNING("Xp Total"); - Utils.LOG_WARNING(String.valueOf(XP_TOTAL)); - Utils.LOG_WARNING("-----------------------------------------"); + Logger.WARNING("d:" + d); + Logger.WARNING("-----------------------------------------"); + Logger.WARNING("Actual math formulae"); + Logger.WARNING(String.valueOf(d)); + Logger.WARNING("-----------------------------------------"); + Logger.WARNING("Xp Cost based on answer B."); + Logger.WARNING(String.valueOf(d*0.15) + " | " + String.valueOf(xpCost)); + Logger.WARNING("-----------------------------------------"); + Logger.WARNING("Xp Total"); + Logger.WARNING(String.valueOf(XP_TOTAL)); + Logger.WARNING("-----------------------------------------"); diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java index 1360932dfb..11be6f5f2d 100644 --- a/src/Java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java @@ -4,6 +4,7 @@ import static gtPlusPlus.core.lib.CORE.DEBUG; import cpw.mods.fml.common.event.*; import cpw.mods.fml.common.registry.GameRegistry; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.entity.InternalEntityRegistry; @@ -34,12 +35,12 @@ public class CommonProxy { Utils.registerEvent(this); if (LoadedMods.Gregtech){ if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - Utils.LOG_INFO("We're using Gregtech 5.09 Experimental."); + Logger.INFO("We're using Gregtech 5.09 Experimental."); } else { - Utils.LOG_INFO("We're using Gregtech 5.08 or an earlier fork."); + Logger.INFO("We're using Gregtech 5.08 or an earlier fork."); } - Utils.LOG_INFO("Setting up our own GT_Proxy."); + Logger.INFO("Setting up our own GT_Proxy."); GtProxy = new Meta_GT_Proxy(); } else { @@ -48,27 +49,27 @@ public class CommonProxy { } public void preInit(final FMLPreInitializationEvent e) { - Utils.LOG_INFO("Doing some house cleaning."); + Logger.INFO("Doing some house cleaning."); LoadedMods.checkLoaded(); - Utils.LOG_INFO("Making sure we're ready to party!"); + Logger.INFO("Making sure we're ready to party!"); if (!DEBUG){ - Utils.LOG_WARNING("Development mode not enabled."); + Logger.WARNING("Development mode not enabled."); } else if (DEBUG){ - Utils.LOG_INFO("Development mode enabled."); + Logger.INFO("Development mode enabled."); } else { - Utils.LOG_WARNING("Development mode not set."); + Logger.WARNING("Development mode not set."); } AddToCreativeTab.initialiseTabs(); COMPAT_IntermodStaging.preInit(); BookHandler.run(); //Registration of entities and renderers - Utils.LOG_INFO("[Proxy] Calling Entity registrator."); + Logger.INFO("[Proxy] Calling Entity registrator."); registerEntities(); - Utils.LOG_INFO("[Proxy] Calling Tile Entity registrator."); + Logger.INFO("[Proxy] Calling Tile Entity registrator."); registerTileEntities(); @@ -103,7 +104,7 @@ public class CommonProxy { * End of Subscribe Event registration. */ - Utils.LOG_INFO("[Proxy] Calling Render registrator."); + Logger.INFO("[Proxy] Calling Render registrator."); registerRenderThings(); //Compat Handling @@ -113,7 +114,7 @@ public class CommonProxy { } public void postInit(final FMLPostInitializationEvent e) { - Utils.LOG_INFO("Cleaning up, doing postInit."); + Logger.INFO("Cleaning up, doing postInit."); PlayerCache.initCache(); //Circuits @@ -126,7 +127,7 @@ public class CommonProxy { if (!CORE.burnables.isEmpty()){ BurnableFuelHandler fuelHandler = new BurnableFuelHandler(); GameRegistry.registerFuelHandler(fuelHandler); - Utils.LOG_INFO("[Fuel Handler] Registering "+fuelHandler.getClass().getName()); + Logger.INFO("[Fuel Handler] Registering "+fuelHandler.getClass().getName()); } //Compat Handling diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java index c365a19231..55a0a8ac10 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java @@ -1,9 +1,9 @@ package gtPlusPlus.core.common.compat; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.item.general.*; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.Utils; public class COMPAT_Baubles { @@ -17,7 +17,7 @@ public class COMPAT_Baubles { } public static void baublesLoaded(){ - Utils.LOG_INFO("Baubles Found - Loading Wearables."); + Logger.INFO("Baubles Found - Loading Wearables."); ModItems.itemPersonalCloakingDevice = new ItemCloakingDevice(0); //itemPersonalCloakingDeviceCharged = new ItemCloakingDevice(0).set; ModItems.itemPersonalHealingDevice = new ItemHealingDevice(); @@ -27,7 +27,7 @@ public class COMPAT_Baubles { } public static void baublesNotLoaded(){ - Utils.LOG_INFO("Baubles Not Found - Skipping Resources."); + Logger.INFO("Baubles Not Found - Skipping Resources."); } } diff --git a/src/Java/gtPlusPlus/core/config/ConfigHandler.java b/src/Java/gtPlusPlus/core/config/ConfigHandler.java index c86b12b51b..641a4c0956 100644 --- a/src/Java/gtPlusPlus/core/config/ConfigHandler.java +++ b/src/Java/gtPlusPlus/core/config/ConfigHandler.java @@ -1,8 +1,7 @@ package gtPlusPlus.core.config; import static gtPlusPlus.core.item.general.RF2EU_Battery.rfPerEU; -import static gtPlusPlus.core.lib.CORE.DARKBIOME_ID; -import static gtPlusPlus.core.lib.CORE.DEBUG; +import static gtPlusPlus.core.lib.CORE.*; import static gtPlusPlus.core.lib.CORE.ConfigSwitches.*; import static gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_WorldAccelerator.BlacklistedTileEntiyClassNames; @@ -151,6 +150,7 @@ public class ConfigHandler { "Disables Zombie Reinforcement on hard difficutly."); //Biomes + DARKWORLD_ID = config.getInt("darkworld_ID", "worldgen", 227, 1, 254, "The ID of the Dark Dimension."); DARKBIOME_ID = config.getInt("darkbiome_ID", "worldgen", 238, 1, 254, "The biome within the Dark Dimension."); //Blacklisted Accelerator TileEntities diff --git a/src/Java/gtPlusPlus/core/container/Container_HeliumGenerator.java b/src/Java/gtPlusPlus/core/container/Container_HeliumGenerator.java index ffa778a8c6..e45d708761 100644 --- a/src/Java/gtPlusPlus/core/container/Container_HeliumGenerator.java +++ b/src/Java/gtPlusPlus/core/container/Container_HeliumGenerator.java @@ -1,11 +1,11 @@ package gtPlusPlus.core.container; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.inventories.InventoryHeliumGenerator; import gtPlusPlus.core.slots.SlotFuelRod; import gtPlusPlus.core.slots.SlotNoInput; import gtPlusPlus.core.tileentities.general.TileEntityHeliumGenerator; -import gtPlusPlus.core.util.Utils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -54,7 +54,7 @@ public class Container_HeliumGenerator extends Container { { for (var7 = 0; var7 < 3; ++var7) { - Utils.LOG_INFO("Adding slots at var:"+(o)+" x:"+(8 + var7 * 18)+" y:"+(9 + var6 * 18)); + Logger.INFO("Adding slots at var:"+(o)+" x:"+(8 + var7 * 18)+" y:"+(9 + var6 * 18)); this.addSlotToContainer(new SlotFuelRod(this.inventoryChest, o, 8 + (var7 * 18), 18 + (var6 * 18))); this.slotStorage[o] = o; o++; @@ -66,7 +66,7 @@ public class Container_HeliumGenerator extends Container { { for (var7 = 0; var7 < 3; ++var7) { - Utils.LOG_INFO("Adding slots at var:"+(o)+" x:"+(90+8+(var7 * 18))+" y:"+(9 + var6 * 18)); + Logger.INFO("Adding slots at var:"+(o)+" x:"+(90+8+(var7 * 18))+" y:"+(9 + var6 * 18)); this.addSlotToContainer(new SlotFuelRod(this.inventoryChest, o, 116 + (var7 * 18), 18 + (var6 * 18))); this.slotStorage[o] = o; o++; diff --git a/src/Java/gtPlusPlus/core/container/Container_ModularityTable.java b/src/Java/gtPlusPlus/core/container/Container_ModularityTable.java index d870750039..cfa1eed690 100644 --- a/src/Java/gtPlusPlus/core/container/Container_ModularityTable.java +++ b/src/Java/gtPlusPlus/core/container/Container_ModularityTable.java @@ -1,20 +1,16 @@ package gtPlusPlus.core.container; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.inventories.modulartable.InventoryModularMain; import gtPlusPlus.core.inventories.modulartable.InventoryModularOutput; -import gtPlusPlus.core.inventories.projecttable.InventoryProjectMain; -import gtPlusPlus.core.inventories.projecttable.InventoryProjectOutput; import gtPlusPlus.core.slots.*; import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; -import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; -import gtPlusPlus.core.util.Utils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.*; -import net.minecraft.inventory.SlotCrafting; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; import net.minecraft.world.World; public class Container_ModularityTable extends Container { @@ -41,7 +37,7 @@ public class Container_ModularityTable extends Container { this.inventoryOutputs = tile.inventoryOutputs; this.tile_entity.setContainer(this); this.mRecipeTime = this.tile_entity.getRecipeTime(); - Utils.LOG_INFO("Container: "+this.mRecipeTime); + Logger.INFO("Container: "+this.mRecipeTime); int var6; int var7; @@ -103,6 +99,7 @@ public class Container_ModularityTable extends Container { /** * Called when the container is closed. */ + @Override public void onContainerClosed(EntityPlayer p_75134_1_){ super.onContainerClosed(p_75134_1_); if (!this.worldObj.isRemote){ @@ -131,21 +128,21 @@ public class Container_ModularityTable extends Container { } if (aSlotIndex == 0){ - Utils.LOG_INFO("Player Clicked on the bauble slot"); + Logger.INFO("Player Clicked on the bauble slot"); //TODO } else if (aSlotIndex == 1){ - Utils.LOG_INFO("Player Clicked on the upgrade slot"); + Logger.INFO("Player Clicked on the upgrade slot"); //TODO } else if (aSlotIndex == 2){ - Utils.LOG_INFO("Player Clicked on the output slot"); + Logger.INFO("Player Clicked on the output slot"); //TODO } else { for (final int x : this.slotGrid){ if (aSlotIndex == x){ - Utils.LOG_INFO("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); + Logger.INFO("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); } } } diff --git a/src/Java/gtPlusPlus/core/container/Container_ProjectTable.java b/src/Java/gtPlusPlus/core/container/Container_ProjectTable.java index 25e6756f71..dabe97ea45 100644 --- a/src/Java/gtPlusPlus/core/container/Container_ProjectTable.java +++ b/src/Java/gtPlusPlus/core/container/Container_ProjectTable.java @@ -1,15 +1,14 @@ package gtPlusPlus.core.container; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.inventories.projecttable.InventoryProjectMain; import gtPlusPlus.core.inventories.projecttable.InventoryProjectOutput; import gtPlusPlus.core.slots.*; import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; -import gtPlusPlus.core.util.Utils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.*; -import net.minecraft.inventory.SlotCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.world.World; @@ -93,7 +92,8 @@ public class Container_ProjectTable extends Container { /** * Callback for when the crafting matrix is changed. */ - public void onCraftMatrixChanged(IInventory p_75130_1_) + @Override + public void onCraftMatrixChanged(IInventory p_75130_1_) { this.craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj)); } @@ -101,7 +101,8 @@ public class Container_ProjectTable extends Container { /** * Called when the container is closed. */ - public void onContainerClosed(EntityPlayer p_75134_1_){ + @Override + public void onContainerClosed(EntityPlayer p_75134_1_){ super.onContainerClosed(p_75134_1_); if (!this.worldObj.isRemote){ for (int i = 0; i < 9; ++i){ @@ -122,16 +123,16 @@ public class Container_ProjectTable extends Container { } if (aSlotIndex == 0){ - Utils.LOG_INFO("Player Clicked on the Data Stick slot"); + Logger.INFO("Player Clicked on the Data Stick slot"); //TODO }if (aSlotIndex == 1){ - Utils.LOG_INFO("Player Clicked on the output slot"); + Logger.INFO("Player Clicked on the output slot"); //TODO } for (final int x : this.slotGrid){ if (aSlotIndex == x){ - Utils.LOG_INFO("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); + Logger.INFO("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); } } } @@ -212,6 +213,7 @@ public class Container_ProjectTable extends Container { } //Can merge Slot + @Override public boolean func_94530_a(ItemStack p_94530_1_, Slot p_94530_2_){ return p_94530_2_.inventory != this.craftResult && super.func_94530_a(p_94530_1_, p_94530_2_); } diff --git a/src/Java/gtPlusPlus/core/container/Container_TradeTable.java b/src/Java/gtPlusPlus/core/container/Container_TradeTable.java index e79a51f242..271dc8ef2c 100644 --- a/src/Java/gtPlusPlus/core/container/Container_TradeTable.java +++ b/src/Java/gtPlusPlus/core/container/Container_TradeTable.java @@ -1,14 +1,16 @@ package gtPlusPlus.core.container; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.inventories.tradetable.InventoryTradeMain; import gtPlusPlus.core.inventories.tradetable.InventoryTradeOutput; -import gtPlusPlus.core.slots.*; +import gtPlusPlus.core.slots.SlotGeneric; +import gtPlusPlus.core.slots.SlotNoInput; import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; -import gtPlusPlus.core.util.Utils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.*; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -35,7 +37,7 @@ public class Container_TradeTable extends Container { this.tile_entity.setContainer(this); if (te.isServerSide()) - Utils.LOG_INFO("Container - "+te.mOwnerName); + Logger.INFO("Container - "+te.mOwnerName); int var6; int var7; @@ -88,6 +90,7 @@ public class Container_TradeTable extends Container { /** * Called when the container is closed. */ + @Override public void onContainerClosed(EntityPlayer p_75134_1_){ super.onContainerClosed(p_75134_1_); if (!this.worldObj.isRemote){ @@ -109,16 +112,16 @@ public class Container_TradeTable extends Container { } if (aSlotIndex == 0){ - Utils.LOG_INFO("Player Clicked on the Data Stick slot"); + Logger.INFO("Player Clicked on the Data Stick slot"); //TODO }if (aSlotIndex == 1){ - Utils.LOG_INFO("Player Clicked on the output slot"); + Logger.INFO("Player Clicked on the output slot"); //TODO } for (final int x : this.slotGrid){ if (aSlotIndex == x){ - Utils.LOG_INFO("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); + Logger.INFO("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); } } } diff --git a/src/Java/gtPlusPlus/core/container/Container_Workbench.java b/src/Java/gtPlusPlus/core/container/Container_Workbench.java index 92398c12dd..e3b7e9d614 100644 --- a/src/Java/gtPlusPlus/core/container/Container_Workbench.java +++ b/src/Java/gtPlusPlus/core/container/Container_Workbench.java @@ -1,13 +1,13 @@ package gtPlusPlus.core.container; import gregtech.api.gui.GT_Slot_Holo; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.interfaces.IItemBlueprint; import gtPlusPlus.core.inventories.*; import gtPlusPlus.core.item.general.ItemBlueprint; import gtPlusPlus.core.slots.*; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -185,74 +185,74 @@ public class Container_Workbench extends Container { } if (aSlotIndex == this.slotOutput){ - Utils.LOG_WARNING("Player Clicked on the output slot"); + Logger.WARNING("Player Clicked on the output slot"); //TODO } for (final int x : this.slotHolo){ if (aSlotIndex == x){ - Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Holo Grid"); + Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the Holo Grid"); if (x == 1){ - Utils.LOG_WARNING("Player Clicked Blueprint slot in the Holo Grid"); + Logger.WARNING("Player Clicked Blueprint slot in the Holo Grid"); } else if (x == 2){ - Utils.LOG_WARNING("Player Clicked Right Arrow slot in the Holo Grid"); + Logger.WARNING("Player Clicked Right Arrow slot in the Holo Grid"); if (this.inventoryHolo.getStackInSlot(1) != null){ - Utils.LOG_WARNING("Found an ItemStack."); + Logger.WARNING("Found an ItemStack."); if (this.inventoryHolo.getStackInSlot(1).getItem() instanceof IItemBlueprint){ - Utils.LOG_WARNING("Found a blueprint."); + Logger.WARNING("Found a blueprint."); final ItemStack tempBlueprint = this.inventoryHolo.getStackInSlot(1); final ItemBlueprint tempItemBlueprint = (ItemBlueprint) tempBlueprint.getItem(); if ((this.inventoryHolo.getStackInSlot(0) != null) && !tempItemBlueprint.hasBlueprint(tempBlueprint)){ - Utils.LOG_WARNING("Output slot was not empty."); - Utils.LOG_WARNING("Trying to manipulate NBT data on the blueprint stack, then replace it with the new one."); + Logger.WARNING("Output slot was not empty."); + Logger.WARNING("Trying to manipulate NBT data on the blueprint stack, then replace it with the new one."); tempItemBlueprint.setBlueprint(this.inventoryHolo.getStackInSlot(1), this.craftMatrix, this.inventoryHolo.getStackInSlot(0)); final ItemStack newTempBlueprint = ItemUtils.getSimpleStack(tempItemBlueprint); this.inventoryHolo.setInventorySlotContents(1, newTempBlueprint); - Utils.LOG_WARNING(ItemUtils.getArrayStackNames(tempItemBlueprint.getBlueprint(newTempBlueprint))); + Logger.WARNING(ItemUtils.getArrayStackNames(tempItemBlueprint.getBlueprint(newTempBlueprint))); } else { if (tempItemBlueprint.hasBlueprint(tempBlueprint)){ - Utils.LOG_WARNING("Blueprint already holds a recipe."); + Logger.WARNING("Blueprint already holds a recipe."); } else { - Utils.LOG_WARNING("Output slot was empty."); + Logger.WARNING("Output slot was empty."); } } } else { - Utils.LOG_WARNING("ItemStack found was not a blueprint."); + Logger.WARNING("ItemStack found was not a blueprint."); } } else { - Utils.LOG_WARNING("No ItemStack found in Blueprint slot."); + Logger.WARNING("No ItemStack found in Blueprint slot."); } } else if (x == 3){ - Utils.LOG_WARNING("Player Clicked Big [P] slot in the Holo Grid"); + Logger.WARNING("Player Clicked Big [P] slot in the Holo Grid"); } else if (x == 4){ - Utils.LOG_WARNING("Player Clicked Transfer to Crafting Grid slot in the Holo Grid"); + Logger.WARNING("Player Clicked Transfer to Crafting Grid slot in the Holo Grid"); } else if (x == 5){ - Utils.LOG_WARNING("Player Clicked Transfer to Storage Grid slot in the Holo Grid"); + Logger.WARNING("Player Clicked Transfer to Storage Grid slot in the Holo Grid"); } } } for (final int x : this.slotCrafting){ if (aSlotIndex == x){ - Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); + Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); } } for (final int x : this.slotStorage){ if (aSlotIndex == x){ - Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the storage Grid"); + Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the storage Grid"); } } for (final int x : this.slotTools){ if (aSlotIndex == x){ - Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the tool Grid"); + Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the tool Grid"); } } } diff --git a/src/Java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java index 4fefb8b3f5..453b965bc7 100644 --- a/src/Java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java +++ b/src/Java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java @@ -1,13 +1,13 @@ package gtPlusPlus.core.container; import gregtech.api.gui.GT_Slot_Holo; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.interfaces.IItemBlueprint; import gtPlusPlus.core.inventories.*; import gtPlusPlus.core.item.general.ItemBlueprint; import gtPlusPlus.core.slots.*; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -151,74 +151,74 @@ public class Container_WorkbenchAdvanced extends Container { } if (aSlotIndex == this.slotOutput){ - Utils.LOG_WARNING("Player Clicked on the output slot"); + Logger.WARNING("Player Clicked on the output slot"); //TODO } for (final int x : this.slotHolo){ if (aSlotIndex == x){ - Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Holo Grid"); + Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the Holo Grid"); if (x == 1){ - Utils.LOG_WARNING("Player Clicked Blueprint slot in the Holo Grid"); + Logger.WARNING("Player Clicked Blueprint slot in the Holo Grid"); } else if (x == 2){ - Utils.LOG_WARNING("Player Clicked Right Arrow slot in the Holo Grid"); + Logger.WARNING("Player Clicked Right Arrow slot in the Holo Grid"); if (this.inventoryHolo.getStackInSlot(1) != null){ - Utils.LOG_WARNING("Found an ItemStack."); + Logger.WARNING("Found an ItemStack."); if (this.inventoryHolo.getStackInSlot(1).getItem() instanceof IItemBlueprint){ - Utils.LOG_WARNING("Found a blueprint."); + Logger.WARNING("Found a blueprint."); final ItemStack tempBlueprint = this.inventoryHolo.getStackInSlot(1); final ItemBlueprint tempItemBlueprint = (ItemBlueprint) tempBlueprint.getItem(); if ((this.inventoryHolo.getStackInSlot(0) != null) && !tempItemBlueprint.hasBlueprint(tempBlueprint)){ - Utils.LOG_WARNING("Output slot was not empty."); - Utils.LOG_WARNING("Trying to manipulate NBT data on the blueprint stack, then replace it with the new one."); + Logger.WARNING("Output slot was not empty."); + Logger.WARNING("Trying to manipulate NBT data on the blueprint stack, then replace it with the new one."); tempItemBlueprint.setBlueprint(this.inventoryHolo.getStackInSlot(1), this.craftMatrix, this.inventoryHolo.getStackInSlot(0)); final ItemStack newTempBlueprint = ItemUtils.getSimpleStack(tempItemBlueprint); this.inventoryHolo.setInventorySlotContents(1, newTempBlueprint); - Utils.LOG_WARNING(ItemUtils.getArrayStackNames(tempItemBlueprint.getBlueprint(newTempBlueprint))); + Logger.WARNING(ItemUtils.getArrayStackNames(tempItemBlueprint.getBlueprint(newTempBlueprint))); } else { if (tempItemBlueprint.hasBlueprint(tempBlueprint)){ - Utils.LOG_WARNING("Blueprint already holds a recipe."); + Logger.WARNING("Blueprint already holds a recipe."); } else { - Utils.LOG_WARNING("Output slot was empty."); + Logger.WARNING("Output slot was empty."); } } } else { - Utils.LOG_WARNING("ItemStack found was not a blueprint."); + Logger.WARNING("ItemStack found was not a blueprint."); } } else { - Utils.LOG_WARNING("No ItemStack found in Blueprint slot."); + Logger.WARNING("No ItemStack found in Blueprint slot."); } } else if (x == 3){ - Utils.LOG_WARNING("Player Clicked Big [P] slot in the Holo Grid"); + Logger.WARNING("Player Clicked Big [P] slot in the Holo Grid"); } else if (x == 4){ - Utils.LOG_WARNING("Player Clicked Transfer to Crafting Grid slot in the Holo Grid"); + Logger.WARNING("Player Clicked Transfer to Crafting Grid slot in the Holo Grid"); } else if (x == 5){ - Utils.LOG_WARNING("Player Clicked Transfer to Storage Grid slot in the Holo Grid"); + Logger.WARNING("Player Clicked Transfer to Storage Grid slot in the Holo Grid"); } } } for (final int x : this.slotCrafting){ if (aSlotIndex == x){ - Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); + Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); } } for (final int x : this.slotStorage){ if (aSlotIndex == x){ - Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the storage Grid"); + Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the storage Grid"); } } for (final int x : this.slotTools){ if (aSlotIndex == x){ - Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the tool Grid"); + Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the tool Grid"); } } } diff --git a/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java b/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java index 5eb6e91812..5233c876e9 100644 --- a/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java +++ b/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java @@ -2,19 +2,19 @@ package gtPlusPlus.core.entity; import cpw.mods.fml.common.registry.EntityRegistry; import gtPlusPlus.GTplusplus; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.entity.monster.EntitySickBlaze; import gtPlusPlus.core.entity.monster.EntityStaballoyConstruct; import gtPlusPlus.core.entity.projectile.EntityHydrofluoricAcidPotion; import gtPlusPlus.core.entity.projectile.EntitySulfuricAcidPotion; import gtPlusPlus.core.entity.projectile.EntityToxinballSmall; -import gtPlusPlus.core.util.Utils; public class InternalEntityRegistry { static int mEntityID = 0; public static void registerEntities(){ - Utils.LOG_INFO("Registering GT++ Entities."); + Logger.INFO("Registering GT++ Entities."); //EntityRegistry.registerModEntity(EntityMiningChargePrimed.class, "MiningCharge", 3, Main.modInstance, 64, 20, true); EntityRegistry.registerModEntity(EntityPrimedMiningExplosive.class, "MiningCharge", mEntityID++, GTplusplus.instance, 64, 20, true); EntityRegistry.registerModEntity(EntitySulfuricAcidPotion.class, "throwablePotionSulfuric", mEntityID++, GTplusplus.instance, 64, 20, true); diff --git a/src/Java/gtPlusPlus/core/entity/monster/EntitySickBlaze.java b/src/Java/gtPlusPlus/core/entity/monster/EntitySickBlaze.java index 13ecf99bc1..4e2a4c4439 100644 --- a/src/Java/gtPlusPlus/core/entity/monster/EntitySickBlaze.java +++ b/src/Java/gtPlusPlus/core/entity/monster/EntitySickBlaze.java @@ -5,7 +5,6 @@ import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.entity.projectile.EntityToxinballSmall; import net.minecraft.entity.Entity; import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.monster.EntityBlaze; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; @@ -216,4 +215,9 @@ public class EntitySickBlaze extends EntityMob { protected boolean isValidLightLevel() { return true; } + + @Override + public int getMaxSpawnedInChunk() { + return 8; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java b/src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java index 2cbd00bf2c..cd7878273f 100644 --- a/src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java +++ b/src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java @@ -1,45 +1,78 @@ package gtPlusPlus.core.entity.monster; +import java.lang.reflect.Field; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.core.world.explosions.ExplosionHandler; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.*; import net.minecraft.entity.ai.*; +import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.monster.EntityIronGolem; import net.minecraft.entity.monster.IMob; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.*; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; import net.minecraft.village.Village; import net.minecraft.world.World; public class EntityStaballoyConstruct extends EntityIronGolem { - /** deincrements, and a distance-to-home check is done at 0 */ - private int homeCheckTimer; - Village villageObj; - private int attackTimer; - private int holdRoseTick; + + /* + * Determines whether or not the entity is in a fluid at all. + */ + private volatile boolean inFluid = false; + private volatile boolean mReflectFirstUpdate = true; + private volatile boolean isReadyToExplode = false; + private volatile int fuse = 60; + private volatile int attackTimer; public EntityStaballoyConstruct(World world) { super(world); + this.experienceValue = 250; this.setSize(1.4F, 2.9F); this.getNavigator().setAvoidsWater(true); + this.getNavigator().setBreakDoors(true); + this.getNavigator().setCanSwim(false); + this.getNavigator().setAvoidSun(false); this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); - //this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); + this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); //this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); - this.tasks.addTask(2, new EntityAIMoveTowardsRestriction(this, 1.0D)); - this.tasks.addTask(3, new EntityAIWander(this, 0.6D)); - this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); - this.tasks.addTask(5, new EntityAILookIdle(this)); + this.tasks.addTask(3, new EntityAIMoveTowardsRestriction(this, 1.0D)); + this.tasks.addTask(4, new EntityAIWander(this, 0.6D)); + this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(6, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false)); - //this.targetTasks.addTask(2, - //new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + @Override + public void writeEntityToNBT(NBTTagCompound p_70014_1_) { + super.writeEntityToNBT(p_70014_1_); + p_70014_1_.setBoolean("inFluid", this.inFluid); + p_70014_1_.setBoolean("isReadyToExplode", this.isReadyToExplode); + p_70014_1_.setInteger("fuse", this.fuse); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + @Override + public void readEntityFromNBT(NBTTagCompound p_70037_1_) { + super.readEntityFromNBT(p_70037_1_); + this.inFluid = p_70037_1_.getBoolean("inFluid"); + this.isReadyToExplode = p_70037_1_.getBoolean("isReadyToExplode"); + this.fuse = p_70037_1_.getInteger("fuse"); } @Override @@ -61,11 +94,6 @@ public class EntityStaballoyConstruct extends EntityIronGolem { */ @Override protected void updateAITick() { - if (--this.homeCheckTimer <= 0) { - this.homeCheckTimer = 70 + this.rand.nextInt(50); - this.detachHome(); - } - super.updateAITick(); } @@ -81,7 +109,7 @@ public class EntityStaballoyConstruct extends EntityIronGolem { */ @Override protected int decreaseAirSupply(int p_70682_1_) { - return p_70682_1_; + return 0; } @Override @@ -106,10 +134,6 @@ public class EntityStaballoyConstruct extends EntityIronGolem { --this.attackTimer; } - if (this.holdRoseTick > 0) { - --this.holdRoseTick; - } - if (this.motionX * this.motionX + this.motionZ * this.motionZ > 2.500000277905201E-7D && this.rand.nextInt(5) == 0) { int i = MathHelper.floor_double(this.posX); @@ -117,8 +141,8 @@ public class EntityStaballoyConstruct extends EntityIronGolem { int k = MathHelper.floor_double(this.posZ); Block block = this.worldObj.getBlock(i, j, k); - - + + if (block.getMaterial() != Material.air) { this.worldObj.spawnParticle( "blockcrack_" + Block.getIdFromBlock(block) + "_" + this.worldObj.getBlockMetadata(i, j, k), @@ -135,27 +159,8 @@ public class EntityStaballoyConstruct extends EntityIronGolem { * Returns true if this entity can attack entities of the specified class. */ @Override - public boolean canAttackClass(Class p_70686_1_) { - return this.isPlayerCreated() && EntityPlayer.class.isAssignableFrom(p_70686_1_) ? false - : super.canAttackClass(p_70686_1_); - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - @Override - public void writeEntityToNBT(NBTTagCompound p_70014_1_) { - super.writeEntityToNBT(p_70014_1_); - p_70014_1_.setBoolean("PlayerCreated", this.isPlayerCreated()); - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - @Override - public void readEntityFromNBT(NBTTagCompound p_70037_1_) { - super.readEntityFromNBT(p_70037_1_); - this.setPlayerCreated(p_70037_1_.getBoolean("PlayerCreated")); + public boolean canAttackClass(Class clazz) { + return clazz.equals(this.getClass()) ? false : true; } @Override @@ -180,28 +185,22 @@ public class EntityStaballoyConstruct extends EntityIronGolem { this.attackTimer = 10; this.playSound("mob.irongolem.throw", 1.0F, 1.0F); } - else if (p_70103_1_ == 11) { - this.holdRoseTick = 400; - } else { super.handleHealthUpdate(p_70103_1_); } } + @Override public Village getVillage() { return null; } + @Override @SideOnly(Side.CLIENT) public int getAttackTimer() { return this.attackTimer; } - public void setHoldingRose(boolean p_70851_1_) { - this.holdRoseTick = p_70851_1_ ? 400 : 0; - this.worldObj.setEntityState(this, (byte) 11); - } - /** * Returns the sound this mob makes when it is hurt. */ @@ -220,7 +219,7 @@ public class EntityStaballoyConstruct extends EntityIronGolem { @Override protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) { - //this.playSound("mob.irongolem.walk", 1.0F, 1.0F); + this.playSound("mob.irongolem.walk", 1.0F, 1.0F); } /** @@ -248,14 +247,12 @@ public class EntityStaballoyConstruct extends EntityIronGolem { } } - public int getHoldRoseTick() { - return this.holdRoseTick; - } - + @Override public boolean isPlayerCreated() { return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; } + @Override public void setPlayerCreated(boolean p_70849_1_) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); @@ -274,4 +271,274 @@ public class EntityStaballoyConstruct extends EntityIronGolem { public void onDeath(DamageSource p_70645_1_) { super.onDeath(p_70645_1_); } + + @Override + protected String getLivingSound() { //TODO + return super.getLivingSound(); + } + + @Override + public int getTalkInterval() { + return 0; + } + + @Override + protected boolean canDespawn() { + return true; + } + + @Override + public void onEntityUpdate() { + //Set Fire Immunity + if (!this.isImmuneToFire){ + this.isImmuneToFire = true; + } + + if (this.getHealth() <= (this.getMaxHealth()*MathUtils.randDouble(0.02, 0.15))){ + float r = MathUtils.randFloat(0, 1); + if (r <= 0.1){ + this.isReadyToExplode = true; + } + } + + //Handle Exploding + if (isReadyToExplode){ + if (this.fuse-- <= 0){ + this.setDead(); + + if (!this.worldObj.isRemote) + { + this.explode(); + } + } + else { + + int maxFuse = 60; + int fuseUsed = maxFuse-this.fuse; + float var2 = (float) (fuseUsed * 0.1); + + this.setSize(1.4F+(var2/2), 2.9F+(var2/2)); + + float r = MathUtils.randFloat(0, 1); + int r2 = MathUtils.randInt(5, 15); + for (int o=0;o<r2;o++){ + if (r <= 0.3){ + this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + + } + else if (r <= 0.6){ + this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + + } + if (r <= 0.3){ + this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + + } + else if (r <= 0.7){ + this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + + } + if (r <= 0.2){ + this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + + } + else if (r <= 0.5){ + this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + + } + else if (r <= 0.7){ + this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D); + + } + } + + + } + } + + //Get a private field from a super class if it exists. + try { + if (ReflectionUtils.getField(Class.forName("net.minecraft.entity.Entity"), "firstUpdate") != null && mReflectFirstUpdate == true){ + Field x = ReflectionUtils.getField(Class.forName("net.minecraft.entity.Entity"), "firstUpdate"); + try { + this.mReflectFirstUpdate = (boolean) x.get(this); + Logger.REFLECTION("Successfully got 'firstUpdate' variable state via reflection."); + } + catch (IllegalArgumentException | IllegalAccessException e) {} + } + } + catch (NoSuchFieldException | ClassNotFoundException e) {} + super.onEntityUpdate(); + } + + @Override + public int getMaxSpawnedInChunk() { + return 1; + } + + @Override + public boolean canBreatheUnderwater() { + return true; + } + + @Override + public void knockBack(Entity p_70653_1_, float p_70653_2_, double p_70653_3_, double p_70653_5_) { + // Do Nothing because he weighs metric shittonnes. + } + + @Override + protected void setOnFireFromLava() { + extinguish(); + } + + @Override + public void setFire(int p_70015_1_) { + extinguish(); + } + + @Override + protected void dealFireDamage(int p_70081_1_) { + + } + + @Override + public boolean isInWater() { + if (super.isInWater()){ + return true; + } + else { + this.moveForward *= 0.98F; + return false; + } + } + + @Override + public boolean handleWaterMovement() { + this.moveForward *= 0.74F; + return handleFluidMovement(Material.water); + } + + @Override + public boolean handleLavaMovement() { + this.moveForward *= 0.74F; + return handleFluidMovement(Material.lava); + } + + /** + * Returns if this entity is in water and will end up adding the waters velocity to the entity + */ + public boolean handleFluidMovement(Material fluid){ + + + + if (this.worldObj.handleMaterialAcceleration(this.boundingBox.expand(0.0D, -0.4000000059604645D, 0.0D).contract(0.001D, 0.001D, 0.001D), fluid, this)) + { + if (!this.inFluid && !this.mReflectFirstUpdate) + { + float f = MathHelper.sqrt_double(this.motionX * this.motionX * 0.20000000298023224D + this.motionY * this.motionY + this.motionZ * this.motionZ * 0.20000000298023224D) * 0.2F; + + if (f > 1.0F) + { + f = 1.0F; + } + + this.playSound(this.getSplashSound(), f, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.4F); + float f1 = MathHelper.floor_double(this.boundingBox.minY); + int i; + float f2; + float f3; + + for (i = 0; i < 1.0F + this.width * 20.0F; ++i) + { + f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + f3 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + this.worldObj.spawnParticle("bubble", this.posX + f2, f1 + 1.0F, this.posZ + f3, this.motionX, this.motionY - this.rand.nextFloat() * 0.2F, this.motionZ); + } + + for (i = 0; i < 1.0F + this.width * 20.0F; ++i) + { + f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + f3 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + this.worldObj.spawnParticle("splash", this.posX + f2, f1 + 1.0F, this.posZ + f3, this.motionX, this.motionY, this.motionZ); + } + } + this.fallDistance = 0.0F; + this.inFluid = true; + } + else + { + this.inFluid = false; + } + return this.inFluid; + } + + @Override + public void onChunkLoad() { + // TODO Auto-generated method stub + super.onChunkLoad(); + } + + @Override + public void onStruckByLightning(EntityLightningBolt p_70077_1_) { + this.isReadyToExplode = true; + this.fuse = 20; + } + + private void explode(){ + /* float f = 12.0F; + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true);*/ + + final float f = 16F; + ExplosionHandler explode = new ExplosionHandler(); + explode.createExplosion(this.worldObj, this, this.posX, this.posY, this.posZ, f, true, true); + + float r = MathUtils.randFloat(0, 1); + int r2 = MathUtils.randInt(20, 40); + for (int o=0;o<r2;o++){ + if (r <= 0.3){ + this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(0, 3), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D); + + } + else if (r <= 0.6){ + this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D); + + } + if (r <= 0.3){ + this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D); + + } + else if (r <= 0.7){ + this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D); + + } + if (r <= 0.2){ + this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D); + + } + else if (r <= 0.5){ + this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D); + + } + else if (r <= 0.7){ + this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D); + + } + } + + } + + @Override + public boolean canAttackWithItem() { + return true; + } + + @Override + public boolean canRenderOnFire() { + return false; + } + + @Override + public boolean isPushedByWater() { + return false; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/projectile/EntityHydrofluoricAcidPotion.java b/src/Java/gtPlusPlus/core/entity/projectile/EntityHydrofluoricAcidPotion.java index 8b86d456b7..c935409650 100644 --- a/src/Java/gtPlusPlus/core/entity/projectile/EntityHydrofluoricAcidPotion.java +++ b/src/Java/gtPlusPlus/core/entity/projectile/EntityHydrofluoricAcidPotion.java @@ -5,10 +5,8 @@ import gtPlusPlus.core.util.array.BlockPos; import gtPlusPlus.core.util.entity.EntityUtils; import gtPlusPlus.core.util.math.MathUtils; import net.minecraft.block.Block; -import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.init.Blocks; import net.minecraft.potion.Potion; @@ -34,6 +32,7 @@ public class EntityHydrofluoricAcidPotion extends EntityThrowable { /** * Called when this EntityThrowable hits a block or entity. */ + @Override protected void onImpact(MovingObjectPosition object) { int xBlock = object.blockX; int yBlock = object.blockY; @@ -41,7 +40,7 @@ public class EntityHydrofluoricAcidPotion extends EntityThrowable { if (object.entityHit != null) { byte b0 = 6; if (!GT_Utility.isWearingFullRadioHazmat((EntityLivingBase) object.entityHit)){ - object.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float) b0); + object.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), b0); EntityUtils.setEntityOnFire(object.entityHit, 5); if (object.entityHit instanceof EntityPlayer){ diff --git a/src/Java/gtPlusPlus/core/entity/projectile/EntitySulfuricAcidPotion.java b/src/Java/gtPlusPlus/core/entity/projectile/EntitySulfuricAcidPotion.java index 38bcb42791..cd4bec52bf 100644 --- a/src/Java/gtPlusPlus/core/entity/projectile/EntitySulfuricAcidPotion.java +++ b/src/Java/gtPlusPlus/core/entity/projectile/EntitySulfuricAcidPotion.java @@ -29,6 +29,7 @@ public class EntitySulfuricAcidPotion extends EntityThrowable { /** * Called when this EntityThrowable hits a block or entity. */ + @Override protected void onImpact(MovingObjectPosition object) { int xBlock = object.blockX; int yBlock = object.blockY; @@ -36,7 +37,7 @@ public class EntitySulfuricAcidPotion extends EntityThrowable { if (object.entityHit != null) { byte b0 = 6; if (!GT_Utility.isWearingFullRadioHazmat((EntityLivingBase) object.entityHit)){ - object.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float) b0); + object.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), b0); EntityUtils.setEntityOnFire(object.entityHit, 10); object.entityHit.fireResistance = 0; ravage(EntityUtils.findBlockPosUnderEntity(object.entityHit)); diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_TradeTable.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_TradeTable.java index ea4d4ff2b8..70c4ce423a 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_TradeTable.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_TradeTable.java @@ -4,10 +4,10 @@ import org.lwjgl.opengl.GL11; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.container.Container_TradeTable; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; -import gtPlusPlus.core.util.Utils; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; @@ -27,13 +27,13 @@ public class GUI_TradeTable extends GuiContainer { if (te == null){ this.mThisTable = null; this.mOwnerName = mOwnerName; - Utils.LOG_INFO("Set invalid TE in GUI"); + Logger.INFO("Set invalid TE in GUI"); } else { if (te.isServerSide()){ mThisTable = te; this.mOwnerName = mOwnerName; - Utils.LOG_INFO("Set valid TE in GUI"); + Logger.INFO("Set valid TE in GUI"); } } } diff --git a/src/Java/gtPlusPlus/core/handler/BookHandler.java b/src/Java/gtPlusPlus/core/handler/BookHandler.java index 98b7fd5485..f62d3d869d 100644 --- a/src/Java/gtPlusPlus/core/handler/BookHandler.java +++ b/src/Java/gtPlusPlus/core/handler/BookHandler.java @@ -3,8 +3,8 @@ package gtPlusPlus.core.handler; import java.util.HashMap; import java.util.Map; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; import net.minecraft.init.Items; @@ -22,7 +22,7 @@ public class BookHandler { public static void run(){ - Utils.LOG_INFO("Writing books."); + Logger.INFO("Writing books."); //Thermal Boiler book_ThermalBoiler = writeBookTemplate( diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index ad26dbaf39..14f281b2e9 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -7,13 +7,13 @@ import java.util.Queue; import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.common.compat.*; import gtPlusPlus.core.handler.Recipes.LateRegistrationHandler; import gtPlusPlus.core.handler.Recipes.RegistrationHandler; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.recipe.*; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; import gtPlusPlus.xmod.gregtech.registration.gregtech.*; @@ -28,7 +28,7 @@ public class COMPAT_HANDLER { public static void registerMyModsOreDictEntries(){ - Utils.LOG_INFO("Registering Materials with OreDict."); + Logger.INFO("Registering Materials with OreDict."); //In-house //tools diff --git a/src/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java index 4b7e58cf70..c522229771 100644 --- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java +++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java @@ -3,6 +3,7 @@ package gtPlusPlus.core.handler; import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; import gtPlusPlus.GTplusplus; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.container.Container_BackpackBase; import gtPlusPlus.core.container.Container_FishTrap; import gtPlusPlus.core.container.Container_Grindle; @@ -31,7 +32,6 @@ import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.thaumcraft.common.tile.TileFastAlchemyFurnace; import gtPlusPlus.xmod.thaumcraft.gui.ContainerFastAlchemyFurnace; import gtPlusPlus.xmod.thaumcraft.gui.GuiFastAlchemyFurnace; @@ -56,7 +56,7 @@ public class GuiHandler implements IGuiHandler { public static void init(){ - Utils.LOG_INFO("Registering GUIs."); + Logger.INFO("Registering GUIs."); NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new GuiHandler()); //Register GuiHandler //NetworkRegistry.INSTANCE.registerGuiHandler(GTplusplus.instance, new GuiHandler()); @@ -87,7 +87,7 @@ public class GuiHandler implements IGuiHandler { return new Container_Workbench(player.inventory, (TileEntityWorkbench)te); } else if (ID == GUI5){ - Utils.LOG_INFO("sad"); + Logger.INFO("sad"); return new Container_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced)te); } @@ -117,7 +117,7 @@ public class GuiHandler implements IGuiHandler { @Override //GuiModTileEntity public Object getClientGuiElement(final int ID, final EntityPlayer player, final World world, final int x, final int y, final int z) { - Utils.LOG_WARNING("getClientGuiElement Called by: "+player+", in world: "+player.dimension+" at x:"+x+", y:"+y+", z:"+z+"."); + Logger.WARNING("getClientGuiElement Called by: "+player+", in world: "+player.dimension+" at x:"+x+", y:"+y+", z:"+z+"."); final TileEntity te = world.getTileEntity(x, y, z); if (te != null){ if (ID == GUI1){ @@ -140,7 +140,7 @@ public class GuiHandler implements IGuiHandler { return new GUI_Workbench(player.inventory, (TileEntityWorkbench)te); } else if (ID == GUI5){ - Utils.LOG_INFO("sad"); + Logger.INFO("sad"); return new GUI_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced)te); } else if (ID == GUI6){ diff --git a/src/Java/gtPlusPlus/core/handler/OldCircuitHandler.java b/src/Java/gtPlusPlus/core/handler/OldCircuitHandler.java index 1c023b7304..6f968f4ab0 100644 --- a/src/Java/gtPlusPlus/core/handler/OldCircuitHandler.java +++ b/src/Java/gtPlusPlus/core/handler/OldCircuitHandler.java @@ -11,8 +11,8 @@ import gregtech.api.enums.GT_Values; import gregtech.api.util.EmptyRecipeMap; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.reflect.ReflectionUtils; public class OldCircuitHandler { @@ -33,15 +33,15 @@ public class OldCircuitHandler { private static boolean removeCircuitRecipeMap(){ try { - Utils.LOG_INFO("[Old Feature - Circuits] Trying to override the Circuit Assembler Recipe map, so that no recipes for new circuits get added."); + Logger.INFO("[Old Feature - Circuits] Trying to override the Circuit Assembler Recipe map, so that no recipes for new circuits get added."); ReflectionUtils.setFinalStatic(GT_Recipe_Map.class.getDeclaredField("sCircuitAssemblerRecipes"), new EmptyRecipeMap(new HashSet<GT_Recipe>(0), "gt.recipe.removed", "Removed", null, GT_Values.RES_PATH_GUI + "basicmachines/Default", 0, 0, 0, 0, 0, GT_Values.E, 0, GT_Values.E, true, false)); Field jaffar = GT_Recipe_Map.class.getDeclaredField("sCircuitAssemblerRecipes"); FieldUtils.removeFinalModifier(jaffar, true); jaffar.set(null, new EmptyRecipeMap(new HashSet<GT_Recipe>(0), "gt.recipe.removed", "Removed", null, GT_Values.RES_PATH_GUI + "basicmachines/Default", 0, 0, 0, 0, 0, GT_Values.E, 0, GT_Values.E, true, false)); - Utils.LOG_INFO("[Old Feature - Circuits] Successfully replaced circuit assembler recipe map with one that cannot hold recipes."); + Logger.INFO("[Old Feature - Circuits] Successfully replaced circuit assembler recipe map with one that cannot hold recipes."); } catch (Exception e) { - Utils.LOG_INFO("[Old Feature - Circuits] Failed removing circuit assembler recipe map."); + Logger.INFO("[Old Feature - Circuits] Failed removing circuit assembler recipe map."); return false; } return true; diff --git a/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java b/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java index a24b08d781..5bf6374725 100644 --- a/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java +++ b/src/Java/gtPlusPlus/core/handler/Recipes/LateRegistrationHandler.java @@ -1,8 +1,8 @@ package gtPlusPlus.core.handler.Recipes; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.handler.COMPAT_HANDLER; import gtPlusPlus.core.recipe.ShapedRecipeObject; -import gtPlusPlus.core.util.Utils; public class LateRegistrationHandler { @@ -20,9 +20,9 @@ public class LateRegistrationHandler { try { Thread.sleep(10); } catch (final InterruptedException e) { - Utils.LOG_INFO(e.toString()); + Logger.INFO(e.toString()); } - Utils.LOG_INFO("Late Recipes Loaded: "+recipesSuccess+" Failed: "+recipesFailed); + Logger.INFO("Late Recipes Loaded: "+recipesSuccess+" Failed: "+recipesFailed); } } diff --git a/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java b/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java index e887607827..9eb6d1171c 100644 --- a/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java +++ b/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java @@ -1,8 +1,8 @@ package gtPlusPlus.core.handler.Recipes; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.handler.COMPAT_HANDLER; import gtPlusPlus.core.recipe.*; -import gtPlusPlus.core.util.Utils; public class RegistrationHandler { @@ -21,7 +21,7 @@ public class RegistrationHandler { RECIPE_Batteries.RECIPES_LOAD(); RECIPES_General.RECIPES_LOAD(); //RECIPES_MTWRAPPER.run(); - Utils.LOG_INFO("Loaded: "+recipesSuccess+" Failed: "+recipesFailed); + Logger.INFO("Loaded: "+recipesSuccess+" Failed: "+recipesFailed); COMPAT_HANDLER.areInitItemsLoaded = true; //Utils.LOG_INFO("MT Loaded: "+RECIPES_MTWRAPPER.MT_RECIPES_LOADED+" MT Failed: "+RECIPES_MTWRAPPER.MT_RECIPES_FAILED); } diff --git a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java index 4b5bc96006..cd79cf7fe6 100644 --- a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java @@ -11,10 +11,10 @@ import java.util.Random; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gtPlusPlus.api.analytics.SegmentAnalytics; import gtPlusPlus.api.analytics.SegmentHelper; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import net.minecraft.block.Block; import net.minecraft.init.Blocks; @@ -107,7 +107,7 @@ public class BlockEventHandler { } } else { - Utils.LOG_WARNING("invalid chance"); + Logger.WARNING("invalid chance"); } } @@ -129,15 +129,15 @@ public class BlockEventHandler { } } - Utils.LOG_WARNING("Found Limestone in OreDict."); + Logger.WARNING("Found Limestone in OreDict."); if (!mBlockTypes.isEmpty()) { - Utils.LOG_WARNING("1a | "+event.block.getUnlocalizedName()); + Logger.WARNING("1a | "+event.block.getUnlocalizedName()); for (final Block temp : mBlockTypes){ - Utils.LOG_WARNING("2a - "+temp.getUnlocalizedName()); + Logger.WARNING("2a - "+temp.getUnlocalizedName()); if (event.block == temp) { - Utils.LOG_WARNING("3a - found "+temp.getUnlocalizedName()); + Logger.WARNING("3a - found "+temp.getUnlocalizedName()); if (MathUtils.randInt(1, chanceToDropFluoriteOre) == 1){ - Utils.LOG_WARNING("4a"); + Logger.WARNING("4a"); event.drops.clear(); event.drops.add(fluoriteOre.copy()); } @@ -148,9 +148,9 @@ public class BlockEventHandler { if (event.block.getUnlocalizedName().toLowerCase().contains("limestone")){ - Utils.LOG_WARNING("1c"); + Logger.WARNING("1c"); if (MathUtils.randInt(1, chanceToDropFluoriteOre) == 1){ - Utils.LOG_WARNING("2c"); + Logger.WARNING("2c"); event.drops.clear(); event.drops.add(fluoriteOre.copy()); } @@ -170,7 +170,7 @@ public class BlockEventHandler { } } catch (Throwable r){ - Utils.LOG_INFO("Block Event Handler Failed. Please Report this to Alkalus."); + Logger.INFO("Block Event Handler Failed. Please Report this to Alkalus."); r.printStackTrace(); } } diff --git a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java index 7629c98eb4..09365e3caf 100644 --- a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java @@ -6,6 +6,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; import gtPlusPlus.api.analytics.SegmentAnalytics; import gtPlusPlus.api.analytics.SegmentHelper; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.proxy.ClientProxy; @@ -52,15 +53,15 @@ public class LoginEventHandler { if (CORE.ConfigSwitches.enableUpdateChecker){ if (!Utils.isModUpToDate()){ - Utils.LOG_INFO("[GT++] You're not using the latest recommended version of GT++, consider updating."); + Logger.INFO("[GT++] You're not using the latest recommended version of GT++, consider updating."); if (!CORE.MASTER_VERSION.toLowerCase().equals("offline")) { - Utils.LOG_INFO("Latest version is: "+CORE.MASTER_VERSION); + Logger.INFO("Latest version is: "+CORE.MASTER_VERSION); } - Utils.LOG_INFO("You currently have: "+CORE.VERSION); + Logger.INFO("You currently have: "+CORE.VERSION); ShortTimer(this.localPlayerRef, 20); } else { - Utils.LOG_INFO("You're using the latest recommended version of GT++."); + Logger.INFO("You're using the latest recommended version of GT++."); } } @@ -109,7 +110,7 @@ public class LoginEventHandler { } } catch (final Throwable errr){ - Utils.LOG_INFO("Login Handler encountered an error."); + Logger.INFO("Login Handler encountered an error."); } } diff --git a/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java index dff8d3049e..aa9155d654 100644 --- a/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java @@ -5,7 +5,7 @@ import java.util.UUID; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.metatileentity.*; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.player.PlayerUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines.GregtechMetaSafeBlockBase; import net.minecraft.block.Block; @@ -21,7 +21,7 @@ public class PickaxeBlockBreakEventHandler { final TileEntity entity = event.world.getTileEntity(event.x, event.y, event.z); if (entity != null){ final EntityPlayer playerInternal = event.getPlayer(); - Utils.LOG_WARNING(entity.getClass().getSimpleName()); + Logger.WARNING(entity.getClass().getSimpleName()); if (entity.getClass().getSimpleName().equals("")){ } @@ -32,12 +32,12 @@ public class PickaxeBlockBreakEventHandler { final UUID ownerUUID = ((GregtechMetaSafeBlockBase)X).ownerUUID; final UUID accessorUUID = playerInternal.getUniqueID(); - Utils.LOG_WARNING("Owner UUID: "+ownerUUID); - Utils.LOG_WARNING("Accessor UUID: "+accessorUUID); + Logger.WARNING("Owner UUID: "+ownerUUID); + Logger.WARNING("Accessor UUID: "+accessorUUID); if (((GregtechMetaSafeBlockBase)X).bUnbreakable){ - Utils.LOG_INFO("UUID info. Accessor: "+accessorUUID + " | Owner: "+ownerUUID); + Logger.INFO("UUID info. Accessor: "+accessorUUID + " | Owner: "+ownerUUID); if (accessorUUID == ownerUUID){ PlayerUtils.messagePlayer(playerInternal, "Since you own this block, it has been destroyed."); diff --git a/src/Java/gtPlusPlus/core/handler/events/SneakManager.java b/src/Java/gtPlusPlus/core/handler/events/SneakManager.java index 02072fe32f..c504a46e82 100644 --- a/src/Java/gtPlusPlus/core/handler/events/SneakManager.java +++ b/src/Java/gtPlusPlus/core/handler/events/SneakManager.java @@ -1,6 +1,6 @@ package gtPlusPlus.core.handler.events; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import net.minecraft.client.Minecraft; public class SneakManager { @@ -41,7 +41,7 @@ public class SneakManager { } private static State toggleState(final State state){ - Utils.LOG_INFO("State Toggle"); + Logger.INFO("State Toggle"); if (state == State.ON) { return State.OFF; } diff --git a/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java b/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java index ab11e483ed..39cd7d166d 100644 --- a/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java +++ b/src/Java/gtPlusPlus/core/handler/events/UnbreakableBlockManager.java @@ -2,7 +2,7 @@ package gtPlusPlus.core.handler.events; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.metatileentity.*; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GregtechMetaSafeBlock; import net.minecraft.block.Block; import net.minecraft.tileentity.TileEntity; @@ -24,7 +24,7 @@ public class UnbreakableBlockManager{ this.makeIndestructible(/*aPlayer*/); } else { - Utils.LOG_WARNING("Why do you run twice?"); + Logger.WARNING("Why do you run twice?"); } } @@ -37,18 +37,18 @@ public class UnbreakableBlockManager{ private void makeIndestructible(/*EntityPlayer aPlayer*/){ - Utils.LOG_WARNING("Initializing the code to set this TE to -1 hardness and make it indestructible."); + Logger.WARNING("Initializing the code to set this TE to -1 hardness and make it indestructible."); final int X = mTileEntity.xCoord; //(GregtechMetaSafeBlock) this.mTileEntity.getXCoord(); final int Y = mTileEntity.yCoord; final int Z = mTileEntity.zCoord; - Utils.LOG_WARNING("Grabbing TileEntity @ [x,y,z] |"+X+"|"+Y+"|"+Z+"|"); + Logger.WARNING("Grabbing TileEntity @ [x,y,z] |"+X+"|"+Y+"|"+Z+"|"); try{ final GregtechMetaSafeBlock MetaSafeBlock = ((GregtechMetaSafeBlock) UnbreakableBlockManager.mTileEntity.getMetaTileEntity()); final TileEntity BaseMetaTileEntity = mTileEntity.getTileEntity(X, Y, Z); //MetaSafeBlockBase. final World TE_WORLD = MetaSafeBlock.getBaseMetaTileEntity().getWorld(); - Utils.LOG_WARNING("Checking new State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); + Logger.WARNING("Checking new State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); final TileEntity entity = BaseMetaTileEntity; innerInvincible(MetaSafeBlock, entity, TE_WORLD, /*aPlayer,*/ X, Y, Z); } @@ -61,26 +61,26 @@ public class UnbreakableBlockManager{ private static void innerInvincible(final GregtechMetaSafeBlock MetaSafeBlock, final TileEntity entity, final World TE_WORLD, /*EntityPlayer aPlayer,*/ final int X, final int Y, final int Z){ if (entity != null){ - Utils.LOG_WARNING("Checking new State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); - Utils.LOG_WARNING("Grabbed TE: "+entity.toString()); + Logger.WARNING("Checking new State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); + Logger.WARNING("Grabbed TE: "+entity.toString()); if ((entity instanceof BaseTileEntity) && !(entity instanceof BaseMetaPipeEntity)){ final IMetaTileEntity I = ((BaseMetaTileEntity)entity).getMetaTileEntity(); - Utils.LOG_WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); - Utils.LOG_WARNING("I Details: "+I.getMetaName()+" | "+I.getTileEntityBaseType()+" | "+I.toString()); + Logger.WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); + Logger.WARNING("I Details: "+I.getMetaName()+" | "+I.getTileEntityBaseType()+" | "+I.toString()); if (I instanceof GregtechMetaSafeBlock){ - Utils.LOG_WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); + Logger.WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); final Block ThisBlock = I.getBaseMetaTileEntity().getBlock(X, Y, Z); - Utils.LOG_WARNING("Block Details: "+ThisBlock.toString()); + Logger.WARNING("Block Details: "+ThisBlock.toString()); if (((GregtechMetaSafeBlock)I).bUnbreakable){ @@ -88,11 +88,11 @@ public class UnbreakableBlockManager{ //ThisBlock.setResistance(18000000.0F); ThisBlock.setResistance(-1); ThisBlock.setBlockUnbreakable(); - Utils.LOG_WARNING("Changing State of Flag. Old Value="+MetaSafeBlock.bUnbreakable+" Expected Value=true"); + Logger.WARNING("Changing State of Flag. Old Value="+MetaSafeBlock.bUnbreakable+" Expected Value=true"); MetaSafeBlock.bUnbreakable = true; //entity.markDirty(); - Utils.LOG_WARNING("Checking new State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); - Utils.LOG_ERROR("New Indestructible Flag enabled."); + Logger.WARNING("Checking new State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); + Logger.ERROR("New Indestructible Flag enabled."); //GT_Utility.sendChatToPlayer(aPlayer, "Block is now unbreakable."); } @@ -102,32 +102,32 @@ public class UnbreakableBlockManager{ else { ThisBlock.setHardness(1); ThisBlock.setResistance(1.0F); - Utils.LOG_WARNING("Changing State of Flag. Old Value="+MetaSafeBlock.bUnbreakable+" Expected Value=false"); + Logger.WARNING("Changing State of Flag. Old Value="+MetaSafeBlock.bUnbreakable+" Expected Value=false"); MetaSafeBlock.bUnbreakable = false; //entity.markDirty(); - Utils.LOG_WARNING("Checking new State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); - Utils.LOG_ERROR("New Indestructible Flag disabled."); + Logger.WARNING("Checking new State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); + Logger.ERROR("New Indestructible Flag disabled."); //GT_Utility.sendChatToPlayer(aPlayer, "Block is now breakable."); } //entity.markDirty(); - Utils.LOG_WARNING("Block Hardness: "+ThisBlock.getBlockHardness(TE_WORLD, X, Y, Z)); - Utils.LOG_WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); + Logger.WARNING("Block Hardness: "+ThisBlock.getBlockHardness(TE_WORLD, X, Y, Z)); + Logger.WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); hasRun = false; } else { - Utils.LOG_WARNING("I is not an instanceof MetaSafeBlockBase"); - Utils.LOG_WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); + Logger.WARNING("I is not an instanceof MetaSafeBlockBase"); + Logger.WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); } } else { - Utils.LOG_WARNING("TE is not an instanceof BaseTileEntity or may be a pipe."); - Utils.LOG_WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); + Logger.WARNING("TE is not an instanceof BaseTileEntity or may be a pipe."); + Logger.WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); } }else { - Utils.LOG_WARNING("Did not grab a TE instance to make a block instance from."); - Utils.LOG_WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); + Logger.WARNING("Did not grab a TE instance to make a block instance from."); + Logger.WARNING("Checking State of Flag[nUnbreakable]. Value="+MetaSafeBlock.bUnbreakable); } } diff --git a/src/Java/gtPlusPlus/core/handler/events/ZombieBackupSpawnEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/ZombieBackupSpawnEventHandler.java index d40ed64f4d..877b0c6ced 100644 --- a/src/Java/gtPlusPlus/core/handler/events/ZombieBackupSpawnEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/ZombieBackupSpawnEventHandler.java @@ -8,7 +8,7 @@ import cpw.mods.fml.common.eventhandler.Event.Result; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gtPlusPlus.api.analytics.SegmentHelper; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import net.minecraftforge.event.entity.living.ZombieEvent; public class ZombieBackupSpawnEventHandler { @@ -32,7 +32,7 @@ public class ZombieBackupSpawnEventHandler { if (event.attacker != null){ SegmentHelper.getInstance().trackUser(event.attacker.getUniqueID().toString(), "Zombie Backup"); } - Utils.LOG_WARNING("[Zombie] ZombieEvent.SummonAidEvent."); + Logger.WARNING("[Zombie] ZombieEvent.SummonAidEvent."); event.setResult(Result.DENY); } catch(Throwable t){} @@ -41,9 +41,9 @@ public class ZombieBackupSpawnEventHandler { @SubscribeEvent(priority = EventPriority.HIGHEST) public void onZombieReinforcement(final ZombieEvent event) { try { - Utils.LOG_WARNING("[Zombie] ZombieEvent."); + Logger.WARNING("[Zombie] ZombieEvent."); if (event.entity != null){ - Utils.LOG_WARNING("Event Entity: "+event.entity.getCommandSenderName()); + Logger.WARNING("Event Entity: "+event.entity.getCommandSenderName()); } event.setResult(Result.DENY); } diff --git a/src/Java/gtPlusPlus/core/handler/workbench/Workbench_CraftingHandler.java b/src/Java/gtPlusPlus/core/handler/workbench/Workbench_CraftingHandler.java index 951f69723c..1401cb04cc 100644 --- a/src/Java/gtPlusPlus/core/handler/workbench/Workbench_CraftingHandler.java +++ b/src/Java/gtPlusPlus/core/handler/workbench/Workbench_CraftingHandler.java @@ -97,7 +97,7 @@ public class Workbench_CraftingHandler { if (hashmap.containsKey(Character.valueOf(c))) { - aitemstack[i1] = ((ItemStack)hashmap.get(Character.valueOf(c))).copy(); + aitemstack[i1] = hashmap.get(Character.valueOf(c)).copy(); } else { @@ -185,7 +185,7 @@ public class Workbench_CraftingHandler { for (int k = 0; k < this.recipes.size(); k++) { - final IRecipe irecipe = (IRecipe)this.recipes.get(k); + final IRecipe irecipe = this.recipes.get(k); if (irecipe.matches(par1InventoryCrafting, par2World)) { diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java index acec3f35ea..702a2c8670 100644 --- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java +++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java @@ -1,6 +1,6 @@ package gtPlusPlus.core.inventories; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCraftResult; @@ -190,25 +190,25 @@ public class InventoryWorkbenchHoloSlots implements IInventory{ public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_) { if (this.getStackInSlot(0) != null){ - Utils.LOG_INFO("getStackInSlot(0) contains "+this.getStackInSlot(0).getDisplayName()); + Logger.INFO("getStackInSlot(0) contains "+this.getStackInSlot(0).getDisplayName()); if (this.stackResult[0] == null){ - Utils.LOG_INFO("this.stackResult[0] == null"); + Logger.INFO("this.stackResult[0] == null"); this.stackResult[0] = this.getStackInSlot(0); } else if (this.stackResult[0] != null){ - Utils.LOG_INFO("this.stackResult[0] != null"); + Logger.INFO("this.stackResult[0] != null"); if (this.stackResult[0].getDisplayName().toLowerCase().equals(this.getStackInSlot(0).getDisplayName().toLowerCase())){ - Utils.LOG_INFO("Items are the same?"); + Logger.INFO("Items are the same?"); } else { - Utils.LOG_INFO("Items are not the same."); + Logger.INFO("Items are not the same."); } } } if (this.stackResult[0] != null) { - Utils.LOG_INFO("this.stackResult[0] != null - Really never should be though. - Returning "+this.stackResult[0].getDisplayName()); + Logger.INFO("this.stackResult[0] != null - Really never should be though. - Returning "+this.stackResult[0].getDisplayName()); final ItemStack itemstack = this.stackResult[0]; this.stackResult[0] = null; return itemstack; diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 387315a885..b9b204cc3b 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -6,6 +6,7 @@ import static gtPlusPlus.core.lib.CORE.LOAD_ALL_CONTENT; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.Materials; import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.common.compat.COMPAT_Baubles; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.item.base.BaseEuItem; @@ -502,7 +503,7 @@ public final class ModItems { } catch (final Throwable r){ - Utils.LOG_INFO("Failed to Generated a Material. "+r.getMessage()); + Logger.INFO("Failed to Generated a Material. "+r.getMessage()); //Utils.LOG_INFO("Failed to Generated a Material. "+r.getCause().getMessage()); //Utils.LOG_INFO("Failed to Generated a Material. "+r.getStackTrace()[0].getMethodName()); //Utils.LOG_INFO("Failed to Generated a Material. "+r.getStackTrace()[1].getMethodName()); @@ -692,7 +693,7 @@ public final class ModItems { //EnderIO Resources if ((LoadedMods.EnderIO || LOAD_ALL_CONTENT)){ - Utils.LOG_INFO("EnderIO Found - Loading Resources."); + Logger.INFO("EnderIO Found - Loading Resources."); //Enderio Dusts itemDustSoularium = ItemUtils.generateSpecialUseDusts("Soularium", "Soularium", MaterialEIO.SOULARIUM.vChemicalFormula, MaterialEIO.SOULARIUM.getRgbAsHex())[0]; itemDustRedstoneAlloy = ItemUtils.generateSpecialUseDusts("RedstoneAlloy", "Redstone Alloy", MaterialEIO.REDSTONE_ALLOY.vChemicalFormula, MaterialEIO.REDSTONE_ALLOY.getRgbAsHex())[0]; @@ -718,24 +719,24 @@ public final class ModItems { GT_OreDictUnificator.registerOre("platePhasedIron", ItemUtils.getSimpleStack(itemPlatePulsatingIron)); } else { - Utils.LOG_WARNING("EnderIO not Found - Skipping Resources."); + Logger.WARNING("EnderIO not Found - Skipping Resources."); } //Big Reactors if (LoadedMods.Big_Reactors|| LOAD_ALL_CONTENT){ - Utils.LOG_INFO("BigReactors Found - Loading Resources."); + Logger.INFO("BigReactors Found - Loading Resources."); //Item Init itemPlateBlutonium = ItemUtils.generateSpecialUsePlate("Blutonium", "Blutonium", new short[]{0, 0, 255}, 0); itemPlateBlutonium = ItemUtils.generateSpecialUsePlate("Cyanite", "Cyanite", new short[]{0, 191, 255}, 0); itemPlateLudicrite = ItemUtils.generateSpecialUsePlate("Ludicrite", "Ludicrite", new short[]{167, 5, 179}, 0); } else { - Utils.LOG_WARNING("BigReactors not Found - Skipping Resources."); + Logger.WARNING("BigReactors not Found - Skipping Resources."); } //Thaumcraft if ((LoadedMods.Thaumcraft|| LOAD_ALL_CONTENT) && !CORE.GTNH){ - Utils.LOG_INFO("Thaumcraft Found - Loading Resources."); + Logger.INFO("Thaumcraft Found - Loading Resources."); //Item Init try { ItemUtils.getItemForOreDict("Thaumcraft:ItemResource", "ingotVoidMetal", "Void Metal Ingot", 16); @@ -747,44 +748,44 @@ public final class ModItems { } else { - Utils.LOG_WARNING("Thaumcraft not Found - Skipping Resources."); + Logger.WARNING("Thaumcraft not Found - Skipping Resources."); } //Pneumaticraft if (LoadedMods.PneumaticCraft|| LOAD_ALL_CONTENT){ - Utils.LOG_INFO("PneumaticCraft Found - Loading Resources."); + Logger.INFO("PneumaticCraft Found - Loading Resources."); //Item Init itemPlateCompressedIron = ItemUtils.generateSpecialUsePlate("CompressedIron", "Compressed Iron", new short[]{128, 128, 128}, 0); } else { - Utils.LOG_WARNING("PneumaticCraft not Found - Skipping Resources."); + Logger.WARNING("PneumaticCraft not Found - Skipping Resources."); } //Simply Jetpacks if (LoadedMods.Simply_Jetpacks|| LOAD_ALL_CONTENT){ - Utils.LOG_INFO("SimplyJetpacks Found - Loading Resources."); + Logger.INFO("SimplyJetpacks Found - Loading Resources."); //Item Init itemPlateEnrichedSoularium = new RarityUncommon().setUnlocalizedName("itemPlateEnrichedSoularium").setCreativeTab(AddToCreativeTab.tabMisc).setTextureName(CORE.MODID + ":itemPlateSoularium"); //Registry GameRegistry.registerItem(itemPlateEnrichedSoularium, "itemPlateEnrichedSoularium"); } else { - Utils.LOG_WARNING("SimplyJetpacks not Found - Skipping Resources."); + Logger.WARNING("SimplyJetpacks not Found - Skipping Resources."); } //rfTools if (LoadedMods.RFTools|| LOAD_ALL_CONTENT){ - Utils.LOG_INFO("rfTools Found - Loading Resources."); + Logger.INFO("rfTools Found - Loading Resources."); //Item Init itemPlateDimensionShard = ItemUtils.generateSpecialUsePlate("DimensionShard", "Dimensional Shard", new short[]{170, 230, 230}, 0); } else { - Utils.LOG_WARNING("rfTools not Found - Skipping Resources."); + Logger.WARNING("rfTools not Found - Skipping Resources."); } //IC2 Exp if (LoadedMods.IndustrialCraft2|| LOAD_ALL_CONTENT){ - Utils.LOG_INFO("IndustrialCraft2 Found - Loading Resources."); + Logger.INFO("IndustrialCraft2 Found - Loading Resources."); RfEuBattery = new RF2EU_Battery(); //Baubles Mod Test @@ -794,14 +795,14 @@ public final class ModItems { COMPAT_Baubles.run(); } else { - Utils.LOG_INFO("Baubles Not Found - Skipping Resources."); + Logger.INFO("Baubles Not Found - Skipping Resources."); } } catch(final Throwable T){ - Utils.LOG_INFO("Baubles Not Found - Skipping Resources."); + Logger.INFO("Baubles Not Found - Skipping Resources."); } } else { - Utils.LOG_WARNING("IndustrialCraft2 not Found - Skipping Resources."); + Logger.WARNING("IndustrialCraft2 not Found - Skipping Resources."); } diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemDamageable.java b/src/Java/gtPlusPlus/core/item/base/BaseItemDamageable.java index c85eea4bed..8ae28fc343 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemDamageable.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemDamageable.java @@ -5,8 +5,8 @@ import java.util.List; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; @@ -159,7 +159,7 @@ public class BaseItemDamageable extends Item { @Override public boolean doesContainerItemLeaveCraftingGrid(ItemStack stack) { - Utils.LOG_INFO("Does Leave Table? "+stack.getDisplayName()); + Logger.INFO("Does Leave Table? "+stack.getDisplayName()); return true; } @@ -175,7 +175,7 @@ public class BaseItemDamageable extends Item { @Override public boolean hasContainerItem(ItemStack stack) { - Utils.LOG_INFO("hasContainerItem? "+stack.getDisplayName()); + Logger.INFO("hasContainerItem? "+stack.getDisplayName()); return true; } diff --git a/src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java b/src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java index 4bff33493e..04bb1d59d8 100644 --- a/src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java +++ b/src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java @@ -5,8 +5,8 @@ import java.util.List; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.util.Utils; import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; import net.minecraft.client.renderer.texture.IIconRegister; @@ -44,7 +44,7 @@ public class BasicSpawnEgg extends ItemMonsterPlacer this.entityMODID = MODID; // DEBUG - Utils.LOG_WARNING("Spawn egg constructor for "+this.entityToSpawnName); + Logger.WARNING("Spawn egg constructor for "+this.entityToSpawnName); } /** @@ -174,7 +174,7 @@ public class BasicSpawnEgg extends ItemMonsterPlacer else { //DEBUG - Utils.LOG_WARNING("Entity not found "+this.entityToSpawnName); + Logger.WARNING("Entity not found "+this.entityToSpawnName); } } diff --git a/src/Java/gtPlusPlus/core/item/base/CoreItem.java b/src/Java/gtPlusPlus/core/item/base/CoreItem.java index 951d2050f5..8baf909af7 100644 --- a/src/Java/gtPlusPlus/core/item/base/CoreItem.java +++ b/src/Java/gtPlusPlus/core/item/base/CoreItem.java @@ -5,8 +5,8 @@ import java.util.List; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -175,7 +175,7 @@ public class CoreItem extends Item if (this.turnsInto != null){ if (entityHolding instanceof EntityPlayer){ - Utils.LOG_INFO("Replacing "+iStack.getDisplayName()+" with "+this.turnsInto.getDisplayName()+"."); + Logger.INFO("Replacing "+iStack.getDisplayName()+" with "+this.turnsInto.getDisplayName()+"."); final ItemStack tempTransform = this.turnsInto; if (iStack.stackSize == 64){ tempTransform.stackSize=64; diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java index 6aa1f54cc8..e75d2a69e8 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java @@ -8,9 +8,9 @@ import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.entity.EntityUtils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; @@ -48,25 +48,25 @@ public class BaseItemDust extends Item{ GameRegistry.registerItem(this, unlocalizedName); String temp = ""; - Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); + Logger.WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); if (this.getUnlocalizedName().contains("item.")){ temp = this.getUnlocalizedName().replace("item.", ""); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + Logger.WARNING("Generating OreDict Name: "+temp); } else { temp = this.getUnlocalizedName(); } if (temp.contains("DustTiny")){ temp = temp.replace("itemD", "d"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + Logger.WARNING("Generating OreDict Name: "+temp); } else if (temp.contains("DustSmall")){ temp = temp.replace("itemD", "d"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + Logger.WARNING("Generating OreDict Name: "+temp); } else { temp = temp.replace("itemD", "d"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + Logger.WARNING("Generating OreDict Name: "+temp); } if ((temp != null) && !temp.equals("")){ GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); @@ -157,7 +157,7 @@ public class BaseItemDust extends Item{ } private void addMacerationRecipe(){ - Utils.LOG_WARNING("Adding recipe for "+this.materialName+" Dusts"); + Logger.WARNING("Adding recipe for "+this.materialName+" Dusts"); String tempIngot = this.getUnlocalizedName().replace("item.itemDust", "ingot"); final String tempDust = this.getUnlocalizedName().replace("item.itemDust", "dust"); @@ -168,17 +168,17 @@ public class BaseItemDust extends Item{ return; } - Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); + Logger.WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); if (this.getUnlocalizedName().contains("item.")){ tempIngot = this.getUnlocalizedName().replace("item.", ""); - Utils.LOG_WARNING("Generating OreDict Name: "+tempIngot); + Logger.WARNING("Generating OreDict Name: "+tempIngot); } else { tempIngot = this.getUnlocalizedName(); } tempIngot = tempIngot.replace("itemDust", "ingot"); - Utils.LOG_WARNING("Generating OreDict Name: "+tempIngot); + Logger.WARNING("Generating OreDict Name: "+tempIngot); final ItemStack[] outputStacks = {this.dustInfo.getDust(1)}; if ((tempIngot != null) && !tempIngot.equals("")){ tempInputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempIngot, 1); @@ -224,30 +224,30 @@ public class BaseItemDust extends Item{ if ((temp != null) && !temp.equals("")){ if (this.dustInfo.requiresBlastFurnace()){ - Utils.LOG_WARNING("Adding recipe for Hot "+this.materialName+" Ingots in a Blast furnace."); + Logger.WARNING("Adding recipe for Hot "+this.materialName+" Ingots in a Blast furnace."); final String tempIngot = temp.replace("ingot", "ingotHot"); final ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempIngot, 1); if (null != tempOutputStack){ - Utils.LOG_WARNING("This will produce "+tempOutputStack.getDisplayName() + " Debug: "+tempIngot); + Logger.WARNING("This will produce "+tempOutputStack.getDisplayName() + " Debug: "+tempIngot); this.addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, 350*this.mTier); } return; } - Utils.LOG_WARNING("Adding recipe for "+this.materialName+" Ingots in a furnace."); + Logger.WARNING("Adding recipe for "+this.materialName+" Ingots in a furnace."); final ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); //Utils.LOG_WARNING("This will produce an ingot of "+tempOutputStack.getDisplayName() + " Debug: "+temp); if (null != tempOutputStack){ if ((this.mTier < 5) || !this.dustInfo.requiresBlastFurnace()){ if (CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(ItemUtils.getSimpleStack(this), tempOutputStack)){ - Utils.LOG_WARNING("Successfully added a furnace recipe for "+this.materialName); + Logger.WARNING("Successfully added a furnace recipe for "+this.materialName); } else { - Utils.LOG_WARNING("Failed to add a furnace recipe for "+this.materialName); + Logger.WARNING("Failed to add a furnace recipe for "+this.materialName); } } else if ((this.mTier >= 5) || this.dustInfo.requiresBlastFurnace()){ - Utils.LOG_WARNING("Adding recipe for "+this.materialName+" Ingots in a Blast furnace."); - Utils.LOG_WARNING("This will produce "+tempOutputStack.getDisplayName()); + Logger.WARNING("Adding recipe for "+this.materialName+" Ingots in a Blast furnace."); + Logger.WARNING("This will produce "+tempOutputStack.getDisplayName()); if (null != tempOutputStack){ this.addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, 350*this.mTier); } diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java index f19aaff4b3..2c32c0c8af 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java @@ -6,9 +6,9 @@ import java.util.List; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.StringUtils; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import net.minecraft.entity.player.EntityPlayer; @@ -54,25 +54,25 @@ public class BaseItemDustUnique extends Item{ } String temp = ""; - Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); + Logger.WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); if (this.getUnlocalizedName().contains("item.")){ temp = this.getUnlocalizedName().replace("item.", ""); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + Logger.WARNING("Generating OreDict Name: "+temp); } else { temp = this.getUnlocalizedName(); } if (temp.contains("DustTiny")){ temp = temp.replace("itemD", "d"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + Logger.WARNING("Generating OreDict Name: "+temp); } else if (temp.contains("DustSmall")){ temp = temp.replace("itemD", "d"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + Logger.WARNING("Generating OreDict Name: "+temp); } else { temp = temp.replace("itemD", "d"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + Logger.WARNING("Generating OreDict Name: "+temp); } if ((temp != null) && !temp.equals("")){ GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); diff --git a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java index 0467d2647e..5f737b47a0 100644 --- a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java +++ b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java @@ -2,6 +2,7 @@ package gtPlusPlus.core.item.base.foods; import java.util.List; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; @@ -40,7 +41,7 @@ public class BaseItemHotFood extends BaseItemFood{ if (!world.isRemote){ if(iStack.getItemDamage() == this.cooldownTime) { if (entityHolding instanceof EntityPlayer){ - Utils.LOG_INFO("Foods Done."); + Logger.INFO("Foods Done."); ((EntityPlayer) entityHolding).inventory.addItemStackToInventory(ItemUtils.getSimpleStack(this.output)); ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this); } diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java index 0933790de1..26b3ff2ce7 100644 --- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java +++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java @@ -1,9 +1,9 @@ package gtPlusPlus.core.item.base.ingots; import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; @@ -28,13 +28,13 @@ public class BaseItemIngot extends BaseItemComponent{ final ItemStack tempStack = ItemUtils.getSimpleStack(this, 9); ItemStack tempOutput = null; String temp = this.getUnlocalizedName().replace("item.itemIngot", "block"); - Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); + Logger.WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); if (this.getUnlocalizedName().contains("item.")){ temp = this.getUnlocalizedName().replace("item.", ""); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + Logger.WARNING("Generating OreDict Name: "+temp); } temp = temp.replace("itemIngot", "block"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + Logger.WARNING("Generating OreDict Name: "+temp); if ((temp != null) && !temp.equals("")){ tempOutput = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); if (tempOutput != null){ diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java index b6f139b74a..329fae509a 100644 --- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java +++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java @@ -3,6 +3,7 @@ package gtPlusPlus.core.item.base.ingots; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.GT_Values; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; @@ -44,7 +45,7 @@ public class BaseItemIngotHot extends BaseItemIngot{ } private void generateRecipe(){ - Utils.LOG_WARNING("Adding Vacuum Freezer recipe for a Hot Ingot of "+this.materialName+"."); + Logger.WARNING("Adding Vacuum Freezer recipe for a Hot Ingot of "+this.materialName+"."); GT_Values.RA.addVacuumFreezerRecipe(ItemUtils.getSimpleStack(this), this.outputIngot.copy(), 60*this.mTier); } diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot_OLD.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot_OLD.java index e821258d8e..8534172bbb 100644 --- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot_OLD.java +++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot_OLD.java @@ -3,9 +3,9 @@ package gtPlusPlus.core.item.base.ingots; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.entity.EntityUtils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; @@ -67,13 +67,13 @@ public class BaseItemIngot_OLD extends Item{ final ItemStack tempStack = ItemUtils.getSimpleStack(this, 9); ItemStack tempOutput = null; String temp = this.getUnlocalizedName().replace("item.itemIngot", "block"); - Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); + Logger.WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); if (this.getUnlocalizedName().contains("item.")){ temp = this.getUnlocalizedName().replace("item.", ""); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + Logger.WARNING("Generating OreDict Name: "+temp); } temp = temp.replace("itemIngot", "block"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + Logger.WARNING("Generating OreDict Name: "+temp); if ((temp != null) && !temp.equals("")){ tempOutput = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); if (tempOutput != null){ diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java index 44ec66c47b..4ac7c7f5ff 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java @@ -1,8 +1,8 @@ package gtPlusPlus.core.item.base.itemblock; import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.tileentities.base.TileEntityBase; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.player.PlayerUtils; import net.minecraft.block.Block; import net.minecraft.entity.Entity; @@ -73,7 +73,7 @@ public class ItemBlockNBT extends ItemBlock { TileEntityBase tTileEntity = (TileEntityBase) aWorld.getTileEntity(aX, aY, aZ); if (tTileEntity != null && aPlayer != null) { if (tTileEntity.isServerSide()){ - Utils.LOG_INFO("Setting Tile Entity information"); + Logger.INFO("Setting Tile Entity information"); NBTTagCompound aNBT = GT_Utility.ItemNBT.getNBT(aStack); tTileEntity.setOwnerInformation(aNBT.getString("mOwner"), aNBT.getString("mUUID"), aNBT.getBoolean("mOP")); } diff --git a/src/Java/gtPlusPlus/core/item/base/misc/BaseItemMisc.java b/src/Java/gtPlusPlus/core/item/base/misc/BaseItemMisc.java index 27059e8fde..96dd2c5a16 100644 --- a/src/Java/gtPlusPlus/core/item/base/misc/BaseItemMisc.java +++ b/src/Java/gtPlusPlus/core/item/base/misc/BaseItemMisc.java @@ -9,11 +9,8 @@ import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.entity.EntityUtils; import gtPlusPlus.core.util.item.ItemUtils; -import gtPlusPlus.core.util.math.MathUtils; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -80,6 +77,7 @@ public class BaseItemMisc extends Item{ @SideOnly(Side.CLIENT) private IIcon secondIcon; + @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister par1IconRegister) { if (this.miscType == MiscTypes.DROP && LoadedMods.Forestry){ diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseItemCrushedOre.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseItemCrushedOre.java new file mode 100644 index 0000000000..f2ca40334f --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/ore/BaseItemCrushedOre.java @@ -0,0 +1,10 @@ +package gtPlusPlus.core.item.base.ore; + +import gtPlusPlus.core.material.Material; + +public class BaseItemCrushedOre extends BaseOreComponent{ + + public BaseItemCrushedOre(final Material material) { + super(material, BaseOreComponent.ComponentTypes.CRUSHED); + } +} diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java new file mode 100644 index 0000000000..d06f1c912a --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java @@ -0,0 +1,153 @@ +package gtPlusPlus.core.item.base.ore; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.state.MaterialState; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.entity.EntityUtils; +import gtPlusPlus.core.util.item.ItemUtils; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class BaseOreComponent extends Item{ + + public final Material componentMaterial; + public final String materialName; + public final String unlocalName; + public final ComponentTypes componentType; + public final int componentColour; + public Object extraData; + + public BaseOreComponent(final Material material, final ComponentTypes componentType) { + this.componentMaterial = material; + this.unlocalName = "item"+componentType.COMPONENT_NAME+material.getUnlocalizedName(); + this.materialName = material.getLocalizedName(); + this.componentType = componentType; + this.setCreativeTab(AddToCreativeTab.tabMisc); + this.setUnlocalizedName(this.unlocalName); + this.setMaxStackSize(64); + this.setTextureName(this.getCorrectTextures()); + this.componentColour = material.getRgbAsHex(); + GameRegistry.registerItem(this, this.unlocalName); + GT_OreDictUnificator.registerOre(componentType.getOreDictName()+material.getUnlocalizedName(), ItemUtils.getSimpleStack(this)); + } + + public String getCorrectTextures(){ + if (!CORE.ConfigSwitches.useGregtechTextures){ + return CORE.MODID + ":" + "item"+this.componentType.COMPONENT_NAME; + } + + /*if (this.componentType == ComponentTypes.GEAR){ + return "gregtech" + ":" + "materialicons/METALLIC/" + "gearGt"; + } + else if (this.componentType == ComponentTypes.SMALLGEAR){ + return "gregtech" + ":" + "materialicons/METALLIC/" + "gearGtSmall"; + }*/ + + return "gregtech" + ":" + "materialicons/METALLIC/" + this.componentType.COMPONENT_NAME.toLowerCase(); + } + + @Override + public String getItemStackDisplayName(final ItemStack p_77653_1_) { + if (this.componentMaterial != null) { + return (this.componentMaterial.getLocalizedName()+this.componentType.DISPLAY_NAME); + } + return this.materialName+" Cell"; + } + + public final String getMaterialName() { + return this.materialName; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public final void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + + if ((this.materialName != null) && (this.materialName != "") && !this.materialName.equals("") && (this.componentMaterial != null)){ + + if (this.componentMaterial != null){ + if (!this.componentMaterial.vChemicalFormula.equals("??") && !this.componentMaterial.vChemicalFormula.equals("?") && this.componentMaterial.getState() != MaterialState.PURE_LIQUID) { + list.add(Utils.sanitizeStringKeepBrackets(this.componentMaterial.vChemicalFormula)); + } + + if (this.componentMaterial.isRadioactive){ + list.add(CORE.GT_Tooltip_Radioactive); + } + } + + } + + super.addInformation(stack, aPlayer, list, bool); + } + + + @Override + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + return this.componentColour; + } + + @Override + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { + if (this.componentMaterial != null){ + if (entityHolding instanceof EntityPlayer){ + if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){ + EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.componentMaterial.vRadiationLevel, world, entityHolding); + } + } + } + } + + + + + + + + + + public static enum ComponentTypes { + DUST("Dust", " Dust", "dust"), + DUSTDIRTY("Ingot", " Ingot", "ingot"), + DUSTIMPURE("Ingot", " Ingot", "ingot"), + DUSTPURE("Ingot", " Ingot", "ingot"), + DUSTREFINED("Ingot", " Ingot", "ingot"), + CRUSHED("Ingot", " Ingot", "ingot"), + CRUSHEDCENTRIFUGED("Ingot", " Ingot", "ingot"), + CRUSHEDPURIFIED("Ingot", " Ingot", "ingot"); + + private String COMPONENT_NAME; + private String DISPLAY_NAME; + private String OREDICT_NAME; + private ComponentTypes (final String LocalName, final String DisplayName, final String OreDictName){ + this.COMPONENT_NAME = LocalName; + this.DISPLAY_NAME = DisplayName; + this.OREDICT_NAME = OreDictName; + // dust + Dirty, Impure, Pure, Refined + // crushed + centrifuged, purified + } + + public String getComponent(){ + return this.COMPONENT_NAME; + } + + public String getName(){ + return this.DISPLAY_NAME; + } + + public String getOreDictName(){ + return this.OREDICT_NAME; + } + + } + +} + + diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java index 5fe7ca6424..0259a6c6f3 100644 --- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java +++ b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java @@ -1,9 +1,9 @@ package gtPlusPlus.core.item.base.rods; import gregtech.api.enums.GT_Values; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; import net.minecraft.item.ItemStack; public class BaseItemRod extends BaseItemComponent{ @@ -15,7 +15,7 @@ public class BaseItemRod extends BaseItemComponent{ private void addExtruderRecipe(){ - Utils.LOG_WARNING("Adding cutter recipe for "+this.materialName+" Rods"); + Logger.WARNING("Adding cutter recipe for "+this.materialName+" Rods"); final ItemStack stackStick = this.componentMaterial.getRod(1); final ItemStack stackBolt = this.componentMaterial.getBolt(4); diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java index 84d7d00472..1ac307d68c 100644 --- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java +++ b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java @@ -1,9 +1,9 @@ package gtPlusPlus.core.item.base.rods; import gregtech.api.enums.GT_Values; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; @@ -20,7 +20,7 @@ public class BaseItemRodLong extends BaseItemComponent{ } private void addExtruderRecipe(){ - Utils.LOG_WARNING("Adding recipe for Long "+this.materialName+" Rods"); + Logger.WARNING("Adding recipe for Long "+this.materialName+" Rods"); final String tempStick = this.unlocalName.replace("itemRodLong", "stick"); final String tempStickLong = this.unlocalName.replace("itemRodLong", "stickLong"); diff --git a/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java b/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java index f35e4834cc..733a8aa9d7 100644 --- a/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java +++ b/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java @@ -1,9 +1,9 @@ package gtPlusPlus.core.item.base.screws; import gregtech.api.enums.GT_Values; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; @@ -15,7 +15,7 @@ public class BaseItemScrew extends BaseItemComponent{ } private void addLatheRecipe(){ - Utils.LOG_WARNING("Adding recipe for "+this.materialName+" Screws"); + Logger.WARNING("Adding recipe for "+this.materialName+" Screws"); final ItemStack boltStack = ItemUtils.getItemStackOfAmountFromOreDict(this.unlocalName.replace("itemScrew", "bolt"), 1); if (null != boltStack){ GT_Values.RA.addLatheRecipe( diff --git a/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java b/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java index cebfa7050d..b7c2b6ae89 100644 --- a/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java +++ b/src/Java/gtPlusPlus/core/item/bauble/ModularBauble.java @@ -23,9 +23,7 @@ import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.DamageSource; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; +import net.minecraft.util.*; public class ModularBauble extends BaseBauble { @@ -86,7 +84,7 @@ public class ModularBauble extends BaseBauble { } if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HP)) > 0) { if (mStatlevel > 0 && mStatlevel <= 100) { - int bonus = (int) (mStatlevel / 5); + int bonus = mStatlevel / 5; attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "HP" + mStatlevel, bonus * 2, 0)); } @@ -142,7 +140,7 @@ public class ModularBauble extends BaseBauble { } if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HP)) > 0) { list.add(EnumChatFormatting.GRAY + "Health Boost: " + EnumChatFormatting.RED + mStatlevel - + EnumChatFormatting.GRAY + "/100. Bonus " + ((int) mStatlevel / 5) + " hearts."); + + EnumChatFormatting.GRAY + "/100. Bonus " + (mStatlevel / 5) + " hearts."); } if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_SPEED)) > 0) { list.add(EnumChatFormatting.GRAY + "Speed Boost: " + EnumChatFormatting.WHITE + mStatlevel diff --git a/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java b/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java index c3187ba92c..ea4d8f5a1b 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemAreaClear.java @@ -2,10 +2,10 @@ package gtPlusPlus.core.item.general; import java.util.List; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.item.base.CoreItem; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.array.BlockPos; import gtPlusPlus.core.util.entity.EntityUtils; import gtPlusPlus.core.util.math.MathUtils; @@ -182,7 +182,7 @@ public class ItemAreaClear extends CoreItem { removeBlocks(world, groundBlock); } else { - Utils.LOG_INFO("Filling."); + Logger.INFO("Filling."); fillBlocks(world, groundBlock); } return super.onItemRightClick(thisItem, world, parEntity); diff --git a/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java b/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java index 65aa618cb3..720005f6ae 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java @@ -3,10 +3,10 @@ package gtPlusPlus.core.item.general; import java.util.List; import cpw.mods.fml.common.registry.GameRegistry; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.interfaces.IItemBlueprint; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.player.PlayerUtils; @@ -224,19 +224,19 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ if (itemStack.hasTagCompound()){ if (!itemStack.stackTagCompound.getBoolean("mBlueprint") && !itemStack.stackTagCompound.getString("mName").equals("")){ //No Blueprint and no name Set - Utils.LOG_WARNING("No Blueprint and no name Set"); + Logger.WARNING("No Blueprint and no name Set"); return false; } else if (itemStack.stackTagCompound.getBoolean("mBlueprint") && !itemStack.stackTagCompound.getString("mName").equals("")){ //Has Blueprint but invalid name set - Utils.LOG_WARNING("Has Blueprint but invalid name set"); + Logger.WARNING("Has Blueprint but invalid name set"); //itemStack.stackTagCompound = null; //createNBT(itemStack); return false; } else if (!itemStack.stackTagCompound.getBoolean("mBlueprint") && itemStack.stackTagCompound.getString("mName").equals("")){ //Has no Blueprint, but strangely has a name - Utils.LOG_WARNING("Has no Blueprint, but strangely has a name"); + Logger.WARNING("Has no Blueprint, but strangely has a name"); //itemStack.stackTagCompound = null; //createNBT(itemStack); return false; @@ -247,7 +247,7 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ final int bpID = MathUtils.randInt(0, 1000); final boolean hasRecipe = false; final String recipeName = ""; - Utils.LOG_WARNING("Creating Blueprint, setting up it's NBT data. "+bpID); + Logger.WARNING("Creating Blueprint, setting up it's NBT data. "+bpID); itemStack.stackTagCompound = new NBTTagCompound(); itemStack.stackTagCompound.setInteger("mID", bpID); itemStack.stackTagCompound.setBoolean("mBlueprint", hasRecipe); @@ -258,7 +258,7 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ final int bpID = MathUtils.randInt(0, 1000); final boolean hasRecipe = false; final String recipeName = ""; - Utils.LOG_WARNING("Creating a Blueprint, setting up it's NBT data. "+bpID); + Logger.WARNING("Creating a Blueprint, setting up it's NBT data. "+bpID); itemStack.stackTagCompound = new NBTTagCompound(); itemStack.stackTagCompound.setInteger("mID", bpID); itemStack.stackTagCompound.setBoolean("mBlueprint", hasRecipe); diff --git a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java index 63e0abb238..a3a8a98e6a 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java @@ -6,9 +6,9 @@ import baubles.api.BaubleType; import baubles.api.IBauble; import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.registry.GameRegistry; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.player.PlayerUtils; @@ -215,7 +215,7 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI if (this.getCharge(arg0) >= (1638400/4)){ if (arg1.getHealth() < arg1.getMaxHealth()){ final float rx = arg1.getMaxHealth()-arg1.getHealth(); - Utils.LOG_INFO("rx:"+rx); + Logger.INFO("rx:"+rx); arg1.heal(rx*2); this.discharge(arg0, (1638400/4)*rx, 6, true, true, false); PlayerUtils.messagePlayer((EntityPlayer) arg1, "Your NanoBooster Whirs! Leaving you feeling stronger. It Healed "+rx+" hp."); diff --git a/src/Java/gtPlusPlus/core/item/general/capture/ItemEntityCatcher.java b/src/Java/gtPlusPlus/core/item/general/capture/ItemEntityCatcher.java index e74a3f8851..1b8ab947e5 100644 --- a/src/Java/gtPlusPlus/core/item/general/capture/ItemEntityCatcher.java +++ b/src/Java/gtPlusPlus/core/item/general/capture/ItemEntityCatcher.java @@ -5,16 +5,14 @@ import java.util.UUID; import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.api.interfaces.IEntityCatcher; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.array.BlockPos; import gtPlusPlus.core.util.nbt.NBTUtils; import gtPlusPlus.core.util.player.PlayerUtils; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityList; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.*; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -49,22 +47,22 @@ public class ItemEntityCatcher extends Item implements IEntityCatcher { @Override public Entity getStoredEntity(World aWorld, ItemStack aStack) { if (aStack == null || !hasEntity(aStack)) { - Utils.LOG_INFO("Cannot get stored entity."); + Logger.INFO("Cannot get stored entity."); return null; } Entity mEntityToSpawn; int mEntityID; - Utils.LOG_WARNING("getStoredEntity(1)"); + Logger.WARNING("getStoredEntity(1)"); mEntityID = NBTUtils.getInteger(aStack, "mEntityID"); mEntityToSpawn = EntityList.createEntityByID(mEntityID, aWorld); if (mEntityToSpawn != null) { - Utils.LOG_WARNING("getStoredEntity(2)"); + Logger.WARNING("getStoredEntity(2)"); return mEntityToSpawn; } - Utils.LOG_INFO("Failed to get stored entity. - getStoredEntity()"); + Logger.INFO("Failed to get stored entity. - getStoredEntity()"); return null; } @@ -72,11 +70,11 @@ public class ItemEntityCatcher extends Item implements IEntityCatcher { public boolean setStoredEntity(World aWorld, ItemStack aStack, Entity aEntity) { if (aEntity == null) { NBTUtils.setBoolean(aStack, "mHasEntity", false); - Utils.LOG_INFO("Bad Entity being stored."); + Logger.INFO("Bad Entity being stored."); return false; } - Utils.LOG_WARNING("setStoredEntity(1)"); + Logger.WARNING("setStoredEntity(1)"); NBTTagCompound mEntityData; Class<? extends Entity> mEntityClass; @@ -84,7 +82,7 @@ public class ItemEntityCatcher extends Item implements IEntityCatcher { String mEntityName; int mEntityID, mEntityHashcode; UUID mUuidPersistent, mUuidUnique; - Utils.LOG_WARNING("setStoredEntity(2)"); + Logger.WARNING("setStoredEntity(2)"); mEntityData = aEntity.getEntityData(); mEntityClass = aEntity.getClass(); @@ -95,7 +93,7 @@ public class ItemEntityCatcher extends Item implements IEntityCatcher { mEntityHashcode = aEntity.hashCode(); mUuidPersistent = aEntity.getPersistentID(); mUuidUnique = aEntity.getUniqueID(); - Utils.LOG_WARNING("setStoredEntity(3)"); + Logger.WARNING("setStoredEntity(3)"); NBTUtils.createTagCompound(aStack, "mEntityData", mEntityData); NBTUtils.setString(aStack,"mEntityName", mEntityName); @@ -105,7 +103,7 @@ public class ItemEntityCatcher extends Item implements IEntityCatcher { NBTUtils.setString(aStack,"mUuidUnique", mUuidUnique.toString()); NBTUtils.setInteger(aStack,"mEntityHashcode", mEntityHashcode); NBTUtils.setBoolean(aStack,"mHasEntity", true); - Utils.LOG_WARNING("setStoredEntity(4)"); + Logger.WARNING("setStoredEntity(4)"); return true; } @@ -132,7 +130,7 @@ public class ItemEntityCatcher extends Item implements IEntityCatcher { @Override public boolean spawnStoredEntity(World aWorld, ItemStack aStack, BlockPos aPos) { if (aStack == null || !hasEntity(aStack)) { - Utils.LOG_INFO("Cannot release, either invalid Itemstack or no entity stored."); + Logger.INFO("Cannot release, either invalid Itemstack or no entity stored."); return false; } @@ -147,31 +145,31 @@ public class ItemEntityCatcher extends Item implements IEntityCatcher { EntityLiving mEntityToSpawn = (EntityLiving) getStoredEntity(aWorld, aStack); Class<? extends Entity> mEntityClass = getStoredEntityClass(aStack); - Utils.LOG_WARNING("spawnStoredEntity(1)"); + Logger.WARNING("spawnStoredEntity(1)"); if (mEntityToSpawn != null && mEntityClass != null) { - Utils.LOG_WARNING("spawnStoredEntity(2)"); + Logger.WARNING("spawnStoredEntity(2)"); if (mEntityToSpawn.getEntityData() != mEntityData) { - Utils.LOG_WARNING("spawnStoredEntity(x)"); + Logger.WARNING("spawnStoredEntity(x)"); NBTUtils.setEntityCustomData(mEntityToSpawn, mEntityData); } mEntityToSpawn.setLocationAndAngles(aPos.xPos, aPos.yPos, aPos.zPos, aWorld.rand.nextFloat() * 360.0F, 0.0F); - if (mEntityToSpawn instanceof EntityLiving) { - ((EntityLiving) mEntityToSpawn).onSpawnWithEgg(null); + if (mEntityToSpawn != null) { + mEntityToSpawn.onSpawnWithEgg(null); aWorld.spawnEntityInWorld(mEntityToSpawn); - Utils.LOG_WARNING("spawnStoredEntity(3)"); + Logger.WARNING("spawnStoredEntity(3)"); } - if (mEntityToSpawn instanceof EntityLiving) { - ((EntityLiving) mEntityToSpawn).playLivingSound(); - Utils.LOG_WARNING("spawnStoredEntity(4)"); + if (mEntityToSpawn != null) { + mEntityToSpawn.playLivingSound(); + Logger.WARNING("spawnStoredEntity(4)"); } - Utils.LOG_WARNING("spawnStoredEntity(5)"); + Logger.WARNING("spawnStoredEntity(5)"); NBTUtils.setBoolean(aStack,"mHasEntity", false); return true; } - Utils.LOG_INFO("Failed to spawn stored entity. - spawnStoredEntity()"); + Logger.INFO("Failed to spawn stored entity. - spawnStoredEntity()"); return false; } @@ -202,10 +200,10 @@ public class ItemEntityCatcher extends Item implements IEntityCatcher { public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) { if (Utils.isServer()) { - Utils.LOG_WARNING("Trying to release (1)"); + Logger.WARNING("Trying to release (1)"); if (NBTUtils.hasKey(itemstack,"mHasEntity") && NBTUtils.getBoolean(itemstack,"mHasEntity")) { - Utils.LOG_WARNING("Trying to release (2)"); + Logger.WARNING("Trying to release (2)"); boolean mDidSpawn = spawnStoredEntity(world, itemstack, new BlockPos(x, y+1, z)); if (!mDidSpawn){ @@ -223,12 +221,12 @@ public class ItemEntityCatcher extends Item implements IEntityCatcher { @Override public boolean itemInteractionForEntity(ItemStack aStack, EntityPlayer aPlayer, EntityLivingBase aEntity) { if (Utils.isServer()) { - Utils.LOG_WARNING("Trying to catch (1)"); + Logger.WARNING("Trying to catch (1)"); if (!hasEntity(aStack)) { - Utils.LOG_WARNING("Trying to catch (2)"); + Logger.WARNING("Trying to catch (2)"); boolean mStored = setStoredEntity(aPlayer.worldObj, aStack, aEntity); if (mStored) { - Utils.LOG_WARNING("Trying to catch (3)"); + Logger.WARNING("Trying to catch (3)"); aEntity.setDead(); PlayerUtils.messagePlayer(aPlayer, "You have captured a "+NBTUtils.getString(aStack,"mEntityName")+" in the Jar."); //NBTUtils.tryIterateNBTData(aStack); diff --git a/src/Java/gtPlusPlus/core/item/general/throwables/ItemHydrofluoricAcidPotion.java b/src/Java/gtPlusPlus/core/item/general/throwables/ItemHydrofluoricAcidPotion.java index 1ed49760c0..2a98a0a13f 100644 --- a/src/Java/gtPlusPlus/core/item/general/throwables/ItemHydrofluoricAcidPotion.java +++ b/src/Java/gtPlusPlus/core/item/general/throwables/ItemHydrofluoricAcidPotion.java @@ -15,6 +15,7 @@ public class ItemHydrofluoricAcidPotion extends CoreItem { super(unlocalizedName, displayName, AddToCreativeTab.tabMisc, 16, 0, description, EnumRarity.uncommon, EnumChatFormatting.GRAY, false, null); } + @Override public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { if (!player.capabilities.isCreativeMode) { --item.stackSize; diff --git a/src/Java/gtPlusPlus/core/item/general/throwables/ItemSulfuricAcidPotion.java b/src/Java/gtPlusPlus/core/item/general/throwables/ItemSulfuricAcidPotion.java index 60e3550b5c..dd5db807b6 100644 --- a/src/Java/gtPlusPlus/core/item/general/throwables/ItemSulfuricAcidPotion.java +++ b/src/Java/gtPlusPlus/core/item/general/throwables/ItemSulfuricAcidPotion.java @@ -15,6 +15,7 @@ public class ItemSulfuricAcidPotion extends CoreItem { super(unlocalizedName, displayName, AddToCreativeTab.tabMisc, 16, 0, description, EnumRarity.common, EnumChatFormatting.GRAY, false, null); } + @Override public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) { if (!player.capabilities.isCreativeMode) { --item.stackSize; diff --git a/src/Java/gtPlusPlus/core/item/init/ItemsMultiTools.java b/src/Java/gtPlusPlus/core/item/init/ItemsMultiTools.java index cc73ba3d32..fc7381354a 100644 --- a/src/Java/gtPlusPlus/core/item/init/ItemsMultiTools.java +++ b/src/Java/gtPlusPlus/core/item/init/ItemsMultiTools.java @@ -1,12 +1,12 @@ package gtPlusPlus.core.item.init; import gregtech.api.enums.Materials; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; public class ItemsMultiTools { @@ -64,7 +64,7 @@ public class ItemsMultiTools { } private static boolean toolFactory(final Material m){ - Utils.LOG_WARNING("Generating Multi-Tools for "+m.getLocalizedName()); + Logger.WARNING("Generating Multi-Tools for "+m.getLocalizedName()); ModItems.MP_GTMATERIAL = ItemUtils.generateMultiPick(m); ModItems.MS_GTMATERIAL = ItemUtils.generateMultiShovel(m); return true; diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java index 602b0d75f7..45e0bd8fe6 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java @@ -5,6 +5,7 @@ import java.util.List; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; @@ -104,13 +105,13 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ final String toolScrewDriver = "craftingToolScrewdriver"; if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)){ - Utils.LOG_WARNING("stickLong of "+cleanName+" does not exist."); + Logger.WARNING("stickLong of "+cleanName+" does not exist."); return false; } if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDense, 1)){ - Utils.LOG_WARNING("plateDense of "+cleanName+" does not exist."); + Logger.WARNING("plateDense of "+cleanName+" does not exist."); if (null != ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDouble, 1)){ - Utils.LOG_WARNING("plateDouble of "+cleanName+" does exist. Using it instead."); + Logger.WARNING("plateDouble of "+cleanName+" does exist. Using it instead."); RecipeUtils.recipeBuilder( plateDouble, plateDouble, plateDouble, toolFile, rodLong, toolHammer, @@ -119,7 +120,7 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ return true; } - Utils.LOG_WARNING("plateDouble of "+cleanName+" does not exist."); + Logger.WARNING("plateDouble of "+cleanName+" does not exist."); return false; } @@ -161,13 +162,13 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ //Utils.LOG_WARNING(removalist.toString()); bHardness = removalist.getBlockHardness(world, X, Y, Z)*100; - Utils.LOG_INFO("Hardness: "+bHardness); + Logger.INFO("Hardness: "+bHardness); bDurabilityLoss = 100; //Utils.LOG_WARNING("Durability Loss: "+bDurabilityLoss); correctTool = this.canPickaxeBlock(removalist, world, new int[]{X,Y,Z}); - Utils.LOG_WARNING(""+correctTool); + Logger.WARNING(""+correctTool); if (!correctTool){ return 0; diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java index a73ae3045c..d8b88c6c6d 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java @@ -4,8 +4,8 @@ import java.util.List; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.player.UtilsMining; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; @@ -77,13 +77,13 @@ public class StaballoyPickaxe extends ItemPickaxe{ //Utils.LOG_WARNING(removalist.toString()); bHardness = removalist.getBlockHardness(world, X, Y, Z); - Utils.LOG_WARNING("Hardness: "+bHardness); + Logger.WARNING("Hardness: "+bHardness); bDurabilityLoss = (bDurabilityLoss + bHardness); //Utils.LOG_WARNING("Durability Loss: "+bDurabilityLoss); correctTool = this.canPickaxeBlock(removalist, world, new int[]{X,Y,Z}); - Utils.LOG_WARNING(""+correctTool); + Logger.WARNING(""+correctTool); if (!correctTool){ return 0; @@ -115,14 +115,14 @@ public class StaballoyPickaxe extends ItemPickaxe{ float DURABILITY_LOSS = 0; if (!world.isRemote){ - Utils.LOG_WARNING("hardness:"+block.getBlockHardness(world, X, Y, Z)); + Logger.WARNING("hardness:"+block.getBlockHardness(world, X, Y, Z)); if (FACING.equals("below") || FACING.equals("above")){ DURABILITY_LOSS = 0; for(int i = -1; i < 2; i++) { for(int j = -1; j < 2; j++) { final float dur = this.calculateDurabilityLoss(world, X + i, Y, Z + j); DURABILITY_LOSS = (DURABILITY_LOSS + dur); - Utils.LOG_WARNING("Added Loss: "+dur); + Logger.WARNING("Added Loss: "+dur); this.removeBlockAndDropAsItem(world, X + i, Y, Z + j, heldItem); } } @@ -134,7 +134,7 @@ public class StaballoyPickaxe extends ItemPickaxe{ for(int j = -1; j < 2; j++) { final float dur = this.calculateDurabilityLoss(world, X, Y + i, Z + j); DURABILITY_LOSS = (DURABILITY_LOSS + dur); - Utils.LOG_WARNING("Added Loss: "+dur); + Logger.WARNING("Added Loss: "+dur); this.removeBlockAndDropAsItem(world, X , Y + i, Z + j, heldItem); } } @@ -146,25 +146,25 @@ public class StaballoyPickaxe extends ItemPickaxe{ for(int j = -1; j < 2; j++) { final float dur = this.calculateDurabilityLoss(world, X + j, Y + i, Z); DURABILITY_LOSS = (DURABILITY_LOSS + dur); - Utils.LOG_WARNING("Added Loss: "+dur); + Logger.WARNING("Added Loss: "+dur); this.removeBlockAndDropAsItem(world, X + j, Y + i, Z, heldItem); } } } //int heldItemDurability = heldItem.getDamage(1); - Utils.LOG_WARNING("Total Loss: "+(int)DURABILITY_LOSS); + Logger.WARNING("Total Loss: "+(int)DURABILITY_LOSS); //heldItem.setDamage(heldStack, DURABILITY_LOSS); //Utils.LOG_WARNING("|GID|Durability: "+heldItem.getItemDamage()); //Utils.LOG_WARNING("Durability: "+heldStack.getDamage(heldStack)); - Utils.LOG_WARNING("1x: "+(heldItem.getItemDamage())); + Logger.WARNING("1x: "+(heldItem.getItemDamage())); final int itemdmg = heldItem.getItemDamage(); final int maxdmg = heldItem.getMaxDamage(); final int dodmg = (int)DURABILITY_LOSS; final int durNow = maxdmg-itemdmg; final int durLeft = (int) ((maxdmg-itemdmg)-DURABILITY_LOSS); - Utils.LOG_WARNING( + Logger.WARNING( "Current Damage: " + itemdmg + " Max Damage: " + maxdmg + " Durability to be lost: " + dodmg @@ -176,13 +176,13 @@ public class StaballoyPickaxe extends ItemPickaxe{ //Break Tool if (((durNow-dodmg) <= (99)) && (itemdmg != 0)){ //TODO break tool - Utils.LOG_WARNING("Breaking Tool"); + Logger.WARNING("Breaking Tool"); heldItem.stackSize = 0; } //Do Damage else { //setItemDamage(heldItem, durLeft); - Utils.LOG_WARNING(""+(durNow-durLeft)); + Logger.WARNING(""+(durNow-durLeft)); this.damageItem(heldItem, (durNow-durLeft)-1, this.localPlayer); } @@ -215,17 +215,17 @@ public class StaballoyPickaxe extends ItemPickaxe{ try { final Block block = world.getBlock(X, Y, Z); final float dur = this.calculateDurabilityLoss(world, X, Y, Z); - Utils.LOG_WARNING(block.toString()); + Logger.WARNING(block.toString()); String removalTool = ""; removalTool = block.getHarvestTool(1); - Utils.LOG_WARNING("Removing.1 "+removalTool); + Logger.WARNING("Removing.1 "+removalTool); /*if ((removalTool.equalsIgnoreCase("pickaxe") || removalTool.equalsIgnoreCase("null") || removalTool == null)){ Utils.LOG_WARNING("Removing.2"); if (UtilsMining.getBlockType(block, world, new int[]{X,Y,Z}, miningLevel)) { Utils.LOG_WARNING("Removing.3"); */ if (this.canPickaxeBlock(block, world, new int[]{X,Y,Z})){ - Utils.LOG_WARNING("Removing.4"); + Logger.WARNING("Removing.4"); if (block == Blocks.air){ return; @@ -233,7 +233,7 @@ public class StaballoyPickaxe extends ItemPickaxe{ if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) >= 0) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ - Utils.LOG_WARNING("Removing.5"); + Logger.WARNING("Removing.5"); if (heldItem.getItemDamage() <= (heldItem.getMaxDamage()-dur)){ if (X == 0 && Y == 0 && Z == 0){ @@ -252,7 +252,7 @@ public class StaballoyPickaxe extends ItemPickaxe{ }*/ } else { - Utils.LOG_WARNING("Incorrect Tool for mining this block."); + Logger.WARNING("Incorrect Tool for mining this block."); } } catch (final NullPointerException e){ diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java index 9400c8308c..30c7fb7b7a 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java @@ -4,8 +4,8 @@ import java.util.List; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.player.UtilsMining; import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; @@ -75,7 +75,7 @@ public class StaballoySpade extends ItemSpade{ correctTool = currentBlock.getHarvestTool(0); //Utils.LOG_WARNING(correctTool); - Utils.LOG_WARNING("Tool for Block: "+correctTool+" | Current block: "+currentBlock.getLocalizedName()); + Logger.WARNING("Tool for Block: "+correctTool+" | Current block: "+currentBlock.getLocalizedName()); if (UtilsMining.getBlockType(currentBlock, currentWorld, xyz, this.miningLevel) || correctTool.equals("shovel")){ return true;} } catch (final NullPointerException e){ @@ -117,18 +117,18 @@ public class StaballoySpade extends ItemSpade{ } //int heldItemDurability = heldItem.getDamage(1); - Utils.LOG_WARNING("Total Loss: "+(int)DURABILITY_LOSS); + Logger.WARNING("Total Loss: "+(int)DURABILITY_LOSS); //heldItem.setDamage(heldStack, DURABILITY_LOSS); //Utils.LOG_WARNING("|GID|Durability: "+heldItem.getItemDamage()); //Utils.LOG_WARNING("Durability: "+heldStack.getDamage(heldStack)); - Utils.LOG_WARNING("1x: "+(heldItem.getItemDamage())); + Logger.WARNING("1x: "+(heldItem.getItemDamage())); final int itemdmg = heldItem.getItemDamage(); final int maxdmg = heldItem.getMaxDamage(); final int dodmg = (int)DURABILITY_LOSS; final int durNow = maxdmg-itemdmg; final int durLeft = (int) ((maxdmg-itemdmg)-DURABILITY_LOSS); - Utils.LOG_WARNING( + Logger.WARNING( "Current Damage: " + itemdmg + " Max Damage: " + maxdmg + " Durability to be lost: " + dodmg @@ -140,13 +140,13 @@ public class StaballoySpade extends ItemSpade{ //Break Tool if (((durNow-dodmg) <= (900)) && (itemdmg != 0)){ //TODO break tool - Utils.LOG_WARNING("Breaking Tool"); + Logger.WARNING("Breaking Tool"); heldItem.stackSize = 0; } //Do Damage else { //setItemDamage(heldItem, durLeft); - Utils.LOG_WARNING(""+(durNow-durLeft)); + Logger.WARNING(""+(durNow-durLeft)); this.damageItem(heldItem, (durNow-durLeft)-1, this.localPlayer); } DURABILITY_LOSS = 0; @@ -165,10 +165,10 @@ public class StaballoySpade extends ItemSpade{ //Should clear up blocks quicker if I chain it. public int removeBlockAndDropAsItem(final World world, final int X, final int Y, final int Z, final ItemStack heldItem){ this.localWorld = world; - Utils.LOG_WARNING("Trying to drop/remove a block."); + Logger.WARNING("Trying to drop/remove a block."); try { final Block block = world.getBlock(X, Y, Z); - Utils.LOG_WARNING(block.toString()); + Logger.WARNING(block.toString()); String removalTool = ""; removalTool = block.getHarvestTool(0); if (removalTool != null){ @@ -188,22 +188,22 @@ public class StaballoySpade extends ItemSpade{ } block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0); world.setBlockToAir(X, Y, Z); - Utils.LOG_WARNING("Adding 100 damage to item."); + Logger.WARNING("Adding 100 damage to item."); return 100; } - Utils.LOG_WARNING("Incorrect Tool for mining this block. Wrong Block Water/lava/bedrock/blacklist"); + Logger.WARNING("Incorrect Tool for mining this block. Wrong Block Water/lava/bedrock/blacklist"); return 0; } - Utils.LOG_WARNING("Incorrect Tool for mining this block. Cannot Shovel this block type."); + Logger.WARNING("Incorrect Tool for mining this block. Cannot Shovel this block type."); return 0; } - Utils.LOG_WARNING("Incorrect Tool for mining this block. Blocks mining tool is now Shovel."); + Logger.WARNING("Incorrect Tool for mining this block. Blocks mining tool is now Shovel."); return 0; } - Utils.LOG_WARNING("Either the block was air or it declares an invalid mining tool."); + Logger.WARNING("Either the block was air or it declares an invalid mining tool."); return 0; } catch (final NullPointerException e){ - Utils.LOG_WARNING("Something Broke"); + Logger.WARNING("Something Broke"); e.printStackTrace(); return 0; } diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index 78b7cf4326..5de70b467a 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -1,17 +1,10 @@ package gtPlusPlus.core.lib; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.UUID; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; import com.mojang.authlib.GameProfile; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.array.Pair; @@ -46,8 +39,6 @@ public class CORE { public static boolean DEVENV = false; public static boolean DEBUG = false; - @SideOnly(Side.CLIENT) - public static boolean mFancyGraphics = false; //Only can be set in Dev, no config or setting elsewhere. public static final boolean LOAD_ALL_CONTENT = false;; @@ -55,13 +46,14 @@ public class CORE { public static final String name = "GT++"; public static final String MODID = "miscutils"; - public static final String VERSION = "1.6.101-prerelease"; + public static final String VERSION = "1.6.110-prerelease"; public static String MASTER_VERSION = NetworkUtils.getContentFromURL("https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt").toLowerCase(); public static String USER_COUNTRY = GeoUtils.determineUsersCountry(); public static boolean isModUpToDate = Utils.isModUpToDate(); //Tweakables public static int DARKBIOME_ID = 238; + public static int DARKWORLD_ID = 227; //GT Vars; public static final int GREG_FIRST_ID = 760; diff --git a/src/Java/gtPlusPlus/core/lib/LoadedMods.java b/src/Java/gtPlusPlus/core/lib/LoadedMods.java index c807d8f03c..04ddd7b021 100644 --- a/src/Java/gtPlusPlus/core/lib/LoadedMods.java +++ b/src/Java/gtPlusPlus/core/lib/LoadedMods.java @@ -4,8 +4,8 @@ import static gtPlusPlus.core.lib.CORE.BRC; import static gtPlusPlus.core.lib.CORE.GTNH; import cpw.mods.fml.common.Loader; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE.ConfigSwitches; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechTextures; import gtPlusPlus.xmod.gregtech.recipes.GregtechRecipeAdder; @@ -55,19 +55,19 @@ public class LoadedMods { private static int totalMods; @SuppressWarnings("deprecation") public static void checkLoaded(){ - Utils.LOG_INFO("Looking for optional mod prereqs."); + Logger.INFO("Looking for optional mod prereqs."); if (Loader.isModLoaded("gregtech") == true ){ Gregtech = true; - Utils.LOG_INFO("Components enabled for: Gregtech"); + Logger.INFO("Components enabled for: Gregtech"); if (Gregtech){ try { CORE.sRecipeAdder = CORE.RA = new GregtechRecipeAdder(); - Utils.LOG_INFO("Created Gregtech recipe handler."); + Logger.INFO("Created Gregtech recipe handler."); GregtechTextures.BlockIcons.VOID.name(); GregtechTextures.ItemIcons.VOID.name(); - Utils.LOG_INFO("Created Gregtech texture handler."); + Logger.INFO("Created Gregtech texture handler."); } catch (final NullPointerException e){ - Utils.LOG_INFO("Could NOT create a Gregtech recipe handler."); + Logger.INFO("Could NOT create a Gregtech recipe handler."); } } @@ -76,194 +76,194 @@ public class LoadedMods { if (Loader.isModLoaded("dreamcraft") == true){ DreamCraft = true; GTNH = true; - Utils.LOG_INFO("Components enabled for: DreamCraft"); - Utils.LOG_INFO("Components enabled for: GT: New Horizons"); + Logger.INFO("Components enabled for: DreamCraft"); + Logger.INFO("Components enabled for: GT: New Horizons"); totalMods++; } if (Loader.isModLoaded("beyondrealitycore") == true){ BeyondRealityCore = true; BRC = true; - Utils.LOG_INFO("Components enabled for: Beyond Reality"); + Logger.INFO("Components enabled for: Beyond Reality"); totalMods++; } if (Loader.isModLoaded("PlayerAPI") == true){ PlayerAPI = true; - Utils.LOG_INFO("Components enabled for: PlayerAPI"); + Logger.INFO("Components enabled for: PlayerAPI"); totalMods++; } if (Loader.isModLoaded("BuildCraft") == true){ BuildCraft = true; - Utils.LOG_INFO("Components enabled for: BuildCraft"); + Logger.INFO("Components enabled for: BuildCraft"); totalMods++; } if ((Loader.isModLoaded("EnderIO") == true) && !ConfigSwitches.disableEnderIOIntegration){ EnderIO = true; - Utils.LOG_INFO("Components enabled for: EnderIO"); + Logger.INFO("Components enabled for: EnderIO"); totalMods++; } if (Loader.isModLoaded("BigReactors") == true){ Big_Reactors = true; - Utils.LOG_INFO("Components enabled for: Big Reactors"); + Logger.INFO("Components enabled for: Big Reactors"); totalMods++; } if (Loader.isModLoaded("IC2") == true){ IndustrialCraft2 = true; - Utils.LOG_INFO("Components enabled for: IndustrialCraft2"); + Logger.INFO("Components enabled for: IndustrialCraft2"); totalMods++; } if (Loader.isModLoaded("simplyjetpacks") == true){ Simply_Jetpacks = true; - Utils.LOG_INFO("Components enabled for: Simply Jetpacks"); + Logger.INFO("Components enabled for: Simply Jetpacks"); totalMods++; } if (Loader.isModLoaded("rftools") == true){ RFTools = true; - Utils.LOG_INFO("Components enabled for: RFTools"); + Logger.INFO("Components enabled for: RFTools"); totalMods++; } if (Loader.isModLoaded("Thaumcraft") == true){ Thaumcraft = true; - Utils.LOG_INFO("Components enabled for: Thaumcraft"); + Logger.INFO("Components enabled for: Thaumcraft"); totalMods++; } if (Loader.isModLoaded("BiomesOPlenty") == true){ BiomesOPlenty = true; - Utils.LOG_INFO("Components enabled for: BiomesOPlenty"); + Logger.INFO("Components enabled for: BiomesOPlenty"); totalMods++; } if (Loader.isModLoaded("ExtraUtilities") == true){ Extra_Utils = true; - Utils.LOG_INFO("Components enabled for: Extra_Utils"); + Logger.INFO("Components enabled for: Extra_Utils"); totalMods++; } if (Loader.isModLoaded("harvestcraft") == true){ PamsHarvestcraft = true; - Utils.LOG_INFO("Components enabled for: PamsHarvestcraft"); + Logger.INFO("Components enabled for: PamsHarvestcraft"); totalMods++; } if (Loader.isModLoaded("PneumaticCraft") == true){ PneumaticCraft = true; - Utils.LOG_INFO("Components enabled for: PneumaticCraft"); + Logger.INFO("Components enabled for: PneumaticCraft"); totalMods++; } if (Loader.isModLoaded("MorePlanet") == true){ MorePlanets = true; - Utils.LOG_INFO("Components enabled for: MorePlanets"); + Logger.INFO("Components enabled for: MorePlanets"); totalMods++; } if (Loader.isModLoaded("ForbiddenMagic") == true){ ForbiddenMagic = true; - Utils.LOG_INFO("Components enabled for: ForbiddenMagic"); + Logger.INFO("Components enabled for: ForbiddenMagic"); totalMods++; } if (Loader.isModLoaded("CompactWindmills") == true){ CompactWindmills = true; - Utils.LOG_INFO("Components enabled for: CompactWindmills"); + Logger.INFO("Components enabled for: CompactWindmills"); totalMods++; } if (Loader.isModLoaded("Railcraft") == true){ Railcraft = true; - Utils.LOG_INFO("Components enabled for: Railcraft"); + Logger.INFO("Components enabled for: Railcraft"); totalMods++; } if (Loader.isModLoaded("Mekanism") == true){ Mekanism = true; - Utils.LOG_INFO("Components enabled for: Mekanism - This feature is not configurable and balances Mekanism to suit GT."); + Logger.INFO("Components enabled for: Mekanism - This feature is not configurable and balances Mekanism to suit GT."); totalMods++; } if (Loader.isModLoaded("Growthcraft") == true){ - Utils.LOG_INFO("Growthcraft Version: "+getModVersion("Growthcraft")); + Logger.INFO("Growthcraft Version: "+getModVersion("Growthcraft")); if (getModVersion("Growthcraft").equals("1.7.10-2.3.1")){ //Load Growthcraft Compat Growthcraft = true; - Utils.LOG_INFO("Components enabled for: Growthcraft"); + Logger.INFO("Components enabled for: Growthcraft"); totalMods++; } else { Growthcraft = false; - Utils.LOG_INFO("Growthcraft found, but the version was too new. I will update GC support eventually."); + Logger.INFO("Growthcraft found, but the version was too new. I will update GC support eventually."); } } if (Loader.isModLoaded("CoFHCore") == true){ CoFHCore = true; - Utils.LOG_INFO("Components enabled for: CoFHCore"); + Logger.INFO("Components enabled for: CoFHCore"); totalMods++; } if (Loader.isModLoaded("Forestry") == true){ Forestry = true; - Utils.LOG_INFO("Components enabled for: Forestry"); + Logger.INFO("Components enabled for: Forestry"); totalMods++; } if (Loader.isModLoaded("MagicBees") == true){ MagicBees = true; - Utils.LOG_INFO("Components enabled for: MagicBees"); + Logger.INFO("Components enabled for: MagicBees"); totalMods++; } if (Loader.isModLoaded("psychedelicraft") == true){ Psychedelicraft = true; - Utils.LOG_INFO("Components enabled for: Psychedelicraft"); + Logger.INFO("Components enabled for: Psychedelicraft"); totalMods++; } if (Loader.isModLoaded("ImmersiveEngineering") == true){ ImmersiveEngineering = true; - Utils.LOG_INFO("Components enabled for: ImmersiveEngineering"); + Logger.INFO("Components enabled for: ImmersiveEngineering"); totalMods++; } if (Loader.isModLoaded("ExtraBees") == true){ ExtraBees = true; - Utils.LOG_INFO("Components enabled for: ExtraBees"); + Logger.INFO("Components enabled for: ExtraBees"); totalMods++; } if (Loader.isModLoaded("ThermalFoundation") == false){ ThermalFoundation = false; - Utils.LOG_INFO("Components enabled for: ThermalFoundation - This feature will disable itself if you add TF."); + Logger.INFO("Components enabled for: ThermalFoundation - This feature will disable itself if you add TF."); totalMods++; } else if (Loader.isModLoaded("ThermalFoundation") == true){ ThermalFoundation = true; - Utils.LOG_INFO("Components disabled for: ThermalFoundation - This feature will enable itself if you remove TF."); + Logger.INFO("Components disabled for: ThermalFoundation - This feature will enable itself if you remove TF."); //totalMods++; } if (Loader.isModLoaded("ihl") == true){ IHL = true; - Utils.LOG_INFO("Components enabled for: IHL"); + Logger.INFO("Components enabled for: IHL"); totalMods++; } if (Loader.isModLoaded("Baubles") == true){ Baubles = true; - Utils.LOG_INFO("Components enabled for: Baubles"); + Logger.INFO("Components enabled for: Baubles"); totalMods++; } if (Loader.isModLoaded("GalacticraftCore") == true){ GalacticraftCore = true; - Utils.LOG_INFO("Components enabled for: Galacticraft Core"); + Logger.INFO("Components enabled for: Galacticraft Core"); totalMods++; } if (Loader.isModLoaded("OpenComputers") == true){ OpenComputers = true; - Utils.LOG_INFO("Components enabled for: OpenComputers"); + Logger.INFO("Components enabled for: OpenComputers"); totalMods++; } if (Loader.isModLoaded("computronics") == true){ Computronics = true; - Utils.LOG_INFO("Components disabled for: Computronics - This feature will enable itself if you remove Computronics."); + Logger.INFO("Components disabled for: Computronics - This feature will enable itself if you remove Computronics."); totalMods++; } else { - Utils.LOG_INFO("Components enabled for: Computronics - This feature will disable itself if you add Computronics."); + Logger.INFO("Components enabled for: Computronics - This feature will disable itself if you add Computronics."); } if (Loader.isModLoaded("GTRedtech") == true){ RedTech = true; - Utils.LOG_INFO("Components enabled for: GTRedtech"); + Logger.INFO("Components enabled for: GTRedtech"); totalMods++; } if (Loader.isModLoaded("tectech") == true){ TecTech = true; - Utils.LOG_INFO("Components enabled for: TecTech"); + Logger.INFO("Components enabled for: TecTech"); totalMods++; } - Utils.LOG_INFO("Content found for "+totalMods+" mods"); + Logger.INFO("Content found for "+totalMods+" mods"); } diff --git a/src/Java/gtPlusPlus/core/material/ALLOY.java b/src/Java/gtPlusPlus/core/material/ALLOY.java index 8d1d4e5ecd..84bd859ed4 100644 --- a/src/Java/gtPlusPlus/core/material/ALLOY.java +++ b/src/Java/gtPlusPlus/core/material/ALLOY.java @@ -589,7 +589,7 @@ public final class ALLOY { -1, //Boiling Point in C -1, -1, - true, //Uses Blast furnace? + false, //Uses Blast furnace? new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().TRINIUM_REFINED, 5), new MaterialStack(ELEMENT.getInstance().NAQUADAH, 9) diff --git a/src/Java/gtPlusPlus/core/material/ELEMENT.java b/src/Java/gtPlusPlus/core/material/ELEMENT.java index 859ebd86cf..eccd283da9 100644 --- a/src/Java/gtPlusPlus/core/material/ELEMENT.java +++ b/src/Java/gtPlusPlus/core/material/ELEMENT.java @@ -1,6 +1,7 @@ package gtPlusPlus.core.material; import gregtech.api.enums.Materials; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.StringUtils; import gtPlusPlus.core.util.materials.MaterialUtils; @@ -10,7 +11,17 @@ public final class ELEMENT { private static final ELEMENT thisClass = new ELEMENT(); public ELEMENT(){ - + + //GTNH Trinium Handling + if (CORE.GTNH){ + TRINIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.valueOf("Trinium")); + TRINIUM_REFINED = new Material("Refined Trinium", MaterialState.SOLID, new short[]{210, 255, 170}, 4304, 14057, 181, 133, false, "Ke", 0, new MaterialStack[]{new MaterialStack(TRINIUM, 1)});//Not a GT Inherited Material + } + else { + TRINIUM = new Material("Trinium", MaterialState.SOLID, new short[]{70, 110, 30}, 604, 4057, 181, 133, false, "Ke", 0, false);//Not a GT Inherited Material + TRINIUM_REFINED = new Material("Refined Trinium", MaterialState.SOLID, new short[]{210, 255, 170}, 4304, 14057, 181, 133, false, "Ke", 0, new MaterialStack[]{new MaterialStack(TRINIUM, 1)});//Not a GT Inherited Material + } + } public static ELEMENT getInstance(){ @@ -131,7 +142,7 @@ public final class ELEMENT { //Fictional public final Material NAQUADAH = MaterialUtils.generateMaterialFromGtENUM(Materials.Naquadah); - public final Material TRINIUM = new Material("Trinium", MaterialState.SOLID, new short[]{170, 210, 130}, 604, 4057, 181, 133, false, "Ke", 0, false);//Not a GT Inherited Material - public final Material TRINIUM_REFINED = new Material("Refined Trinium", MaterialState.SOLID, new short[]{210, 255, 170}, 4304, 14057, 181, 133, false, "Ke", 0, new MaterialStack[]{new MaterialStack(TRINIUM, 1)});//Not a GT Inherited Material + public final Material TRINIUM; + public final Material TRINIUM_REFINED; //https://github.com/Blood-Asp/GT5-Unofficial/issues/609 } diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index 40d8461209..b04ce3baac 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -2,9 +2,10 @@ package gtPlusPlus.core.material; import static gregtech.api.enums.GT_Values.M; -import java.util.ArrayList; +import java.util.*; import gregtech.api.enums.*; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.base.cell.BaseItemCell; import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.StringUtils; @@ -28,7 +29,7 @@ public class Material { private final Fluid vMoltenFluid; private final Fluid vPlasma; - + private final boolean vGenerateCells; protected Object dataVar = MathUtils.generateSingularRandomHexValue(); @@ -60,10 +61,21 @@ public class Material { public final int vToolQuality; public final int vHarvestLevel; + + public static Map<Integer, Materials> invalidMaterials = new HashMap<Integer, Materials>(); + + public Material(String materialName, MaterialState defaultState, short[] rgba, int radiationLevel, MaterialStack[] materialStacks) { + this (materialName, defaultState, 0, rgba, -1, -1, -1, -1, false, "", radiationLevel, false, materialStacks); + } + public Material(final String materialName, final MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final MaterialStack... inputs){ this(materialName, defaultState, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, "", 0, inputs); } + public Material(final String materialName, final MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, boolean generateCells, final MaterialStack... inputs){ + this(materialName, defaultState, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, "", 0, generateCells, inputs); + } + public Material(final String materialName, final MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final int radiationLevel, final MaterialStack... inputs){ this(materialName, defaultState, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, "", radiationLevel, inputs); } @@ -83,7 +95,7 @@ public class Material { public Material(final String materialName, final MaterialState defaultState, final long durability, final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, final MaterialStack... inputs){ this (materialName, defaultState, durability, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, chemicalSymbol, radiationLevel, true, inputs); } - + public Material(final String materialName, final MaterialState defaultState, final long durability, final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, boolean generateCells, final MaterialStack... inputs){ this.unlocalizedName = Utils.sanitizeString(materialName); @@ -105,7 +117,7 @@ public class Material { } } } - + //Set Melting/Boiling point, if value is -1 calculate it from compound inputs. if (meltingPoint != -1){ @@ -128,7 +140,7 @@ public class Material { this.meltingPointK = (int) MathUtils.celsiusToKelvin(this.meltingPointC); this.boilingPointK = (int) MathUtils.celsiusToKelvin(this.boilingPointC); - + //Set Proton/Neutron count, if value is -1 calculate it from compound inputs. if (protons != -1){ this.vProtons = protons; @@ -142,10 +154,10 @@ public class Material { else { this.vNeutrons = this.calculateNeutrons(); } - - - - + + + + this.vMass = this.getMass(); //Sets tool Durability @@ -239,20 +251,20 @@ public class Material { this.vChemicalFormula = this.getToolTip(chemicalSymbol, OrePrefixes.dust.mMaterialAmount / M, true); } else if (!this.vChemicalSymbol.equals("")){ - Utils.LOG_WARNING("materialInput is null, using a valid chemical symbol."); + Logger.WARNING("materialInput is null, using a valid chemical symbol."); this.vChemicalFormula = this.vChemicalSymbol; } else{ - Utils.LOG_WARNING("MaterialInput == null && chemicalSymbol probably equals nothing"); + Logger.WARNING("MaterialInput == null && chemicalSymbol probably equals nothing"); this.vChemicalFormula = "??"; } + final Materials isValid = Materials.get(this.getLocalizedName()); - if (FluidUtils.getFluidStack(localizedName, 1) != null){ this.vMoltenFluid = FluidUtils.getFluidStack(localizedName, 1).getFluid(); } - else if (isValid == Materials._NULL){ + else if (isValid == null || isValid == Materials._NULL){ this.vMoltenFluid = this.generateFluid(); } else { @@ -269,8 +281,6 @@ public class Material { this.vPlasma = this.generatePlasma(); - //dataVar = MathUtils.generateSingularRandomHexValue(); - String ratio = ""; if (this.vSmallestRatio != null) { for (int hu=0;hu<this.vSmallestRatio.length;hu++){ @@ -283,14 +293,14 @@ public class Material { } } - Utils.LOG_WARNING("Creating a Material instance for "+materialName); - Utils.LOG_WARNING("Formula: "+this.vChemicalFormula + " Smallest Stack: "+this.smallestStackSizeWhenProcessing+" Smallest Ratio:"+ratio); - Utils.LOG_WARNING("Protons: "+this.vProtons); - Utils.LOG_WARNING("Neutrons: "+this.vNeutrons); - Utils.LOG_WARNING("Mass: "+this.vMass+"/units"); - Utils.LOG_WARNING("Melting Point: "+this.meltingPointC+"C."); - Utils.LOG_WARNING("Boiling Point: "+this.boilingPointC+"C."); - } + Logger.WARNING("Creating a Material instance for "+materialName); + Logger.WARNING("Formula: "+this.vChemicalFormula + " Smallest Stack: "+this.smallestStackSizeWhenProcessing+" Smallest Ratio:"+ratio); + Logger.WARNING("Protons: "+this.vProtons); + Logger.WARNING("Neutrons: "+this.vNeutrons); + Logger.WARNING("Mass: "+this.vMass+"/units"); + Logger.WARNING("Melting Point: "+this.meltingPointC+"C."); + Logger.WARNING("Boiling Point: "+this.boilingPointC+"C."); + } public final String getLocalizedName(){ if (this.localizedName != null) { @@ -448,8 +458,8 @@ public class Material { try { testNull = this.vMaterialInput.get(i).getValidStack(); } catch (final Throwable r){ - Utils.LOG_WARNING("Failed gathering material stack for "+this.localizedName+"."); - Utils.LOG_WARNING("What Failed: Length:"+this.vMaterialInput.size()+" current:"+i); + Logger.WARNING("Failed gathering material stack for "+this.localizedName+"."); + Logger.WARNING("What Failed: Length:"+this.vMaterialInput.size()+" current:"+i); } try { if (testNull != null){ @@ -457,7 +467,7 @@ public class Material { temp[i] = this.vMaterialInput.get(i).getValidStack(); } } catch (final Throwable r){ - Utils.LOG_WARNING("Failed setting slot "+i+", using "+this.localizedName); + Logger.WARNING("Failed setting slot "+i+", using "+this.localizedName); } } return temp; @@ -505,8 +515,8 @@ public class Material { public final long[] getSmallestRatio(final ArrayList<MaterialStack> tempInput){ if (tempInput != null){ if (!tempInput.isEmpty()){ - Utils.LOG_WARNING("length: "+tempInput.size()); - Utils.LOG_WARNING("(inputs != null): "+(tempInput != null)); + Logger.WARNING("length: "+tempInput.size()); + Logger.WARNING("(inputs != null): "+(tempInput != null)); //Utils.LOG_WARNING("length: "+inputs.length); final long[] tempRatio = new long[tempInput.size()]; for (int x=0;x<tempInput.size();x++){ @@ -524,7 +534,7 @@ public class Material { for (int r=0;r<tempRatio.length;r++){ tempRatioStringThing1 = tempRatioStringThing1 + tempRatio[r] +" : "; } - Utils.LOG_WARNING("Default Ratio: "+tempRatioStringThing1); + Logger.WARNING("Default Ratio: "+tempRatioStringThing1); String tempRatioStringThing = ""; int tempSmallestCraftingUseSize = 0; @@ -533,7 +543,7 @@ public class Material { tempSmallestCraftingUseSize = (int) (tempSmallestCraftingUseSize + smallestRatio[r]); } //this.smallestStackSizeWhenProcessing = tempSmallestCraftingUseSize; - Utils.LOG_WARNING("Smallest Ratio: "+tempRatioStringThing); + Logger.WARNING("Smallest Ratio: "+tempRatioStringThing); return smallestRatio; } } @@ -545,7 +555,7 @@ public class Material { if (!aShowQuestionMarks && (this.vChemicalFormula.equals("?")||this.vChemicalFormula.equals("??"))) { return ""; } - Utils.LOG_WARNING("===============| Calculating Atomic Formula for "+this.localizedName+" |==============="); + Logger.WARNING("===============| Calculating Atomic Formula for "+this.localizedName+" |==============="); if (!chemSymbol.equals("")) { return chemSymbol; } @@ -588,101 +598,164 @@ public class Material { return StringUtils.subscript(dummyFormula); //return dummyFormula; } - Utils.LOG_WARNING("dummyFormulaArray <= 0"); + Logger.WARNING("dummyFormulaArray <= 0"); } - Utils.LOG_WARNING("dummyFormulaArray == null"); + Logger.WARNING("dummyFormulaArray == null"); } - Utils.LOG_WARNING("tempInput.length <= 0"); + Logger.WARNING("tempInput.length <= 0"); } - Utils.LOG_WARNING("tempInput == null"); + Logger.WARNING("tempInput == null"); return "??"; } public final Fluid generateFluid(){ - try { - if (Materials.get(this.localizedName) == Materials.Clay){ - return null; - } - } catch (final Throwable e){} - - if (Materials.get(this.localizedName).mFluid == null){ - Utils.LOG_WARNING("Generating our own fluid."); - - //Generate a Cell if we need to - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1) == null){ - if (this.vGenerateCells){ - final Item temp = new BaseItemCell(this); + final Materials isValid = Materials.get(this.getLocalizedName()); + Logger.WARNING("Is "+this.getLocalizedName()+" a Gregtech material? "+(isValid != null && isValid != Materials._NULL)+" | Found "+isValid.mDefaultLocalName); + if (isValid != Materials._NULL){ + for (Materials m : invalidMaterials.values()){ + if (isValid == m){ + Logger.WARNING("Trying to generate a fluid for blacklisted material: "+m.mDefaultLocalName); + FluidStack a1 = m.getFluid(1); + FluidStack a2 = m.getGas(1); + FluidStack a3 = m.getMolten(1); + FluidStack a4 = m.getSolid(1); + FluidStack a5 = m.getPlasma(1); + if (a1 != null){ + Logger.WARNING("Using a pre-defined Fluid from GT. Fluid."); + return a1.getFluid(); + } + if (a2 != null){ + Logger.WARNING("Using a pre-defined Fluid from GT. Gas."); + return a2.getFluid(); + } + if (a3 != null){ + Logger.WARNING("Using a pre-defined Fluid from GT. Molten."); + return a3.getFluid(); + } + if (a4 != null){ + Logger.WARNING("Using a pre-defined Fluid from GT. Solid."); + return a4.getFluid(); + } + if (a5 != null){ + Logger.WARNING("Using a pre-defined Fluid from GT. Plasma."); + return a5.getFluid(); + } + Logger.WARNING("Using null."); + return null; } } + } - if (this.materialState == MaterialState.SOLID){ - return FluidUtils.addGTFluid( - this.getUnlocalizedName(), - "Molten "+this.getLocalizedName(), - this.RGBA, - this.materialState.ID(), - this.getMeltingPointK(), - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1), - ItemList.Cell_Empty.get(1L, new Object[0]), - 1000); + if (this.materialState == MaterialState.SOLID){ + if (isValid.mFluid != null){ + Logger.WARNING("Using a pre-defined Fluid from GT. mFluid."); + return isValid.mFluid; + } + else if (isValid.mStandardMoltenFluid != null){ + Logger.WARNING("Using a pre-defined Fluid from GT. mStandardMoltenFluid."); + return isValid.mStandardMoltenFluid; } - else if (this.materialState == MaterialState.LIQUID){ - return FluidUtils.addGTFluid( - this.getUnlocalizedName(), - this.getLocalizedName(), - this.RGBA, - this.materialState.ID(), - this.getMeltingPointK(), - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1), - ItemList.Cell_Empty.get(1L, new Object[0]), - 1000); + } + else if (this.materialState == MaterialState.GAS){ + if (isValid.mGas != null){ + Logger.WARNING("Using a pre-defined Fluid from GT. mGas."); + return isValid.mGas; + } + } + else if (this.materialState == MaterialState.LIQUID || this.materialState == MaterialState.PURE_LIQUID){ + if (isValid.mFluid != null){ + Logger.WARNING("Using a pre-defined Fluid from GT. mFluid."); + return isValid.mFluid; + } + else if (isValid.mGas != null){ + Logger.WARNING("Using a pre-defined Fluid from GT. mGas."); + return isValid.mGas; } - else if (this.materialState == MaterialState.GAS){ - return FluidUtils.addGTFluid( - this.getUnlocalizedName(), - this.getLocalizedName()+" Gas", - this.RGBA, - this.materialState.ID(), - this.getMeltingPointK(), - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1), - ItemList.Cell_Empty.get(1L, new Object[0]), - 1000); + else if (isValid.mStandardMoltenFluid != null){ + Logger.WARNING("Using a pre-defined Fluid from GT. mStandardMoltenFluid."); + return isValid.mStandardMoltenFluid; } - else { //Plasma - return this.generatePlasma(); + } + + Logger.WARNING("Generating our own fluid."); + //Generate a Cell if we need to + if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1) == null){ + if (this.vGenerateCells){ + final Item temp = new BaseItemCell(this); + Logger.WARNING("Generated a cell for "+this.getUnlocalizedName()); } + else { + Logger.WARNING("Did not generate a cell for "+this.getUnlocalizedName()); + } + } + + if (this.materialState == MaterialState.SOLID){ + return FluidUtils.addGTFluid( + this.getUnlocalizedName(), + "Molten "+this.getLocalizedName(), + this.RGBA, + this.materialState.ID(), + this.getMeltingPointK(), + ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1), + ItemList.Cell_Empty.get(1L, new Object[0]), + 1000); + } + else if (this.materialState == MaterialState.LIQUID){ + return FluidUtils.addGTFluid( + this.getUnlocalizedName(), + this.getLocalizedName(), + this.RGBA, + this.materialState.ID(), + this.getMeltingPointK(), + ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1), + ItemList.Cell_Empty.get(1L, new Object[0]), + 1000); + } + else if (this.materialState == MaterialState.GAS){ + return FluidUtils.addGTFluid( + this.getUnlocalizedName(), + this.getLocalizedName()+" Gas", + this.RGBA, + this.materialState.ID(), + this.getMeltingPointK(), + ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1), + ItemList.Cell_Empty.get(1L, new Object[0]), + 1000); + } + else { //Plasma + return this.generatePlasma(); } - Utils.LOG_WARNING("Getting the fluid from a GT material instead."); - return Materials.get(this.localizedName).mFluid; } public final Fluid generatePlasma(){ - final Materials isValid = Materials.get(this.getLocalizedName()); - if ((isValid != Materials._NULL) && (isValid != null) && (isValid != Materials.Clay) && (isValid != Materials.Clay) - && (isValid != Materials.Phosphorus) && (isValid != Materials.Steel) && (isValid != Materials.Bronze)){ - if (isValid.mPlasma != null){ - Utils.LOG_WARNING("Using a pre-defined Plasma from GT."); - return isValid.mPlasma; - } - } - - if (this.vGenerateCells){ + final Materials isValid = Materials.get(this.getLocalizedName()); + + if (!this.vGenerateCells){ return null; } - - Utils.LOG_WARNING("Generating our own Plasma."); + for (Materials m : invalidMaterials.values()){ + if (isValid == m){ + return (m.mPlasma != null ? m.mPlasma : null); + } + } + if (isValid.mPlasma != null){ + Logger.WARNING("Using a pre-defined Plasma from GT."); + return isValid.mPlasma; + } + + Logger.WARNING("Generating our own Plasma."); return FluidUtils.addGTPlasma(this); - //return null; } - final public FluidStack getFluid(final int fluidAmount) { - //Utils.LOG_WARNING("Attempting to get "+fluidAmount+"L of "+this.vMoltenFluid.getName()); + final public FluidStack getFluid(final int fluidAmount) { + if (this.vMoltenFluid == null){ + return null; + } final FluidStack moltenFluid = new FluidStack(this.vMoltenFluid, fluidAmount); - //Utils.LOG_WARNING("Info: "+moltenFluid.getFluid().getName()+" Info: "+moltenFluid.amount+" Info: "+moltenFluid.getFluidID()); return moltenFluid; } @@ -690,12 +763,17 @@ public class Material { final public int calculateMeltingPoint(){ int meltingPoint = 0; for (MaterialStack part : this.vMaterialInput){ - int incrementor = part.getStackMaterial().getMeltingPointC(); - meltingPoint += incrementor; - Utils.LOG_WARNING("Melting Point for "+this.getLocalizedName()+" increased to "+ incrementor); + if (part != null){ + int incrementor = part.getStackMaterial().getMeltingPointC(); + meltingPoint += incrementor; + Logger.WARNING("Melting Point for "+this.getLocalizedName()+" increased to "+ incrementor); + } + else { + Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition."); + } } int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1); - Utils.LOG_WARNING("Dividing "+meltingPoint+" / "+divisor+" to get average melting point."); + Logger.WARNING("Dividing "+meltingPoint+" / "+divisor+" to get average melting point."); meltingPoint = (meltingPoint/divisor); return meltingPoint; } @@ -703,7 +781,12 @@ public class Material { final public int calculateBoilingPoint(){ int boilingPoint = 0; for (MaterialStack part : this.vMaterialInput){ - boilingPoint += part.getStackMaterial().getBoilingPointC(); + if (part != null){ + boilingPoint += part.getStackMaterial().getBoilingPointC(); + } + else { + Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition."); + } } int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1); boilingPoint = (boilingPoint/divisor); @@ -713,7 +796,12 @@ public class Material { final public long calculateProtons(){ long protonCount = 0; for (MaterialStack part : this.vMaterialInput){ - protonCount += (part.getStackMaterial().getProtons()); + if (part != null){ + protonCount += (part.getStackMaterial().getProtons()); + } + else { + Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition."); + } } int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1); protonCount = (protonCount/divisor); @@ -723,7 +811,12 @@ public class Material { final public long calculateNeutrons(){ long neutronCount = 0; for (MaterialStack part : this.vMaterialInput){ - neutronCount += (part.getStackMaterial().getNeutrons()); + if (part != null){ + neutronCount += (part.getStackMaterial().getNeutrons()); + } + else { + Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition."); + } } int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1); neutronCount = (neutronCount/divisor); diff --git a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java index 65c0f1e6c0..727f929036 100644 --- a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java +++ b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java @@ -1,5 +1,6 @@ package gtPlusPlus.core.material; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.base.BasicBlock.BlockTypes; import gtPlusPlus.core.block.base.BlockBaseModular; import gtPlusPlus.core.item.base.bolts.BaseItemBolt; @@ -8,6 +9,7 @@ import gtPlusPlus.core.item.base.gears.BaseItemGear; import gtPlusPlus.core.item.base.ingots.BaseItemIngot; import gtPlusPlus.core.item.base.ingots.BaseItemIngotHot; import gtPlusPlus.core.item.base.nugget.BaseItemNugget; +import gtPlusPlus.core.item.base.ore.BaseItemCrushedOre; import gtPlusPlus.core.item.base.plates.BaseItemPlate; import gtPlusPlus.core.item.base.plates.BaseItemPlateDouble; import gtPlusPlus.core.item.base.rings.BaseItemRing; @@ -19,15 +21,7 @@ import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.core.util.item.ItemUtils; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_AlloySmelter; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Assembler; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_BlastSmelter; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_DustGeneration; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Extruder; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Fluids; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Plates; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Recycling; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_ShapedCrafting; +import gtPlusPlus.xmod.gregtech.loaders.*; import net.minecraft.block.Block; import net.minecraft.item.Item; @@ -132,6 +126,18 @@ public class MaterialGenerator { FluidUtils.generateFluidNoPrefix(unlocalizedName, materialName, matInfo.getMeltingPointK(), C); return true; } + else if (matInfo.getState() == MaterialState.ORE){ + if (sRadiation >= 1){ + Item temp; + Block tempBlock; + tempBlock = new BlockBaseModular(matInfo ,BlockTypes.ORE, Colour); + + temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation); + temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation); + temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, sRadiation); + temp = new BaseItemCrushedOre(matInfo); + } + } //Add A jillion Recipes - old code RecipeGen_AlloySmelter.generateRecipes(matInfo); @@ -146,9 +152,11 @@ public class MaterialGenerator { RecipeGen_ShapedCrafting.generateRecipes(matInfo); new RecipeGen_Recycling(matInfo); return true; - } catch (final Throwable t) + + } catch (final Throwable t) + { - Utils.LOG_INFO(""+matInfo.getLocalizedName()+" failed to generate."); + Logger.WARNING(""+matInfo.getLocalizedName()+" failed to generate."); return false; } } @@ -219,7 +227,7 @@ public class MaterialGenerator { RecipeGen_DustGeneration.generateRecipes(matInfo, true); new RecipeGen_Recycling(matInfo); } catch (final Throwable t){ - Utils.LOG_INFO(""+matInfo.getLocalizedName()+" failed to generate."); + Logger.WARNING(""+matInfo.getLocalizedName()+" failed to generate."); } } diff --git a/src/Java/gtPlusPlus/core/material/MaterialStack.java b/src/Java/gtPlusPlus/core/material/MaterialStack.java index e18d738b97..ad7af2052f 100644 --- a/src/Java/gtPlusPlus/core/material/MaterialStack.java +++ b/src/Java/gtPlusPlus/core/material/MaterialStack.java @@ -3,7 +3,9 @@ package gtPlusPlus.core.material; import java.math.BigDecimal; import java.math.RoundingMode; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraft.item.ItemStack; public class MaterialStack { @@ -51,6 +53,14 @@ public class MaterialStack { } public Material getStackMaterial(){ + if (this.stackMaterial == null){ + Logger.MATERIALS("Tried getStackMaterial, got an invalid material."); + Logger.MATERIALS(ReflectionUtils.getMethodName(0)); + Logger.MATERIALS(ReflectionUtils.getMethodName(1)); + Logger.MATERIALS(ReflectionUtils.getMethodName(2)); + Logger.MATERIALS(ReflectionUtils.getMethodName(3)); + return null; + } return this.stackMaterial; } diff --git a/src/Java/gtPlusPlus/core/material/ORES.java b/src/Java/gtPlusPlus/core/material/ORES.java new file mode 100644 index 0000000000..4057092a48 --- /dev/null +++ b/src/Java/gtPlusPlus/core/material/ORES.java @@ -0,0 +1,84 @@ +package gtPlusPlus.core.material; + +import gtPlusPlus.core.material.state.MaterialState; + +public final class ORES { + + public static final Material GEIKIELITE = new Material( + "Geikielite", //Material Name + MaterialState.ORE, //State + new short[]{187, 193, 204, 0}, //Material Colour + 0, //Radiation + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().MAGNESIUM, 1), + new MaterialStack(ELEMENT.getInstance().TITANIUM, 1), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 3) + }); + + public static final Material ZIMBABWEITE = new Material( + "Zimbabweite", //Material Name + MaterialState.ORE, //State + new short[]{193, 187, 131, 0}, //Material Colour + 0, //Radiation + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().SODIUM, 2), + new MaterialStack(ELEMENT.getInstance().POTASSIUM, 2), + new MaterialStack(ELEMENT.getInstance().LEAD, 1), + new MaterialStack(ELEMENT.getInstance().ARSENIC, 4), + new MaterialStack(ELEMENT.getInstance().NIOBIUM, 4), + new MaterialStack(ELEMENT.getInstance().TANTALUM, 4), + new MaterialStack(ELEMENT.getInstance().TITANIUM, 4), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 18) + }); + + public static final Material TITANITE = new Material( + "Titanite", //Material Name + MaterialState.ORE, //State + new short[]{184, 198, 105, 0}, //Material Colour + 0, //Radiation + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().CALCIUM, 2), + new MaterialStack(ELEMENT.getInstance().TITANIUM, 2), + new MaterialStack(ELEMENT.getInstance().SILICON, 2), + new MaterialStack(ELEMENT.getInstance().THORIUM, 1), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 10) + }); + + public static final Material ZIRCONILITE = new Material( + "Zirconolite", //Material Name + MaterialState.ORE, //State + new short[]{45, 26, 0, 0}, //Material Colour + 0, //Radiation + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().CALCIUM, 2), + new MaterialStack(ELEMENT.getInstance().ZIRCONIUM, 2), + new MaterialStack(ELEMENT.getInstance().TITANIUM, 4), + new MaterialStack(ELEMENT.getInstance().CERIUM, 1), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 14) + }); + + public static final Material CROCROITE = new Material( + "Crocoite", //Material Name + MaterialState.ORE, //State + new short[]{255, 143, 84, 0}, //Material Colour + 0, //Radiation + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().LEAD, 1), + new MaterialStack(ELEMENT.getInstance().CHROMIUM, 1), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 4) + }); + + public static final Material NICHROMITE = new Material( + "Nichromite", //Material Name + MaterialState.ORE, //State + new short[]{22, 19, 19, 0}, //Material Colour + 0, //Radiation + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().NICKEL, 1), + new MaterialStack(ELEMENT.getInstance().COBALT, 1), + new MaterialStack(ELEMENT.getInstance().IRON, 3), + new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 2), + new MaterialStack(ELEMENT.getInstance().CHROMIUM, 2), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 8) + }); +} diff --git a/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java b/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java index c6043a1b3d..5f83074a0d 100644 --- a/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java +++ b/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java @@ -19,6 +19,7 @@ public class FLUORIDES { ((ELEMENT.getInstance().CALCIUM.getProtons()+(ELEMENT.getInstance().FLUORINE.getProtons()*2))/3), //Protons ((ELEMENT.getInstance().CALCIUM.getNeutrons()+(ELEMENT.getInstance().FLUORINE.getNeutrons()*2))/3), //Neutrons false, //Uses Blast furnace? + false, //Generate cells //Material Stacks with Percentage of required elements. new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), diff --git a/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java b/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java index f6c7d952b8..ea21a1d270 100644 --- a/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java +++ b/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java @@ -13,18 +13,16 @@ public final class NUCLIDE { public static NUCLIDE getInstance(){return thisClass;} //Custom Isotopes - public final Material LITHIUM7 = new Material("Lithium 7", MaterialState.LIQUID, Materials.Lithium.mRGBa, Materials.Lithium.mMeltingPoint, Materials.Lithium.mBlastFurnaceTemp, Materials.Lithium.getProtons(), Materials.Lithium.getNeutrons(), Materials.Lithium.mBlastFurnaceRequired, StringUtils.superscript("7Li"), 0);//Not a GT Inherited Material + public final Material LITHIUM7 = new Material("Lithium 7", MaterialState.LIQUID, Materials.Lithium.mRGBa, Materials.Lithium.mMeltingPoint, Materials.Lithium.mBlastFurnaceTemp, Materials.Lithium.getProtons(), Materials.Lithium.getNeutrons(), Materials.Lithium.mBlastFurnaceRequired, StringUtils.superscript("7Li"), 0, false);//Not a GT Inherited Material public final Material URANIUM232 = new Material("Uranium 232", MaterialState.SOLID, new short[]{88, 220, 103, 0}, 1132, 4131, 92, 140, false, StringUtils.superscript("232U"), 4);//Not a GT Inherited Material public final Material URANIUM233 = new Material("Uranium 233", MaterialState.SOLID, new short[]{73, 220, 83, 0}, 1132, 4131, 92, 141, false, StringUtils.superscript("233U"), 2);//Not a GT Inherited Material - public final Material THORIUM232 = new Material("Thorium 232", MaterialState.SOLID, new short[]{15, 60, 15, 0}, Materials.Thorium.mMeltingPoint, Materials.Thorium.mBlastFurnaceTemp, 90, 142, false, StringUtils.superscript("232Th"), 1);//Not a GT Inherited Material + public final Material THORIUM232 = new Material("Thorium 232", MaterialState.SOLID, new short[]{15, 60, 15, 0}, Materials.Thorium.mMeltingPoint, Materials.Thorium.mBlastFurnaceTemp, 90, 142, false, StringUtils.superscript("232Th"), 1, false);//Not a GT Inherited Material //RTG Fuels - public final Material PLUTONIUM238 = new Material("Plutonium-238", MaterialState.SOLID, Materials.Plutonium241.mDurability, Materials.Plutonium241.mRGBa, Materials.Plutonium241.mMeltingPoint, Materials.Plutonium241.mBlastFurnaceTemp, 94, 144, false, StringUtils.superscript("238Pu"), 2);//Not a GT Inherited Material - public final Material STRONTIUM90 = new Material("Strontium-90", MaterialState.SOLID, Materials.Strontium.mDurability, Materials.Strontium.mRGBa, Materials.Strontium.mMeltingPoint, Materials.Strontium.mBlastFurnaceTemp, 38, 52, false, StringUtils.superscript("90Sr"), 2);//Not a GT Inherited Material - public final Material POLONIUM210 = new Material("Polonium-210", MaterialState.SOLID, ELEMENT.getInstance().POLONIUM.vDurability, ELEMENT.getInstance().POLONIUM.getRGBA(), ELEMENT.getInstance().POLONIUM.getMeltingPointK(), ELEMENT.getInstance().POLONIUM.getBoilingPointK(), 84, 126, false, StringUtils.superscript("210Po"), 2);//Not a GT Inherited Material - public final Material AMERICIUM241 = new Material("Americium-241", MaterialState.SOLID, Materials.Americium.mDurability, Materials.Americium.mRGBa, Materials.Americium.mMeltingPoint, Materials.Americium.mBlastFurnaceTemp, 95, 146, false, StringUtils.superscript("241Am"), 2);//Not a GT Inherited Material - - + public final Material PLUTONIUM238 = new Material("Plutonium-238", MaterialState.SOLID, Materials.Plutonium241.mDurability, Materials.Plutonium241.mRGBa, Materials.Plutonium241.mMeltingPoint, Materials.Plutonium241.mBlastFurnaceTemp, 94, 144, false, StringUtils.superscript("238Pu"), 2, false);//Not a GT Inherited Material + public final Material STRONTIUM90 = new Material("Strontium-90", MaterialState.SOLID, Materials.Strontium.mDurability, Materials.Strontium.mRGBa, Materials.Strontium.mMeltingPoint, Materials.Strontium.mBlastFurnaceTemp, 38, 52, false, StringUtils.superscript("90Sr"), 2, false);//Not a GT Inherited Material + public final Material POLONIUM210 = new Material("Polonium-210", MaterialState.SOLID, ELEMENT.getInstance().POLONIUM.vDurability, ELEMENT.getInstance().POLONIUM.getRGBA(), ELEMENT.getInstance().POLONIUM.getMeltingPointK(), ELEMENT.getInstance().POLONIUM.getBoilingPointK(), 84, 126, false, StringUtils.superscript("210Po"), 2, false);//Not a GT Inherited Material + public final Material AMERICIUM241 = new Material("Americium-241", MaterialState.SOLID, Materials.Americium.mDurability, Materials.Americium.mRGBa, Materials.Americium.mMeltingPoint, Materials.Americium.mBlastFurnaceTemp, 95, 146, false, StringUtils.superscript("241Am"), 2, false);//Not a GT Inherited Material public static final Material LiFBeF2ThF4UF4 = new Material( "LiFBeF2ThF4UF4", //Material Name diff --git a/src/Java/gtPlusPlus/core/material/state/MaterialState.java b/src/Java/gtPlusPlus/core/material/state/MaterialState.java index 88447395db..284e9582f1 100644 --- a/src/Java/gtPlusPlus/core/material/state/MaterialState.java +++ b/src/Java/gtPlusPlus/core/material/state/MaterialState.java @@ -5,7 +5,8 @@ public enum MaterialState { LIQUID(1), GAS(2), PLASMA(3), - PURE_LIQUID(4); + PURE_LIQUID(4), + ORE(5); private int STATE; private MaterialState (final int State){ this.STATE = State; diff --git a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java index 448188379a..712df63e67 100644 --- a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java +++ b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java @@ -12,6 +12,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.GTplusplus; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.client.renderer.*; import gtPlusPlus.core.common.CommonProxy; import gtPlusPlus.core.common.compat.COMPAT_PlayerAPI; @@ -25,7 +26,6 @@ import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE.ConfigSwitches; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.tileentities.general.TileEntityFirepit; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.particles.EntityParticleFXMysterious; import gtPlusPlus.xmod.gregtech.common.render.GTPP_CapeRenderer; import net.minecraft.client.Minecraft; @@ -37,9 +37,13 @@ public class ClientProxy extends CommonProxy implements Runnable{ private final HashSet<String> mCapeList = new HashSet<String>(); private final GTPP_CapeRenderer mCapeRenderer; + @SideOnly(Side.CLIENT) + public static boolean mFancyGraphics = false; public ClientProxy(){ mCapeRenderer = new GTPP_CapeRenderer(mCapeList); + //Get Graphics Mode. + mFancyGraphics = Minecraft.isFancyGraphicsEnabled(); } @SubscribeEvent @@ -85,18 +89,18 @@ public class ClientProxy extends CommonProxy implements Runnable{ //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 Custom Renderer for Mining Explosives."); + Logger.INFO("Registering Custom Renderer for Mining Explosives."); RenderingRegistry.registerEntityRenderingHandler(EntityPrimedMiningExplosive.class, new RenderMiningExplosivesPrimed()); RenderingRegistry.registerEntityRenderingHandler(EntitySickBlaze.class, new RenderSickBlaze()); RenderingRegistry.registerEntityRenderingHandler(EntityStaballoyConstruct.class, new RenderStaballoyConstruct()); RenderingRegistry.registerEntityRenderingHandler(EntityToxinballSmall.class, new RenderToxinball(1F)); - Utils.LOG_INFO("Registering Custom Renderer for Sulfuric potion."); + Logger.INFO("Registering Custom Renderer for Sulfuric potion."); RenderingRegistry.registerEntityRenderingHandler(EntitySulfuricAcidPotion.class, new RenderSnowball(ModItems.itemSulfuricPotion)); //ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBloodSteelChest.class, new BloodSteelChestRenderer()); //MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.tutChest), new ItemRenderBloodSteelChest()); - Utils.LOG_INFO("Registering Custom Renderer for the Fire Pit."); + Logger.INFO("Registering Custom Renderer for the Fire Pit."); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFirepit.class, new FirepitRender()); } @@ -166,10 +170,11 @@ public class ClientProxy extends CommonProxy implements Runnable{ } } + @Override public void run() { try { if (ConfigSwitches.enableCustomCapes){ - Utils.LOG_INFO("GT++ Mod: Downloading Cape List."); + Logger.INFO("GT++ Mod: Downloading Cape List."); @SuppressWarnings("resource") Scanner tScanner = new Scanner(new URL("https://github.com/draknyte1/GTplusplus/blob/master/SupporterList.txt").openStream()); while (tScanner.hasNextLine()) { @@ -180,7 +185,7 @@ public class ClientProxy extends CommonProxy implements Runnable{ } } } catch (Throwable e) { - Utils.LOG_INFO("Failed to download GT++ cape list."); + Logger.INFO("Failed to download GT++ cape list."); } } diff --git a/src/Java/gtPlusPlus/core/recipe/Gregtech_Recipe_Adder.java b/src/Java/gtPlusPlus/core/recipe/Gregtech_Recipe_Adder.java index f9db59ddb4..62c17817b6 100644 --- a/src/Java/gtPlusPlus/core/recipe/Gregtech_Recipe_Adder.java +++ b/src/Java/gtPlusPlus/core/recipe/Gregtech_Recipe_Adder.java @@ -2,7 +2,7 @@ package gtPlusPlus.core.recipe; import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -79,7 +79,7 @@ public class Gregtech_Recipe_Adder { } private static void addBlastFurnaceRecipe(final ItemStack input1, final ItemStack input2, final ItemStack output1, final ItemStack output2, final int tempRequired){ - Utils.LOG_INFO("Registering Blast Furnace Recipes."); + Logger.INFO("Registering Blast Furnace Recipes."); GT_Values.RA.addBlastRecipe( input1, input2, diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index de1812d05a..a9d2bcef32 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -11,6 +11,7 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gregtech.api.util.HotFuel; import gregtech.api.util.ThermalFuel; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE; @@ -18,7 +19,6 @@ import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.material.nuclear.NUCLIDE; import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; @@ -33,7 +33,7 @@ import net.minecraftforge.fluids.FluidStack; public class RECIPES_GREGTECH { public static void run(){ - Utils.LOG_INFO("Loading Recipes through GregAPI for Industrial Multiblocks."); + Logger.INFO("Loading Recipes through GregAPI for Industrial Multiblocks."); execute(); } @@ -380,7 +380,7 @@ public class RECIPES_GREGTECH { } private static void cokeOvenRecipes(){ - Utils.LOG_INFO("Loading Recipes for Industrial Coking Oven."); + Logger.INFO("Loading Recipes for Industrial Coking Oven."); //Wood to Charcoal AddGregtechRecipe.addCokeAndPyrolyseRecipes( @@ -417,7 +417,7 @@ public class RECIPES_GREGTECH { } private static void matterFabRecipes(){ - Utils.LOG_INFO("Loading Recipes for Matter Fabricator."); + Logger.INFO("Loading Recipes for Matter Fabricator."); try { @@ -426,7 +426,7 @@ public class RECIPES_GREGTECH { Materials.UUMatter.getFluid(1L), //Fluid Output 800, //Time in ticks 32); //EU - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} try { CORE.RA.addMatterFabricatorRecipe( @@ -434,12 +434,12 @@ public class RECIPES_GREGTECH { Materials.UUMatter.getFluid(1L), //Fluid Output 3200, //Time in ticks 32); //EU - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} } private static void dehydratorRecipes(){ - Utils.LOG_INFO("Loading Recipes for Chemical Dehydrator."); + Logger.INFO("Loading Recipes for Chemical Dehydrator."); try { //Makes Lithium Carbonate @@ -456,7 +456,7 @@ public class RECIPES_GREGTECH { }, //Output Array of Items - Upto 9 30*20, //Time in ticks 30); //EU - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} try { ItemStack cells = ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:itemCellEmpty", "Empty Fluid Cells", 0, 12); @@ -482,7 +482,7 @@ public class RECIPES_GREGTECH { 75*20, //Time in ticks 1000); //EU - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} try { CORE.RA.addDehydratorRecipe( @@ -499,7 +499,7 @@ public class RECIPES_GREGTECH { 150*20, //Time in ticks 2000); //EU - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} try { CORE.RA.addDehydratorRecipe( @@ -516,7 +516,7 @@ public class RECIPES_GREGTECH { 300*20, //Time in ticks 4000); //EU - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} //Raisins from Grapes try { @@ -534,7 +534,7 @@ public class RECIPES_GREGTECH { 10*20, //Time in ticks 8); //EU - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} //Calcium Hydroxide if ((ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 1).getItem() != ModItems.AAA_Broken) || LoadedMods.IHL){ @@ -553,7 +553,7 @@ public class RECIPES_GREGTECH { 120*20, //Time in ticks 120); //EU - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} //2 LiOH + CaCO3 try { @@ -572,7 +572,7 @@ public class RECIPES_GREGTECH { 120*20, //Time in ticks 1000); //EU - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} //LiOH Liquid to Dust try { @@ -590,7 +590,7 @@ public class RECIPES_GREGTECH { 1*20, //Time in ticks 64); //EU - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} //Zirconium Chloride -> TetraFluoride try { @@ -610,7 +610,7 @@ public class RECIPES_GREGTECH { 120*20, //Time in ticks 500); //EU - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} //CaF2 + H2SO4 → CaSO4(solid) + 2 HF try { @@ -634,7 +634,7 @@ public class RECIPES_GREGTECH { 10*60*20, //Time in ticks 230); //EU - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} //Be(OH)2 + 2 (NH4)HF2 → (NH4)2BeF4 + 2 H2O try { @@ -654,7 +654,7 @@ public class RECIPES_GREGTECH { 64); //EU - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} //(NH4)2BeF4 → 2 NH3 + 2 HF + BeF2 try { @@ -673,7 +673,7 @@ public class RECIPES_GREGTECH { 5*60*20, //Time in ticks 120); //EU - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} } @@ -682,7 +682,7 @@ public class RECIPES_GREGTECH { private static void lftrRecipes(){ try { - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} try { //Fli2BeF4 + Thorium TetraFluoride = Uranium233 CORE.RA.addLFTRRecipe( @@ -692,7 +692,7 @@ public class RECIPES_GREGTECH { 300*60*20, //Time in ticks 3500); //EU - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} try { //Fli2BeF4 + Uranium235 = 1x Uranium233 CORE.RA.addLFTRRecipe( @@ -701,7 +701,7 @@ public class RECIPES_GREGTECH { FluidUtils.getFluidStack("molten.uraniumhexafluoride", 3*144), //Output Array of Items - Upto 9, 120*60*20, //Time in ticks 8000); //EU - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} try { //Fli2BeF4 + Uranium233 TetraFluoride = Uranium233 CORE.RA.addLFTRRecipe( @@ -711,7 +711,7 @@ public class RECIPES_GREGTECH { 420*60*20, //Time in ticks 4000); //EU - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} } private static void fissionFuelRecipes(){ @@ -768,7 +768,7 @@ public class RECIPES_GREGTECH { 60*60*20, //Duration 500); - }catch (final NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + }catch (final NullPointerException e){Logger.INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} } private static void assemblerRecipes(){ @@ -790,7 +790,7 @@ public class RECIPES_GREGTECH { } private static void distilleryRecipes(){ - Utils.LOG_INFO("Registering Distillery/Distillation Tower Recipes."); + Logger.INFO("Registering Distillery/Distillation Tower Recipes."); GT_Values.RA.addDistilleryRecipe(ItemList.Circuit_Integrated.getWithDamage(0L, 4L, new Object[0]), FluidUtils.getFluidStack("air", 1000), FluidUtils.getFluidStack("helium", 1), 400, 30, false); GT_Values.RA.addDistillationTowerRecipe(FluidUtils.getFluidStack("air", 20000), FluidUtils.getFluidStackArray("helium", 25), ItemUtils.getSimpleStack(ModItems.itemHydrogenBlob, 1), 200, 60); @@ -834,7 +834,7 @@ public class RECIPES_GREGTECH { } private static void addFuels(){ - Utils.LOG_INFO("Registering New Fuels."); + Logger.INFO("Registering New Fuels."); GT_Values.RA.addFuel(ItemUtils.simpleMetaStack("EnderIO:bucketFire_water", 0, 1), null, 120, 0); GT_Values.RA.addFuel(ItemUtils.simpleMetaStack("EnderIO:bucketRocket_fuel", 0, 1), null, 112, 0); GT_Values.RA.addFuel(ItemUtils.simpleMetaStack("EnderIO:bucketHootch", 0, 1), null, 36, 0); @@ -883,7 +883,7 @@ public class RECIPES_GREGTECH { } private static void extractorRecipes(){ - Utils.LOG_INFO("Registering Extractor Recipes."); + Logger.INFO("Registering Extractor Recipes."); GT_ModHandler.addExtractionRecipe(GregtechItemList.Battery_RE_EV_Sodium.get(1L, new Object[0]), ItemList.Battery_Hull_HV.get(4L, new Object[0])); GT_ModHandler.addExtractionRecipe(GregtechItemList.Battery_RE_EV_Cadmium.get(1L, new Object[0]), ItemList.Battery_Hull_HV.get(4L, new Object[0])); GT_ModHandler.addExtractionRecipe(GregtechItemList.Battery_RE_EV_Lithium.get(1L, new Object[0]), ItemList.Battery_Hull_HV.get(4L, new Object[0])); diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java index 16cef8bc27..9e9482932d 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java @@ -5,12 +5,12 @@ import static gtPlusPlus.core.util.item.ItemUtils.getSimpleStack; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.ItemList; import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator; @@ -98,7 +98,7 @@ public class RECIPES_General { "stickWood", "treeSapling", "stickWood", "stickWood", "dustBone", "stickWood", ItemUtils.getSimpleStack(BOP_Block_Registrator.sapling_Rainforest))){ - Utils.LOG_INFO("Added a recipe for Rainforest oak Saplings."); + Logger.INFO("Added a recipe for Rainforest oak Saplings."); } if (!CORE.GTNH) { @@ -110,7 +110,7 @@ public class RECIPES_General { ironBars, "frameGtWroughtIron", ironBars, ironBars, ironBars, ironBars, ItemUtils.getSimpleStack(ModBlocks.blockFishTrap))){ - Utils.LOG_INFO("Added a recipe for the Fish Trap."); + Logger.INFO("Added a recipe for the Fish Trap."); } } else { //Steel Bars @@ -121,7 +121,7 @@ public class RECIPES_General { steelBars, "frameGtWroughtIron", steelBars, steelBars, steelBars, steelBars, ItemUtils.getSimpleStack(ModBlocks.blockFishTrap))) { - Utils.LOG_INFO("Added a recipe for the Fish Trap."); + Logger.INFO("Added a recipe for the Fish Trap."); } } @@ -131,7 +131,7 @@ public class RECIPES_General { "gemFlawlessRuby", ItemList.Credit_Greg_Naquadah.get(1), "gemFlawlessSapphire", "gemExquisiteEmerald", "gemFlawlessEmerald", "gemExquisiteSapphire", ItemUtils.getSimpleStack(ModItems.itemAlkalusDisk))){ - Utils.LOG_INFO("Added a recipe for The Alkalus Disk."); + Logger.INFO("Added a recipe for The Alkalus Disk."); } final String fancyGems[] = new String[]{"gemExquisiteDiamond", "gemExquisiteEmerald", "gemExquisiteRuby", "gemExquisiteSapphire"}; diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_LaserEngraver.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_LaserEngraver.java index 4f5cfd74e6..889af1753d 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_LaserEngraver.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_LaserEngraver.java @@ -4,8 +4,8 @@ import gregtech.api.enums.*; import gregtech.api.interfaces.IOreRecipeRegistrator; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import net.minecraft.item.ItemStack; @@ -24,22 +24,22 @@ public class RECIPES_LaserEngraver implements IOreRecipeRegistrator { GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.YttriumBariumCuprate, 2L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Circuit_Parts_Wiring_IV.get(1L, new Object[0]), 64, 480); } else { - Utils.LOG_INFO("foilYttriumBariumCuprate does not exist within Gregtech, please report this issue to Blood-asp on github."); - Utils.LOG_INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); + Logger.INFO("foilYttriumBariumCuprate does not exist within Gregtech, please report this issue to Blood-asp on github."); + Logger.INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); } if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foilVanadiumGallium", 1) != null){ GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.VanadiumGallium, 2L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Circuit_Parts_Wiring_IV.get(1L, new Object[0]), 64, 480); } else { - Utils.LOG_INFO("foilVanadiumGallium does not exist within Gregtech, please report this issue to Blood-asp on github."); - Utils.LOG_INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); + Logger.INFO("foilVanadiumGallium does not exist within Gregtech, please report this issue to Blood-asp on github."); + Logger.INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); } if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foilNiobiumTitanium", 1) != null){ GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.NiobiumTitanium, 2L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Circuit_Parts_Wiring_IV.get(1L, new Object[0]), 64, 480); } else { - Utils.LOG_INFO("foilNiobiumTitanium does not exist within Gregtech, please report this issue to Blood-asp on github."); - Utils.LOG_INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); + Logger.INFO("foilNiobiumTitanium does not exist within Gregtech, please report this issue to Blood-asp on github."); + Logger.INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); } } @@ -50,8 +50,8 @@ public class RECIPES_LaserEngraver implements IOreRecipeRegistrator { GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Osmium, 2L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Circuit_Parts_Wiring_LuV.get(1L, new Object[0]), 64, 1024); } else { - Utils.LOG_INFO("foilOsmium does not exist within Gregtech, please report this issue to Blood-asp on github."); - Utils.LOG_INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); + Logger.INFO("foilOsmium does not exist within Gregtech, please report this issue to Blood-asp on github."); + Logger.INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); } } @@ -63,8 +63,8 @@ public class RECIPES_LaserEngraver implements IOreRecipeRegistrator { GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Naquadah, 2L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Circuit_Parts_Wiring_ZPM.get(1L, new Object[0]), 64, 2000); } else { - Utils.LOG_INFO("foilNaquadah does not exist within Gregtech, please report this issue to Blood-asp on github."); - Utils.LOG_INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); + Logger.INFO("foilNaquadah does not exist within Gregtech, please report this issue to Blood-asp on github."); + Logger.INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); } } } else if (aOreDictName.equals(OreDictNames.craftingLensWhite.toString())) { @@ -72,15 +72,15 @@ public class RECIPES_LaserEngraver implements IOreRecipeRegistrator { GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Lithium, 2L), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemUtils.getItemStackOfAmountFromOreDict("plateDoubleLithium7", 1), 4*60*20, 2000); } else { - Utils.LOG_INFO("plateLithium does not exist within Gregtech, please report this issue to Blood-asp on github."); - Utils.LOG_INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); + Logger.INFO("plateLithium does not exist within Gregtech, please report this issue to Blood-asp on github."); + Logger.INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); } if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustLithium", 1) != null){ GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Lithium, 3L), GT_Utility.copyAmount(0L, new Object[]{aStack}), ItemUtils.getItemStackOfAmountFromOreDict("dustLithium7", 1), 2*60*20, 2000); } else { - Utils.LOG_INFO("dustLithium does not exist within Gregtech, please report this issue to Blood-asp on github."); - Utils.LOG_INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); + Logger.INFO("dustLithium does not exist within Gregtech, please report this issue to Blood-asp on github."); + Logger.INFO("This material item can be re-enabled within the gregtech configuration files, If you wish to fix this yourself."); } } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_MTWRAPPER.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_MTWRAPPER.java index 8f7304588d..bf3bf2ac9a 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_MTWRAPPER.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_MTWRAPPER.java @@ -2,7 +2,7 @@ package gtPlusPlus.core.recipe; import java.util.ArrayList; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; import gtPlusPlus.core.util.wrapper.var; @@ -99,7 +99,7 @@ public class RECIPES_MTWRAPPER { k.getClass(); k.printStackTrace(); k.getLocalizedMessage(); - Utils.LOG_WARNING("@@@: Invalid Recipe detected for: "+((var) item_Output).getsanitizedName()); + Logger.WARNING("@@@: Invalid Recipe detected for: "+((var) item_Output).getsanitizedName()); MT_RECIPES_FAILED++; } } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java index 14921c645e..6f72c9c03b 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java @@ -2,9 +2,9 @@ package gtPlusPlus.core.recipe; import gregtech.api.enums.*; import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.recipe.RecipeUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; @@ -94,7 +94,7 @@ public class RECIPES_MachineComponents { public static String smallGearTier10 = "gearGtSmallNeutronium"; public static final void RECIPES_LOAD(){ - Utils.LOG_INFO("Loading Recipes for the Various Circuits and Machine components."); + Logger.INFO("Loading Recipes for the Various Circuits and Machine components."); if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ run(); } @@ -284,7 +284,7 @@ public class RECIPES_MachineComponents { onlyULVComponents(); - Utils.LOG_INFO("Done loading recipes for the Various machine components."); + Logger.INFO("Done loading recipes for the Various machine components."); } @@ -383,7 +383,7 @@ public class RECIPES_MachineComponents { private static void GregtechMachinePhase(){ if (CORE.ConfigSwitches.enableCustomCircuits && !CORE.GTNH){ - Utils.LOG_INFO("Adding Gregtech machine recipes for the circuits."); + Logger.INFO("Adding Gregtech machine recipes for the circuits."); GT_Values.RA.addFormingPressRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Silicon, 1L), GregtechItemList.Circuit_Parts_Wiring_IV.get(4L, new Object[0]), GregtechItemList.Circuit_Board_IV.get(1L, new Object[0]), 32, 256); GT_Values.RA.addFormingPressRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Silicon, 1L), GregtechItemList.Circuit_Parts_Wiring_LuV.get(4L, new Object[0]), GregtechItemList.Circuit_Board_LuV.get(1L, new Object[0]), 64, 512); GT_Values.RA.addFormingPressRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Silicon, 2L), GregtechItemList.Circuit_Parts_Wiring_ZPM.get(4L, new Object[0]), GregtechItemList.Circuit_Board_ZPM.get(1L, new Object[0]), 96, 1024); diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index f2f9135194..097802b32b 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -2,12 +2,12 @@ package gtPlusPlus.core.recipe; import gregtech.api.enums.*; import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; @@ -183,7 +183,7 @@ public class RECIPES_Machines { public static final void RECIPES_LOAD(){ run(); - Utils.LOG_INFO("Loading Recipes for the Various machine blocks."); + Logger.INFO("Loading Recipes for the Various machine blocks."); } private static void run(){ @@ -547,7 +547,7 @@ public class RECIPES_Machines { //Tiered Tanks if (CORE.ConfigSwitches.enableMachine_FluidTanks){ - Utils.LOG_WARNING("Is New Horizons Loaded? "+CORE.GTNH); + Logger.WARNING("Is New Horizons Loaded? "+CORE.GTNH); if (!CORE.GTNH){ RecipeUtils.addShapedGregtechRecipe( CI.component_Plate[1], CI.component_Plate[1], CI.component_Plate[1], @@ -1119,6 +1119,6 @@ public class RECIPES_Machines { } - Utils.LOG_INFO("Done loading recipes for the Various machine blocks."); + Logger.INFO("Done loading recipes for the Various machine blocks."); } } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java index 446f1a1414..e421fd2601 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Old_Circuits.java @@ -6,10 +6,10 @@ import gregtech.api.enums.*; import gregtech.api.interfaces.IOreRecipeRegistrator; import gregtech.api.util.*; import gregtech.common.GT_Proxy; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; @@ -23,7 +23,7 @@ public class RECIPES_Old_Circuits implements IOreRecipeRegistrator { @Override public void registerOre(final OrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, final String aModName, final ItemStack aStack) { if (aOreDictName.equals(OreDictNames.craftingLensRed.toString())) { - Utils.LOG_INFO("[Old Feature - Circuits] Adding recipes for old circuits. (Part 2)"); + Logger.INFO("[Old Feature - Circuits] Adding recipes for old circuits. (Part 2)"); GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Copper, 1L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Old_Circuit_Parts_Wiring_Basic.get(1L, new Object[0]), 64, 30); GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.AnnealedCopper, 1L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Old_Circuit_Parts_Wiring_Basic.get(1L, new Object[0]), 64, 30); GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Gold, 1L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Old_Circuit_Parts_Wiring_Advanced.get(1L, new Object[0]), 64, 120); @@ -32,20 +32,20 @@ public class RECIPES_Old_Circuits implements IOreRecipeRegistrator { } else if (aOreDictName.equals(OreDictNames.craftingLensGreen.toString())) { - Utils.LOG_INFO("[Old Feature - Circuits] Adding recipes for old circuits. (Part 3)"); + Logger.INFO("[Old Feature - Circuits] Adding recipes for old circuits. (Part 3)"); GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Olivine, 1L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Old_Circuit_Parts_Crystal_Chip_Elite.get(1L, new Object[0]), 256, 480); GT_Values.RA.addLaserEngraverRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Emerald, 1L), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Old_Circuit_Parts_Crystal_Chip_Elite.get(1L, new Object[0]), 256, 480); } else if (aOreDictName.equals(OreDictNames.craftingLensBlue.toString()) || aOreDictName.equals(OreDictNames.craftingLensCyan.toString()) || aOreDictName.equals(OreDictNames.craftingLensLightBlue.toString())) { - Utils.LOG_INFO("[Old Feature - Circuits] Adding recipes for old circuits. (Part 4)"); + Logger.INFO("[Old Feature - Circuits] Adding recipes for old circuits. (Part 4)"); GT_Values.RA.addLaserEngraverRecipe(ItemList.IC2_LapotronCrystal.getWildcard(1L, new Object[0]), GT_Utility.copyAmount(0L, new Object[]{aStack}), GregtechItemList.Old_Circuit_Parts_Crystal_Chip_Master.get(3L, new Object[0]), 256, 480); } } private static boolean addCircuitRecipes(){ - Utils.LOG_INFO("[Old Feature - Circuits] Adding recipes for old circuits. (Part 1)"); + Logger.INFO("[Old Feature - Circuits] Adding recipes for old circuits. (Part 1)"); GT_ModHandler.addShapelessCraftingRecipe(GregtechItemList.Old_Circuit_Primitive.get(1L, new Object[0]), new Object[]{GT_ModHandler.getIC2Item("casingadviron", 1L), OrePrefixes.wireGt01.get(Materials.RedAlloy), OrePrefixes.wireGt01.get(Materials.RedAlloy), OrePrefixes.wireGt01.get(Materials.Tin)}); GT_ModHandler.addCraftingRecipe(GregtechItemList.Old_Circuit_Basic.get(1L, new Object[0]), new Object[]{"WWW", "CPC", "WWW", 'C', OrePrefixes.circuit.get(Materials.Primitive), 'W', OreDictNames.craftingWireCopper, 'P', OrePrefixes.plate.get(Materials.Steel)}); GT_ModHandler.addCraftingRecipe(GregtechItemList.Old_Circuit_Basic.get(1L, new Object[0]), new Object[]{"WCW", "WPW", "WCW", 'C', OrePrefixes.circuit.get(Materials.Primitive), 'W', OreDictNames.craftingWireCopper, 'P', OrePrefixes.plate.get(Materials.Steel)}); @@ -101,7 +101,7 @@ public class RECIPES_Old_Circuits implements IOreRecipeRegistrator { } private static boolean removeNewCircuits(){ - Utils.LOG_INFO("[Old Feature - Circuits] Overriding .28+ circuit values in the GT5u Itemlist with values from GT++."); + Logger.INFO("[Old Feature - Circuits] Overriding .28+ circuit values in the GT5u Itemlist with values from GT++."); ItemList.Circuit_Primitive.set(GregtechItemList.Old_Circuit_Primitive.get(1)); ItemList.Circuit_Basic.set(GregtechItemList.Old_Circuit_Basic.get(1)); @@ -275,7 +275,7 @@ public class RECIPES_Old_Circuits implements IOreRecipeRegistrator { private static boolean hideCircuitsNEI(){ Boolean isNEILoaded = Loader.isModLoaded("NotEnoughItems"); if (isNEILoaded && !CORE.ConfigSwitches.showHiddenNEIItems){ - Utils.LOG_INFO("[Old Feature - Circuits] Hiding .28+ circuits in NEI."); + Logger.INFO("[Old Feature - Circuits] Hiding .28+ circuits in NEI."); String[] CircuitToHide = { "Circuit_Board_Basic", "Circuit_Board_Advanced", @@ -373,8 +373,8 @@ public class RECIPES_Old_Circuits implements IOreRecipeRegistrator { try { API.hideItem(ItemList.valueOf(component).get(1L, new Object[0])); } catch (IllegalArgumentException I){ - Utils.LOG_INFO("Could not find "+component+" in the Gregtech item list."); - Utils.LOG_INFO("This is NOT an error, simply a notification."); + Logger.INFO("Could not find "+component+" in the Gregtech item list."); + Logger.INFO("This is NOT an error, simply a notification."); } } } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Shapeless.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Shapeless.java index c1f88d91d0..55cc086121 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Shapeless.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Shapeless.java @@ -1,7 +1,7 @@ package gtPlusPlus.core.recipe; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.Utils; import net.minecraft.item.ItemStack; public class RECIPES_Shapeless { @@ -21,7 +21,7 @@ public class RECIPES_Shapeless { public static final void RECIPES_LOAD(){ //run(); - Utils.LOG_INFO("Loading Shapeless Recipes."); + Logger.INFO("Loading Shapeless Recipes."); } private static void run(){ diff --git a/src/Java/gtPlusPlus/core/recipe/ShapedRecipeObject.java b/src/Java/gtPlusPlus/core/recipe/ShapedRecipeObject.java index 9719416766..61c1f463fc 100644 --- a/src/Java/gtPlusPlus/core/recipe/ShapedRecipeObject.java +++ b/src/Java/gtPlusPlus/core/recipe/ShapedRecipeObject.java @@ -1,6 +1,6 @@ package gtPlusPlus.core.recipe; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.recipe.RecipeUtils; import net.minecraft.item.ItemStack; @@ -32,7 +32,7 @@ public class ShapedRecipeObject { this.object_H = input_H; this.object_I = input_I; this.object_OUTPUT = input_Output; - Utils.LOG_SPECIFIC_WARNING("ShapedRecipeObject", "New object created.", 36); + Logger.SPECIFIC_WARNING("ShapedRecipeObject", "New object created.", 36); } public void buildRecipe(){ diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java index 2d857ca25a..9159025922 100644 --- a/src/Java/gtPlusPlus/core/recipe/common/CI.java +++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java @@ -2,6 +2,7 @@ package gtPlusPlus.core.recipe.common; import gregtech.api.enums.*; import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.ALLOY; @@ -389,18 +390,18 @@ public class CI { if (material instanceof Materials){ //return (ItemStack) type.get(material); String materialName = ((Materials) material).mDefaultLocalName; - Utils.LOG_INFO("Searching for a component named "+type.name()+materialName); + Logger.INFO("Searching for a component named "+type.name()+materialName); //return ItemUtils.getItemStackOfAmountFromOreDict(type.name()+materialName, 1); return (type.name()+materialName); } else { String materialName = (Utils.sanitizeString(((Material) material).getLocalizedName())); - Utils.LOG_INFO("Searching for a component named "+type.name()+materialName); + Logger.INFO("Searching for a component named "+type.name()+materialName); //return ItemUtils.getItemStackOfAmountFromOreDict(type.name()+materialName, 1); return (type.name()+materialName); } } - Utils.LOG_INFO("[Components] Failed getting a tiered component. "+type.name()+" | "+tier); + Logger.INFO("[Components] Failed getting a tiered component. "+type.name()+" | "+tier); return null; } diff --git a/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java b/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java index 0b8235fcd8..603021237a 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java +++ b/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java @@ -1,7 +1,7 @@ package gtPlusPlus.core.slots; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.interfaces.IItemBlueprint; -import gtPlusPlus.core.util.Utils; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -15,10 +15,10 @@ public class SlotBlueprint extends Slot { @Override public boolean isItemValid(final ItemStack itemstack) { if (itemstack.getItem() instanceof IItemBlueprint) { - Utils.LOG_WARNING(itemstack.getDisplayName() + " is a valid Blueprint."); + Logger.WARNING(itemstack.getDisplayName() + " is a valid Blueprint."); return true; } - Utils.LOG_WARNING(itemstack.getDisplayName() + " is not a valid Blueprint."); + Logger.WARNING(itemstack.getDisplayName() + " is not a valid Blueprint."); return false; } diff --git a/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java b/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java index 3578eaedf1..af7c7c9c59 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java +++ b/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java @@ -31,25 +31,36 @@ public class SlotBuzzSaw extends Slot { if (OrePrefixes.craftingTool.contains(itemstack)) { if (itemstack.getDisplayName().toLowerCase().contains("saw") || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.10") + || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.110") + || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.112") + || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.114") || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.140")) { if (itemstack.getItemDamage() == 10) { isValid = true; this.currentTool = SAWTOOL.SAW; } - if (itemstack.getItemDamage() == 140) { + else if (itemstack.getItemDamage() == 110) { + isValid = true; + this.currentTool = SAWTOOL.CHAINSAW; + } + else if (itemstack.getItemDamage() == 112) { + isValid = true; + this.currentTool = SAWTOOL.CHAINSAW; + } + else if (itemstack.getItemDamage() == 114) { + isValid = true; + this.currentTool = SAWTOOL.CHAINSAW; + } + else if (itemstack.getItemDamage() == 140) { isValid = true; this.currentTool = SAWTOOL.BUZZSAW; } + return isValid; } - } else { - this.currentTool = SAWTOOL.NONE; - } - } else { - this.currentTool = SAWTOOL.NONE; - } - } else { - this.currentTool = SAWTOOL.NONE; - } + } + } + } + this.currentTool = SAWTOOL.NONE; return isValid; } @@ -59,7 +70,7 @@ public class SlotBuzzSaw extends Slot { } public enum SAWTOOL { - NONE, SAW, BUZZSAW + NONE, SAW, BUZZSAW, CHAINSAW } } diff --git a/src/Java/gtPlusPlus/core/slots/SlotCraftingNoCollect.java b/src/Java/gtPlusPlus/core/slots/SlotCraftingNoCollect.java index 879ba87a0b..286eff9612 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotCraftingNoCollect.java +++ b/src/Java/gtPlusPlus/core/slots/SlotCraftingNoCollect.java @@ -5,11 +5,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemHoe; -import net.minecraft.item.ItemPickaxe; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemSword; +import net.minecraft.item.*; import net.minecraft.stats.AchievementList; public class SlotCraftingNoCollect extends SlotCrafting { @@ -34,6 +30,7 @@ public class SlotCraftingNoCollect extends SlotCrafting { * Check if the stack is a valid item for this slot. Always true beside for * the armor slots. */ + @Override public boolean isItemValid(ItemStack p_75214_1_) { return false; } @@ -42,6 +39,7 @@ public class SlotCraftingNoCollect extends SlotCrafting { * Decrease the size of the stack in slot (first int arg) by the amount of * the second int arg. Returns the new stack. */ + @Override public ItemStack decrStackSize(int amount) { if (this.getHasStack()) { this.amountCrafted += Math.min(amount, this.getStack().stackSize); @@ -55,6 +53,7 @@ public class SlotCraftingNoCollect extends SlotCrafting { * not ore and wood. Typically increases an internal count then calls * onCrafting(item). */ + @Override protected void onCrafting(ItemStack output, int amount) { this.amountCrafted += amount; this.onCrafting(output); @@ -64,6 +63,7 @@ public class SlotCraftingNoCollect extends SlotCrafting { * the itemStack passed in is the output - ie, iron ingots, and pickaxes, * not ore and wood. */ + @Override protected void onCrafting(ItemStack output) { output.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted); this.amountCrafted = 0; @@ -110,6 +110,7 @@ public class SlotCraftingNoCollect extends SlotCrafting { } } + @Override public void onPickupFromSlot(EntityPlayer player, ItemStack output) { FMLCommonHandler.instance().firePlayerCraftingEvent(player, output, craftMatrix); this.onCrafting(output); diff --git a/src/Java/gtPlusPlus/core/slots/SlotGtTool.java b/src/Java/gtPlusPlus/core/slots/SlotGtTool.java index cfa501eb1e..e70ae728c9 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotGtTool.java +++ b/src/Java/gtPlusPlus/core/slots/SlotGtTool.java @@ -1,7 +1,7 @@ package gtPlusPlus.core.slots; import gregtech.api.items.GT_MetaGenerated_Tool; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -16,10 +16,10 @@ public class SlotGtTool extends Slot { @Override public boolean isItemValid(final ItemStack itemstack) { if (itemstack.getItem() instanceof GT_MetaGenerated_Tool) { - Utils.LOG_WARNING(itemstack.getDisplayName() + " is a valid Tool."); + Logger.WARNING(itemstack.getDisplayName() + " is a valid Tool."); return true; } - Utils.LOG_WARNING(itemstack.getDisplayName() + " is not a valid Tool."); + Logger.WARNING(itemstack.getDisplayName() + " is not a valid Tool."); return false; } diff --git a/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java b/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java index 7fab32903a..1e488a0e46 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java +++ b/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java @@ -1,7 +1,7 @@ package gtPlusPlus.core.slots; import gregtech.api.items.GT_MetaGenerated_Tool; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import ic2.api.info.Info; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; @@ -82,10 +82,10 @@ public class SlotGtToolElectric extends SlotGtTool { @Override public boolean isItemValid(final ItemStack itemstack) { if ((itemstack.getItem() instanceof GT_MetaGenerated_Tool) || (itemstack.getItem() instanceof IElectricItem)) { - Utils.LOG_WARNING(itemstack.getDisplayName() + " is a valid Tool."); + Logger.WARNING(itemstack.getDisplayName() + " is a valid Tool."); return true; } - Utils.LOG_WARNING(itemstack.getDisplayName() + " is not a valid Tool."); + Logger.WARNING(itemstack.getDisplayName() + " is not a valid Tool."); return false; } diff --git a/src/Java/gtPlusPlus/core/slots/SlotModularBaubleUpgrades.java b/src/Java/gtPlusPlus/core/slots/SlotModularBaubleUpgrades.java index 4716701e16..85de0df60e 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotModularBaubleUpgrades.java +++ b/src/Java/gtPlusPlus/core/slots/SlotModularBaubleUpgrades.java @@ -6,7 +6,7 @@ import static gtPlusPlus.core.tileentities.machines.TileEntityModularityTable.mV import java.util.Iterator; import java.util.Map.Entry; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.array.Pair; import gtPlusPlus.core.util.nbt.ModularArmourUtils.BT; import gtPlusPlus.core.util.nbt.ModularArmourUtils.Modifiers; @@ -25,8 +25,8 @@ public class SlotModularBaubleUpgrades extends Slot { public boolean isItemValid(final ItemStack itemstack) { boolean isValid = false; if (itemstack != null) { - Utils.LOG_INFO("trying to insert " + itemstack.getDisplayName()); - Utils.LOG_INFO("Valid Upgrade count: " + mValidUpgradeList.size()); + Logger.INFO("trying to insert " + itemstack.getDisplayName()); + Logger.INFO("Valid Upgrade count: " + mValidUpgradeList.size()); Iterator<Entry<ItemStack, BT>> it = mValidUpgradeListFormChange.entrySet().iterator(); while (it.hasNext()) { diff --git a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java index 3d3dc66f20..a45e2218b8 100644 --- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java +++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java @@ -1,6 +1,7 @@ package gtPlusPlus.core.tileentities; import cpw.mods.fml.common.registry.GameRegistry; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.tileentities.general.TileEntityFirepit; import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; @@ -12,13 +13,12 @@ import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.thaumcraft.common.tile.TCTileEntities; public class ModTileEntities { public static void init() { - Utils.LOG_INFO("Registering Tile Entities."); + Logger.INFO("Registering Tile Entities."); GameRegistry.registerTileEntity(TileEntityHeliumGenerator.class, "HeliumGenerator"); GameRegistry.registerTileEntity(TileEntityWorkbench.class, "TileWorkbench"); GameRegistry.registerTileEntity(TileEntityWorkbenchAdvanced.class, "TileWorkbenchAdvanced"); diff --git a/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java b/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java index 9acb5ae396..81dfb1acf4 100644 --- a/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java +++ b/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java @@ -2,7 +2,7 @@ package gtPlusPlus.core.tileentities.base; import java.util.UUID; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; @@ -60,7 +60,7 @@ public abstract class TileEntityBase extends TileEntity implements ISidedInvento onPreTick(); } } catch (Throwable t){ - Utils.LOG_ERROR("Tile Entity Encountered an error in it's pre-tick stage."); + Logger.ERROR("Tile Entity Encountered an error in it's pre-tick stage."); t.printStackTrace(); } try{ @@ -68,7 +68,7 @@ public abstract class TileEntityBase extends TileEntity implements ISidedInvento onTick(); } } catch (Throwable t){ - Utils.LOG_ERROR("Tile Entity Encountered an error in it's tick stage."); + Logger.ERROR("Tile Entity Encountered an error in it's tick stage."); t.printStackTrace(); } try{ @@ -76,7 +76,7 @@ public abstract class TileEntityBase extends TileEntity implements ISidedInvento onPostTick(); } } catch (Throwable t){ - Utils.LOG_ERROR("Tile Entity Encountered an error in it's post-tick stage."); + Logger.ERROR("Tile Entity Encountered an error in it's post-tick stage."); t.printStackTrace(); } } @@ -92,7 +92,7 @@ public abstract class TileEntityBase extends TileEntity implements ISidedInvento processRecipe(); } } catch (Throwable t){ - Utils.LOG_ERROR("Tile Entity Encountered an error in it's processing of a recipe stage."); + Logger.ERROR("Tile Entity Encountered an error in it's processing of a recipe stage."); t.printStackTrace(); } return true; diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java index d73de219e4..fea313917d 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java @@ -3,10 +3,10 @@ package gtPlusPlus.core.tileentities.general; import java.util.Random; import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.inventories.InventoryFishTrap; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import net.minecraft.block.Block; @@ -81,8 +81,8 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { return true; } else if ((waterCount >= 2) && (trapCount > 4)) { - Utils.LOG_WARNING("Too many fish traps surrounding this one."); - Utils.LOG_WARNING("Not adding Loot to the fishtrap at x[" + this.locationX + "] y[" + this.locationY + Logger.WARNING("Too many fish traps surrounding this one."); + Logger.WARNING("Not adding Loot to the fishtrap at x[" + this.locationX + "] y[" + this.locationY + "] z[" + this.locationZ + "] (Ticking for loot every " + this.baseTickRate + " ticks)"); } } @@ -187,7 +187,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { loot = ItemUtils.getSimpleStack(Blocks.diamond_ore); } loot.stackSize=1; - Utils.LOG_WARNING("Adding x"+loot.stackSize+" "+loot.getDisplayName()+"."); + Logger.WARNING("Adding x"+loot.stackSize+" "+loot.getDisplayName()+"."); return loot; } @@ -221,8 +221,8 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { this.markDirty(); } else { - Utils.LOG_WARNING("This Trap does not have enough water around it."); - Utils.LOG_WARNING("Not adding Loot to the fishtrap at x[" + this.locationX + "] y[" + this.locationY + Logger.WARNING("This Trap does not have enough water around it."); + Logger.WARNING("Not adding Loot to the fishtrap at x[" + this.locationX + "] y[" + this.locationY + "] z[" + this.locationZ + "] (Ticking for loot every " + this.baseTickRate + " ticks)"); this.markDirty(); } diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityInfiniteFluid.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityInfiniteFluid.java index 3b50fe4dea..329bbd73b8 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityInfiniteFluid.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityInfiniteFluid.java @@ -6,12 +6,7 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidEvent; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTank; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; +import net.minecraftforge.fluids.*; public class TileEntityInfiniteFluid extends TileEntity implements IFluidHandler { @@ -22,16 +17,19 @@ public class TileEntityInfiniteFluid extends TileEntity implements IFluidHandler public TileEntityInfiniteFluid() { } + @Override public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { needsUpdate = true; return this.tank.fill(resource, doFill); } + @Override public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { needsUpdate = true; return this.tank.drain(resource.amount, doDrain); } + @Override public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { needsUpdate = true; FluidStack fluid = this.tank.getFluid(); @@ -60,14 +58,17 @@ public class TileEntityInfiniteFluid extends TileEntity implements IFluidHandler return stack; } + @Override public boolean canFill(ForgeDirection from, Fluid fluid) { return true; } + @Override public boolean canDrain(ForgeDirection from, Fluid fluid) { return true; } + @Override public FluidTankInfo[] getTankInfo(ForgeDirection from) { return new FluidTankInfo[] { this.tank.getInfo() }; } @@ -80,6 +81,7 @@ public class TileEntityInfiniteFluid extends TileEntity implements IFluidHandler return volume; } + @Override public void updateEntity() { if (this.tank.getFluid() != null){ diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java index b886299afd..d94f4704d9 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java @@ -2,7 +2,7 @@ package gtPlusPlus.core.tileentities.general; import org.lwjgl.input.Keyboard; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.enchanting.EnchantingUtils; import gtPlusPlus.core.util.player.PlayerUtils; import net.minecraft.entity.player.EntityPlayer; @@ -54,26 +54,26 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { @Override public int fill(final ForgeDirection from, final FluidStack resource, final boolean doFill) { this.needsUpdate = true; - Utils.LOG_WARNING("Ticking. | mConvertToEssence: "+this.mConvertToEssence); + Logger.WARNING("Ticking. | mConvertToEssence: "+this.mConvertToEssence); if (this.mConvertToEssence){ if (resource.isFluidEqual(EnchantingUtils.getLiquidXP(1))){ - Utils.LOG_WARNING("fill(tankLiquidXp)"); + Logger.WARNING("fill(tankLiquidXp)"); return this.tankLiquidXp.fill(resource, doFill); } else { - Utils.LOG_WARNING("Looking for Liquid Xp, Instead found "+resource.getLocalizedName()+"."); + Logger.WARNING("Looking for Liquid Xp, Instead found "+resource.getLocalizedName()+"."); } } else { if (resource.isFluidEqual(EnchantingUtils.getMobEssence(1))){ - Utils.LOG_WARNING("fill(tankEssence)"); + Logger.WARNING("fill(tankEssence)"); return this.tankEssence.fill(resource, doFill); } else { - Utils.LOG_WARNING("Looking for Essence, Instead found "+resource.getLocalizedName()+"."); + Logger.WARNING("Looking for Essence, Instead found "+resource.getLocalizedName()+"."); } } - Utils.LOG_WARNING("fill(0)"); + Logger.WARNING("fill(0)"); return 0; } @@ -82,24 +82,24 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { this.needsUpdate = true; if (this.mConvertToEssence){ if (resource.isFluidEqual(EnchantingUtils.getMobEssence(1))){ - Utils.LOG_WARNING("drain(mConvertToEssence)"); + Logger.WARNING("drain(mConvertToEssence)"); return this.tankEssence.drain(resource.amount, doDrain); } } else { if (resource.isFluidEqual(EnchantingUtils.getLiquidXP(1))){ - Utils.LOG_WARNING("drain(tankLiquidXp)"); + Logger.WARNING("drain(tankLiquidXp)"); return this.tankLiquidXp.drain(resource.amount, doDrain); } } - Utils.LOG_WARNING("drain(null)"); + Logger.WARNING("drain(null)"); return null; } @Override public FluidStack drain(final ForgeDirection from, final int maxDrain, final boolean doDrain) { this.needsUpdate = true; - Utils.LOG_WARNING("drain(Ex)"); + Logger.WARNING("drain(Ex)"); final FluidStack fluid_Essence = this.tankEssence.getFluid(); final FluidStack fluid_Xp = this.tankLiquidXp.getFluid(); if ((fluid_Essence == null) && (fluid_Xp == null)) { @@ -144,7 +144,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { this.tankLiquidXp = tank; } - Utils.LOG_WARNING("drain(Ex2)"); + Logger.WARNING("drain(Ex2)"); return stack; } @@ -152,17 +152,17 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { public boolean canFill(final ForgeDirection from, final Fluid fluid) { if (this.mConvertToEssence){ if (this.tankEssence.getFluidAmount() < this.tankEssence.getCapacity()){ - Utils.LOG_WARNING("canFill(mConvertToEssence)"); + Logger.WARNING("canFill(mConvertToEssence)"); return true; } } else { if (this.tankLiquidXp.getFluidAmount() < this.tankLiquidXp.getCapacity()){ - Utils.LOG_WARNING("canFill(tankLiquidXp)"); + Logger.WARNING("canFill(tankLiquidXp)"); return true; } } - Utils.LOG_WARNING("canFill(false)"); + Logger.WARNING("canFill(false)"); return false; } @@ -178,7 +178,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { return true; } } - Utils.LOG_WARNING("canDrain(false)"); + Logger.WARNING("canDrain(false)"); return false; } @@ -193,7 +193,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { } public float getAdjustedVolume() { - Utils.LOG_WARNING("AdjustedVolume()"); + Logger.WARNING("AdjustedVolume()"); this.needsUpdate = true; final float amount = this.tankLiquidXp.getFluidAmount(); final float capacity = this.tankLiquidXp.getCapacity(); @@ -226,7 +226,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { this.tankEssence.fill(bigStorage, true); this.tankLiquidXp.drain(100, true); this.needsUpdate = true; - Utils.LOG_WARNING("B->A"); + Logger.WARNING("B->A"); } } else { @@ -236,7 +236,7 @@ public class TileEntityXpConverter extends TileEntity implements IFluidHandler { this.tankLiquidXp.fill(bigStorage, true); this.tankEssence.drain((int) rm, true); this.needsUpdate = true; - Utils.LOG_WARNING("A->B"); + Logger.WARNING("A->B"); } } } diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java index 9d466ccdba..252b92984e 100644 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java +++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java @@ -1,21 +1,15 @@ package gtPlusPlus.core.tileentities.machines; -import static gtPlusPlus.core.tileentities.machines.TileEntityModularityTable.mValidUpgradeList; -import static gtPlusPlus.core.tileentities.machines.TileEntityModularityTable.mValidUpgradeListFormChange; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; +import java.util.*; import java.util.Map.Entry; import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.container.Container_ModularityTable; import gtPlusPlus.core.inventories.modulartable.InventoryModularMain; import gtPlusPlus.core.inventories.modulartable.InventoryModularOutput; import gtPlusPlus.core.item.bauble.ModularBauble; import gtPlusPlus.core.tileentities.base.TileEntityBase; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.array.Pair; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.nbt.ModularArmourUtils; @@ -56,6 +50,7 @@ public class TileEntityModularityTable extends TileEntityBase implements ISidedI return this.mRecipeTimeRemaining; } + @Override @SuppressWarnings("static-method") public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { if (!nbt.hasKey(tag)) { @@ -331,7 +326,7 @@ public class TileEntityModularityTable extends TileEntityBase implements ISidedI @Override public boolean canInsertItem(int slot, ItemStack item, int side) { - Utils.LOG_INFO("Slot:"+slot+" | side? "+side); + Logger.INFO("Slot:"+slot+" | side? "+side); /*if (side == 1){ return this.inventoryOutputs.isItemValidForSlot(slot-9, item); @@ -346,17 +341,19 @@ public class TileEntityModularityTable extends TileEntityBase implements ISidedI @Override public boolean canExtractItem(int slot, ItemStack item, int side) { - Utils.LOG_INFO("Slot:"+slot+" | side? "+side); + Logger.INFO("Slot:"+slot+" | side? "+side); if (slot == 11 || slot <= 8){ return true; } return false; } + @Override public String getCustomName() { return this.customName; } + @Override public void setCustomName(String customName) { this.customName = customName; } diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java index d209688d99..d76b66b4cd 100644 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java +++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java @@ -5,12 +5,12 @@ import java.util.Vector; import gregtech.api.enums.ItemList; import gregtech.common.items.GT_MetaGenerated_Item_01; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.container.Container_ProjectTable; import gtPlusPlus.core.inventories.projecttable.InventoryProjectMain; import gtPlusPlus.core.inventories.projecttable.InventoryProjectOutput; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.item.bauble.ModularBauble; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.nbt.ModularArmourUtils; import gtPlusPlus.core.util.nbt.ModularArmourUtils.BT; @@ -139,7 +139,7 @@ public class TileEntityProjectTable extends TileEntity implements INetworkDataPr || (dataStick == GregtechItemList.Old_Tool_DataStick.get(1)) || (dataStick.getItem() instanceof MetaGeneratedGregtechItems && dataStick.getItemDamage() == 32208)){ - Utils.LOG_INFO("Found Data Stick and valid container."); + Logger.INFO("Found Data Stick and valid container."); ItemStack outputComponent = container.getOutputContent(); @@ -151,17 +151,17 @@ public class TileEntityProjectTable extends TileEntity implements INetworkDataPr NBTUtils.setBookTitle(newStick, "Encrypted Project Data"); NBTUtils.setBoolean(newStick, "mEncrypted", true); int slotm=0; - Utils.LOG_WARNING("Uploading to Data Stick."); + Logger.WARNING("Uploading to Data Stick."); for (ItemStack is : NBTUtils.readItemsFromNBT(newStick)){ if (is != null){ - Utils.LOG_WARNING("Uploaded "+is.getDisplayName()+" into memory slot "+slotm+"."); + Logger.WARNING("Uploaded "+is.getDisplayName()+" into memory slot "+slotm+"."); } else { - Utils.LOG_WARNING("Left memory slot "+slotm+" blank."); + Logger.WARNING("Left memory slot "+slotm+" blank."); } slotm++; } - Utils.LOG_WARNING("Encrypting Data Stick."); + Logger.WARNING("Encrypting Data Stick."); this.inventoryOutputs.setInventorySlotContents(1, newStick); this.inventoryOutputs.setInventorySlotContents(0, null); } @@ -170,12 +170,12 @@ public class TileEntityProjectTable extends TileEntity implements INetworkDataPr //Utils.LOG_INFO("Doing thing 1"); if (dataStick != null) if (dataStick.getItem() instanceof ModularBauble){ - Utils.LOG_INFO("Doing thing 2"); + Logger.INFO("Doing thing 2"); ItemStack tBauble = dataStick; dataStick = null; this.inventoryOutputs.setInventorySlotContents(0, dataStick); if (this.inventoryGrid != null){ - Utils.LOG_INFO("Doing things"); + Logger.INFO("Doing things"); ItemStack[] tStack = container.getInputComponents(); if (tStack != null){ //Utils.LOG_INFO(""+tStack.length); @@ -184,29 +184,29 @@ public class TileEntityProjectTable extends TileEntity implements INetworkDataPr ItemStack testStack; if ((testStack = container.inventoryGrid.getStackInSlot(i)) != null){ - Utils.LOG_INFO("FOUND: "+testStack.getDisplayName()); + Logger.INFO("FOUND: "+testStack.getDisplayName()); } if (tStack[i] != null){ - Utils.LOG_INFO("found "+tStack[i].getDisplayName()); + Logger.INFO("found "+tStack[i].getDisplayName()); try { if (tStack[i].getItem() == Items.feather){ ModularArmourUtils.setBaubleType(tBauble, BT.TYPE_BELT); - Utils.LOG_INFO("buffed Modular bauble"); + Logger.INFO("buffed Modular bauble"); tStack[i] = null; container.inventoryGrid.setInventorySlotContents(i, null); this.inventoryGrid.setInventorySlotContents(i, null); } if (tStack[i].getItem() == Items.bed){ ModularArmourUtils.setBaubleType(tBauble, BT.TYPE_RING); - Utils.LOG_INFO("buffed Modular bauble"); + Logger.INFO("buffed Modular bauble"); tStack[i] = null; container.inventoryGrid.setInventorySlotContents(i, null); this.inventoryGrid.setInventorySlotContents(i, null); } if (tStack[i].getItem() == Items.boat){ ModularArmourUtils.setBaubleType(tBauble, BT.TYPE_AMULET); - Utils.LOG_INFO("buffed Modular bauble"); + Logger.INFO("buffed Modular bauble"); tStack[i] = null; container.inventoryGrid.setInventorySlotContents(i, null); this.inventoryGrid.setInventorySlotContents(i, null); @@ -214,7 +214,7 @@ public class TileEntityProjectTable extends TileEntity implements INetworkDataPr if (tStack[i].getItem() == Items.egg){ ModularArmourUtils.setModifierLevel(tBauble, Modifiers.BOOST_HOLY, ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_HOLY)+1); - Utils.LOG_INFO("buffed Modular bauble"); + Logger.INFO("buffed Modular bauble"); tStack[i] = null; container.inventoryGrid.setInventorySlotContents(i, null); this.inventoryGrid.setInventorySlotContents(i, null); @@ -222,7 +222,7 @@ public class TileEntityProjectTable extends TileEntity implements INetworkDataPr if (tStack[i].getItem() == Items.baked_potato){ ModularArmourUtils.setModifierLevel(tBauble, Modifiers.BOOST_DEF, ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_DEF)+1); - Utils.LOG_INFO("buffed Modular bauble"); + Logger.INFO("buffed Modular bauble"); tStack[i] = null; container.inventoryGrid.setInventorySlotContents(i, null); this.inventoryGrid.setInventorySlotContents(i, null); @@ -230,7 +230,7 @@ public class TileEntityProjectTable extends TileEntity implements INetworkDataPr if (tStack[i].getItem() == Items.cooked_beef){ ModularArmourUtils.setModifierLevel(tBauble, Modifiers.BOOST_HP, ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_HP)+1); - Utils.LOG_INFO("buffed Modular bauble"); + Logger.INFO("buffed Modular bauble"); tStack[i] = null; container.inventoryGrid.setInventorySlotContents(i, null); this.inventoryGrid.setInventorySlotContents(i, null); @@ -238,25 +238,25 @@ public class TileEntityProjectTable extends TileEntity implements INetworkDataPr if (tStack[i] == ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01:17019", 17019, 1)){ ModularArmourUtils.setModifierLevel(tBauble, Modifiers.BOOST_DEF, ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_DEF)+1); - Utils.LOG_INFO("buffed Modular bauble"); + Logger.INFO("buffed Modular bauble"); tStack[i] = null; container.inventoryGrid.setInventorySlotContents(i, null); } if (tStack[i] == ItemList.Electric_Motor_LV.get(1)){ ModularArmourUtils.setModifierLevel(tBauble, Modifiers.BOOST_DAMAGE, ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_DAMAGE)+1); - Utils.LOG_INFO("buffed Modular bauble"); + Logger.INFO("buffed Modular bauble"); tStack[i] = null; container.inventoryGrid.setInventorySlotContents(i, null); } else if (tStack[i] == ItemList.Electric_Motor_MV.get(1)){ ModularArmourUtils.setModifierLevel(tBauble, Modifiers.BOOST_DAMAGE, ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_DAMAGE)+2); - Utils.LOG_INFO("buffed Modular bauble"); + Logger.INFO("buffed Modular bauble"); tStack[i] = null; container.inventoryGrid.setInventorySlotContents(i, null); } else if (tStack[i] == ItemList.Electric_Motor_HV.get(1)){ ModularArmourUtils.setModifierLevel(tBauble, Modifiers.BOOST_DAMAGE, ModularArmourUtils.getModifierLevel(tBauble, Modifiers.BOOST_DAMAGE)+3); - Utils.LOG_INFO("buffed Modular bauble"); + Logger.INFO("buffed Modular bauble"); tStack[i] = null; container.inventoryGrid.setInventorySlotContents(i, null); } @@ -266,7 +266,7 @@ public class TileEntityProjectTable extends TileEntity implements INetworkDataPr } } } - Utils.LOG_INFO("set new Modular bauble"); + Logger.INFO("set new Modular bauble"); this.inventoryOutputs.setInventorySlotContents(1, tBauble); } } diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index f8ae3e4cba..ab11dccd4e 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -16,12 +16,8 @@ import java.util.Timer; import java.util.TimerTask; 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 cpw.mods.fml.relauncher.FMLRelaunchLog; import gregtech.GT_Mod; import gregtech.api.enums.Materials; import gregtech.api.enums.TC_Aspects; @@ -30,10 +26,10 @@ import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; import gtPlusPlus.GTplusplus; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.proxy.ClientProxy; import gtPlusPlus.core.util.array.Pair; import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.core.util.item.ItemUtils; @@ -73,7 +69,7 @@ public class Utils { static class ShortTimerTask extends TimerTask { @Override public void run() { - Utils.LOG_WARNING("Timer expired."); + Logger.WARNING("Timer expired."); } } @@ -109,47 +105,47 @@ public class Utils { // Adds in Compat for older GT Versions which Misspell aspects. try { if (EnumUtils.isValidEnum(TC_Aspects.class, "COGNITIO")) { - Utils.LOG_WARNING("TC Aspect found - " + aspect); + Logger.WARNING("TC Aspect found - " + aspect); returnValue = new TC_AspectStack(TC_Aspects.valueOf("COGNITIO"), size); } else { - Utils.LOG_INFO("Fallback TC Aspect found - " + aspect + Logger.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 (final NoSuchFieldError r) { - Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); + Logger.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. try { if (EnumUtils.isValidEnum(TC_Aspects.class, "EXANIMUS")) { - Utils.LOG_WARNING("TC Aspect found - " + aspect); + Logger.WARNING("TC Aspect found - " + aspect); returnValue = new TC_AspectStack(TC_Aspects.valueOf("EXANIMUS"), size); } else { - Utils.LOG_INFO("Fallback TC Aspect found - " + aspect + Logger.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 (final NoSuchFieldError r) { - Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); + Logger.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. try { if (EnumUtils.isValidEnum(TC_Aspects.class, "PRAECANTATIO")) { - Utils.LOG_WARNING("TC Aspect found - " + aspect); + Logger.WARNING("TC Aspect found - " + aspect); returnValue = new TC_AspectStack(TC_Aspects.valueOf("PRAECANTATIO"), size); } else { - Utils.LOG_INFO("Fallback TC Aspect found - " + aspect + Logger.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 (final NoSuchFieldError r) { - Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); + Logger.INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); } } else { - Utils.LOG_WARNING("TC Aspect found - " + aspect); + Logger.WARNING("TC Aspect found - " + aspect); returnValue = new TC_AspectStack(TC_Aspects.valueOf(aspect), size); } @@ -175,73 +171,6 @@ public class Utils { || (target.getItemDamage() == input.getItemDamage()))); } - // Logging Functions - private static final Logger modLogger = makeLogger(); - - // Generate GT++ Logger - public static Logger makeLogger() { - final Logger gtPlusPlusLogger = LogManager.getLogger("GT++"); - return gtPlusPlusLogger; - } - - public static final Logger getLogger(){ - return modLogger; - } - - // 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(final String s) { - - boolean localPlayer = false; - try { - if (ClientProxy.playerName != null){ - if (ClientProxy.playerName.toLowerCase().contains("draknyte1")){ - localPlayer = true; - } - } - } - catch (final Throwable t){ - - } - - if (CORE.ConfigSwitches.MACHINE_INFO || localPlayer) { - final String name1 = gtPlusPlus.core.util.reflect.ReflectionUtils.getMethodName(2); - modLogger.info("Machine Info: " + s + " | " + name1); - } - } - - // Developer Comments - public static void LOG_WARNING(final String s) { - if (CORE.DEBUG) { - modLogger.warn(s); - } - } - - // Errors - public static void LOG_ERROR(final String s) { - if (CORE.DEBUG) { - modLogger.fatal(s); - } - } - - // Developer Logger - public static void LOG_SPECIFIC_WARNING(final String whatToLog, final String msg, final int line) { - // if (!CORE.DEBUG){ - FMLLog.warning("GT++ |" + line + "| " + whatToLog + " | " + msg); - // } - } - - // Non-Dev Comments - public static void LOG_ASM(final String s) { - FMLRelaunchLog.info("", s); - } - //Register an event to both busses. public static void registerEvent(Object o){ MinecraftForge.EVENT_BUS.register(o); @@ -293,7 +222,7 @@ public class Utils { if (!currentWorld.isRemote) { try { correctTool = currentBlock.getHarvestTool(0); - Utils.LOG_WARNING(correctTool); + Logger.WARNING(correctTool); } catch (final NullPointerException e) { @@ -434,8 +363,8 @@ public class Utils { // 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) + "."); + Logger.WARNING("Made " + temp + " - Hopefully it's not a mess."); + Logger.WARNING("It will decode into " + Integer.decode(temp) + "."); return Integer.decode(temp); } @@ -486,7 +415,7 @@ public class Utils { code = code + code + 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()); + Logger.WARNING("" + Integer.toHexString(0x1000000 | i).substring(1).toUpperCase()); } return hexColorMap; } @@ -517,7 +446,7 @@ public class Utils { public static Integer appenedHexNotationToInteger(final int hexAsStringOrInt) { final String hexChar = "0x"; String result; - Utils.LOG_WARNING(String.valueOf(hexAsStringOrInt)); + Logger.WARNING(String.valueOf(hexAsStringOrInt)); result = hexChar + String.valueOf(hexAsStringOrInt); return Integer.getInteger(result); } @@ -546,21 +475,21 @@ public class Utils { private static short cellID = 15; public static ItemStack createInternalNameAndFluidCell(final String s) { - Utils.LOG_WARNING("1"); + Logger.WARNING("1"); final InternalName yourName = EnumHelper.addEnum(InternalName.class, s, new Class[0], new Object[0]); - Utils.LOG_WARNING("2 " + yourName.name()); + Logger.WARNING("2 " + yourName.name()); final ItemCell item = (ItemCell) Ic2Items.cell.getItem(); - Utils.LOG_WARNING("3 " + item.getUnlocalizedName()); + Logger.WARNING("3 " + item.getUnlocalizedName()); try { - Utils.LOG_WARNING("4"); + Logger.WARNING("4"); final Class<? extends ItemCell> clz = item.getClass(); - Utils.LOG_WARNING("5 " + clz.getSimpleName()); + Logger.WARNING("5 " + clz.getSimpleName()); final Method methode = clz.getDeclaredMethod("addCell", int.class, InternalName.class, Block[].class); - Utils.LOG_WARNING("6 " + methode.getName()); + Logger.WARNING("6 " + methode.getName()); methode.setAccessible(true); - Utils.LOG_WARNING("7 " + methode.isAccessible()); + Logger.WARNING("7 " + methode.isAccessible()); final ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]); - Utils.LOG_WARNING("Successfully created " + temp.getDisplayName() + "s."); + Logger.WARNING("Successfully created " + temp.getDisplayName() + "s."); FluidContainerRegistry.registerFluidContainer(FluidUtils.getFluidStack(s.toLowerCase(), 1000), temp.copy(), Ic2Items.cell.copy()); ItemUtils.addItemToOreDictionary(temp.copy(), "cell" + s); @@ -572,21 +501,21 @@ public class Utils { } public static ItemStack createInternalNameAndFluidCellNoOreDict(final String s) { - Utils.LOG_WARNING("1"); + Logger.WARNING("1"); final InternalName yourName = EnumHelper.addEnum(InternalName.class, s, new Class[0], new Object[0]); - Utils.LOG_WARNING("2 " + yourName.name()); + Logger.WARNING("2 " + yourName.name()); final ItemCell item = (ItemCell) Ic2Items.cell.getItem(); - Utils.LOG_WARNING("3 " + item.getUnlocalizedName()); + Logger.WARNING("3 " + item.getUnlocalizedName()); try { - Utils.LOG_WARNING("4"); + Logger.WARNING("4"); final Class<? extends ItemCell> clz = item.getClass(); - Utils.LOG_WARNING("5 " + clz.getSimpleName()); + Logger.WARNING("5 " + clz.getSimpleName()); final Method methode = clz.getDeclaredMethod("addCell", int.class, InternalName.class, Block[].class); - Utils.LOG_WARNING("6 " + methode.getName()); + Logger.WARNING("6 " + methode.getName()); methode.setAccessible(true); - Utils.LOG_WARNING("7 " + methode.isAccessible()); + Logger.WARNING("7 " + methode.isAccessible()); final ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]); - Utils.LOG_WARNING("Successfully created " + temp.getDisplayName() + "s."); + Logger.WARNING("Successfully created " + temp.getDisplayName() + "s."); FluidContainerRegistry.registerFluidContainer(FluidUtils.getFluidStack(s.toLowerCase(), 1000), temp.copy(), Ic2Items.cell.copy()); // ItemUtils.addItemToOreDictionary(temp.copy(), "cell"+s); @@ -739,7 +668,7 @@ public class Utils { final float damage = material.vToolQuality; final int efficiency = material.vToolQuality; // int enchantability = material.mEnchantmentToolsLevel; - Utils.LOG_INFO("ToolMaterial stats for " + material.getLocalizedName() + " | harvestLevel:" + harvestLevel + Logger.INFO("ToolMaterial stats for " + material.getLocalizedName() + " | harvestLevel:" + harvestLevel + " | durability:" + durability + " | toolQuality:" + damage + " | toolSpeed:" + damage); final ToolMaterial temp = EnumHelper.addToolMaterial(name, harvestLevel, durability, efficiency, damage, 0); return temp; @@ -814,7 +743,7 @@ public class Utils { .append("'").toString()); NBTUtils.createIntegerTagCompound(rStack, "stats", "mMeta", vMeta); CORE.sBookList.put(aMapping, rStack); - Utils.LOG_INFO("Creating book: " + aTitle + " by " + aAuthor + ". Using Meta " + vMeta + "."); + Logger.INFO("Creating book: " + aTitle + " by " + aAuthor + ". Using Meta " + vMeta + "."); return GT_Utility.copy(new Object[] { rStack }); } diff --git a/src/Java/gtPlusPlus/core/util/array/AutoMap.java b/src/Java/gtPlusPlus/core/util/array/AutoMap.java new file mode 100644 index 0000000000..ea5e1dd25e --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/array/AutoMap.java @@ -0,0 +1,77 @@ +package gtPlusPlus.core.util.array; + +import java.io.Serializable; +import java.util.*; + +public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable { + + /** + * The Internal Map + */ + private Map<Integer, V> mInternalMap = new HashMap<Integer, V>(); + + /** + * The Internal ID + */ + private int mInternalID = 0; + private static final long serialVersionUID = 3771412318075131790L; + + @Override + public Iterator<V> iterator() { + return values().iterator(); + } + + public synchronized boolean setValue(V object){ + int mOriginalID = this.mInternalID; + put(object); + if (this.mInternalMap.get(mOriginalID).equals(object) || mOriginalID > this.mInternalID){ + return true; + } + else { + return false; + } + } + + public synchronized V put(V object){ + return set(object); + } + + public synchronized V set(V object){ + return mInternalMap.put(mInternalID++, object); + } + + public synchronized V get(int id){ + return mInternalMap.get(id); + } + + public synchronized Collection<V> values(){ + return mInternalMap.values(); + } + + public synchronized int size(){ + return mInternalMap.size(); + } + + public synchronized int hashcode(){ + return mInternalMap.hashCode(); + } + + public synchronized boolean containsKey(int key){ + return mInternalMap.containsKey(key); + } + + public synchronized boolean containsValue(V value){ + return mInternalMap.containsValue(value); + } + + public synchronized boolean isEmpty(){ + return mInternalMap.isEmpty(); + } + + public synchronized boolean clear(){ + this.mInternalID = 0; + this.mInternalMap.clear(); + return true; + } + +} diff --git a/src/Java/gtPlusPlus/core/util/array/Quad.java b/src/Java/gtPlusPlus/core/util/array/Quad.java new file mode 100644 index 0000000000..417c3b6ebc --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/array/Quad.java @@ -0,0 +1,33 @@ +package gtPlusPlus.core.util.array; + +public class Quad<K,V,C,R> { + + private final K key; + private final V value; + private final C value2; + private final R value3; + + public Quad(final K key, final V value, final C value2, final R value3){ + this.key = key; + this.value = value; + this.value2 = value2; + this.value3 = value3; + } + + final public K getKey(){ + return this.key; + } + + final public V getValue_1(){ + return this.value; + } + + final public C getValue_2(){ + return this.value2; + } + + final public R getValue_3(){ + return this.value3; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java index a35d2c26de..35c8f5caad 100644 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java +++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java @@ -5,9 +5,9 @@ import static net.minecraftforge.event.entity.player.PlayerInteractEvent.Action. import java.util.List; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.item.base.BaseItemGeneric; -import gtPlusPlus.core.util.Utils; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -29,7 +29,7 @@ public class DEBUG_ITEM_ShapeSpawner extends BaseItemGeneric{ public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player){ if (!world.isRemote){ - Utils.LOG_INFO("Constructing the shape for the "+"VACUUM FREEZER"); + Logger.INFO("Constructing the shape for the "+"VACUUM FREEZER"); final Thread thread = new Thread(new DEBUG_TimerThread(world, player)); thread.start(); } diff --git a/src/Java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java b/src/Java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java index a0690c9440..778809b486 100644 --- a/src/Java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java +++ b/src/Java/gtPlusPlus/core/util/debug/DEBUG_TimerThread.java @@ -2,7 +2,7 @@ package gtPlusPlus.core.util.debug; import java.util.concurrent.TimeUnit; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -28,9 +28,9 @@ public class DEBUG_TimerThread implements Runnable { final int stepX = Minecraft.getMinecraft().objectMouseOver.blockX; final int stepY = Minecraft.getMinecraft().objectMouseOver.blockY; final int stepZ = Minecraft.getMinecraft().objectMouseOver.blockZ; - Utils.LOG_INFO("Clicked on a Block @ "+"[X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"+" with xDir:"+xDir+" zDir:"+zDir); + Logger.INFO("Clicked on a Block @ "+"[X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"+" with xDir:"+xDir+" zDir:"+zDir); this.world.setBlock(stepX, stepY, stepZ, Blocks.bedrock,0,3); - Utils.LOG_INFO("Makng it Bedrock for future investment."); + Logger.INFO("Makng it Bedrock for future investment."); //for (int i = -1; i <= 1; i++) { //stepX = stepX+i; for (int i = stepX-1; i <= (stepX+1); i++){ @@ -44,12 +44,12 @@ public class DEBUG_TimerThread implements Runnable { //stepZ = stepZ+j; //for (int h = -1; h <= 1; h++) { //stepY = stepY+h; - Utils.LOG_INFO("Placing Block @ "+"[X:"+i+"][Y:"+h+"][Z:"+j+"]"+" with xDir:"+xDir+" zDir:"+zDir); + Logger.INFO("Placing Block @ "+"[X:"+i+"][Y:"+h+"][Z:"+j+"]"+" with xDir:"+xDir+" zDir:"+zDir); if ((h != 0) || ((((xDir + i) != 0) || ((zDir + j) != 0)) && ((i != 0) || (j != 0)))) { this.world.setBlock(i, h, j, Blocks.stone,0,3); } else { - Utils.LOG_INFO("Not even sure what this is for, but I got here."); + Logger.INFO("Not even sure what this is for, but I got here."); } try { TimeUnit.MILLISECONDS.sleep(500); diff --git a/src/Java/gtPlusPlus/core/util/enchanting/EnchantingUtils.java b/src/Java/gtPlusPlus/core/util/enchanting/EnchantingUtils.java index 76336d4298..288ca2e2cc 100644 --- a/src/Java/gtPlusPlus/core/util/enchanting/EnchantingUtils.java +++ b/src/Java/gtPlusPlus/core/util/enchanting/EnchantingUtils.java @@ -1,6 +1,6 @@ package gtPlusPlus.core.util.enchanting; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -78,7 +78,7 @@ public class EnchantingUtils { //Xp Fluids public static FluidStack getMobEssence(final int amount){ - Utils.LOG_WARNING("Trying to get a fluid stack of Mob Essence."); + Logger.WARNING("Trying to get a fluid stack of Mob Essence."); try { return FluidRegistry.getFluidStack("mobessence", amount).copy(); } @@ -89,7 +89,7 @@ public class EnchantingUtils { } public static FluidStack getLiquidXP(final int amount){ - Utils.LOG_WARNING("Trying to get a fluid stack of Liquid XP."); + Logger.WARNING("Trying to get a fluid stack of Liquid XP."); try { return FluidRegistry.getFluidStack("xpjuice", amount).copy(); } diff --git a/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java b/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java index 611c7fe897..444f35a46f 100644 --- a/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java +++ b/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java @@ -4,6 +4,7 @@ import gregtech.api.enums.Dyes; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.util.GT_LanguageManager; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.fluids.GenericFluid; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.item.base.cell.BaseItemCell; @@ -26,7 +27,7 @@ import net.minecraftforge.fluids.IFluidContainerItem; public class FluidUtils { public static FluidStack getFluidStack(final String fluidName, final int amount){ - Utils.LOG_WARNING("Trying to get a fluid stack of "+fluidName); + Logger.WARNING("Trying to get a fluid stack of "+fluidName); try { return FluidRegistry.getFluidStack(fluidName, amount).copy(); } @@ -37,7 +38,7 @@ public class FluidUtils { } public static FluidStack getFluidStack(final FluidStack vmoltenFluid, final int fluidAmount) { - Utils.LOG_WARNING("Trying to get a fluid stack of "+vmoltenFluid.getFluid().getName()); + Logger.WARNING("Trying to get a fluid stack of "+vmoltenFluid.getFluid().getName()); try { return FluidRegistry.getFluidStack(vmoltenFluid.getFluid().getName(), fluidAmount).copy(); } @@ -47,7 +48,7 @@ public class FluidUtils { } public static FluidStack getFluidStack(final Fluid vFluid, final int fluidAmount) { - Utils.LOG_WARNING("Trying to get a fluid stack of "+vFluid.getName()); + Logger.WARNING("Trying to get a fluid stack of "+vFluid.getName()); try { return FluidRegistry.getFluidStack(vFluid.getName(), fluidAmount).copy(); } @@ -57,7 +58,7 @@ public class FluidUtils { } public static FluidStack[] getFluidStackArray(final String fluidName, final int amount){ - Utils.LOG_WARNING("Trying to get a fluid stack of "+fluidName); + Logger.WARNING("Trying to get a fluid stack of "+fluidName); try { final FluidStack[] singleFluid = {FluidRegistry.getFluidStack(fluidName, amount)}; return singleFluid; @@ -69,7 +70,7 @@ public class FluidUtils { } public static FluidStack[] getFluidStackArray(final FluidStack fluidName, final int amount){ - Utils.LOG_WARNING("Trying to get a fluid stack of "+fluidName); + Logger.WARNING("Trying to get a fluid stack of "+fluidName); try { final FluidStack[] singleFluid = {FluidRegistry.getFluidStack(fluidName.getLocalizedName(), amount)}; return singleFluid; @@ -244,13 +245,13 @@ public class FluidUtils { if (aMaterial.getLocalizedName().toLowerCase().contains("clay") || (aMaterial.getComposites().size()>1) || aMaterial.getLocalizedName().toLowerCase().contains("wrought")){ return null; } - Utils.LOG_INFO("Generating a "+aMaterial.getLocalizedName()+" Plasma Cell"); + Logger.INFO("Generating a "+aMaterial.getLocalizedName()+" Plasma Cell"); if (aMaterial.vComponentCount != 1){ - Utils.LOG_INFO("Compound made from: "); + Logger.INFO("Compound made from: "); for (final MaterialStack x : aMaterial.getComposites()){ - Utils.LOG_INFO(x.getStackMaterial().getLocalizedName()); + Logger.INFO(x.getStackMaterial().getLocalizedName()); } - Utils.LOG_INFO("Material is a composite, not generating plasma."); + Logger.INFO("Material is a composite, not generating plasma."); return null; } @@ -410,7 +411,7 @@ public class FluidUtils { public final static Fluid generateFluid(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA){ if ((FluidUtils.getFluidStack("molten"+"."+unlocalizedName.toLowerCase(), 1) == null) && (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust"+Utils.sanitizeString(localizedName), 1) != null)){ - Utils.LOG_WARNING("Generating our own fluid."); + Logger.WARNING("Generating our own fluid."); //Generate a Cell if we need to if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){ @@ -439,7 +440,7 @@ public class FluidUtils { ); return gtFluid; } - Utils.LOG_INFO("FLUID GENERATION FAILED FOR "+localizedName); + Logger.INFO("FLUID GENERATION FAILED FOR "+localizedName); return null; } @@ -452,7 +453,7 @@ public class FluidUtils { dustStack = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust"+Utils.sanitizeString(localizedName), 1); } if ((FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1) == null)/* && ((dustStack != null) || (dustStack2 != null))*/){ - Utils.LOG_WARNING("Generating our own fluid."); + Logger.WARNING("Generating our own fluid."); //Generate a Cell if we need to if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){ @@ -494,14 +495,14 @@ public class FluidUtils { return gtFluid; } - Utils.LOG_INFO("FLUID GENERATION FAILED FOR "+localizedName); + Logger.INFO("FLUID GENERATION FAILED FOR "+localizedName); return null; } public final static Fluid generateFluidNoPrefix(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA){ Fluid gtFluid; if (FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1) == null){ - Utils.LOG_WARNING("Generating our own fluid."); + Logger.WARNING("Generating our own fluid."); gtFluid = FluidUtils.addGTFluidNoPrefix( unlocalizedName, localizedName, diff --git a/src/Java/gtPlusPlus/core/util/geo/GeoUtils.java b/src/Java/gtPlusPlus/core/util/geo/GeoUtils.java index e1dba3b22d..84528e0cd5 100644 --- a/src/Java/gtPlusPlus/core/util/geo/GeoUtils.java +++ b/src/Java/gtPlusPlus/core/util/geo/GeoUtils.java @@ -5,7 +5,7 @@ import java.net.*; import org.apache.http.client.utils.URIBuilder; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.networking.NetworkUtils; public class GeoUtils { @@ -19,7 +19,7 @@ public class GeoUtils { return "Offline."; } } catch (Throwable T){ - Utils.LOG_INFO("Failed to initialise GeoUtils."); + Logger.INFO("Failed to initialise GeoUtils."); return "Failed."; } } @@ -78,7 +78,7 @@ public class GeoUtils { return result; //Catch block for bad connection } catch (IOException e) { - Utils.LOG_INFO("Method 1 - Failed."); + Logger.INFO("Method 1 - Failed."); } //Secondary method @@ -87,19 +87,19 @@ public class GeoUtils { return r.replaceAll("(\\r|\\n)", ""); //Catch block for bad connection } catch (java.io.IOException e) { - Utils.LOG_INFO("Method 2 - Failed."); + Logger.INFO("Method 2 - Failed."); } } //Catch block for all the Bad URI/URL building catch (URISyntaxException | MalformedURLException e1) { if (e1 instanceof URISyntaxException){ - Utils.LOG_INFO("Bad URI Syntax for builder."); + Logger.INFO("Bad URI Syntax for builder."); } else { - Utils.LOG_INFO("Malformed URL."); + Logger.INFO("Malformed URL."); } - Utils.LOG_INFO("Country Check - Failed."); + Logger.INFO("Country Check - Failed."); } return "Error getting users Country. "+ipAddress; } diff --git a/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java b/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java index 8ba355d57f..9bc5ee804d 100644 --- a/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java +++ b/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java @@ -3,23 +3,23 @@ package gtPlusPlus.core.util.gregtech.recipehandlers; import java.lang.reflect.Method; import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import net.minecraft.item.ItemStack; public final class GregtechRecipe { public LibraryProxy ourProxy; public GregtechRecipe(){ - Utils.LOG_INFO("Initializing a recipe handler for different versions of Gregtech 5."); + Logger.INFO("Initializing a recipe handler for different versions of Gregtech 5."); try { if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ this.ourProxy = new LibProxy1(); - Utils.LOG_INFO("Selecting GT 5.7/5.8 Recipe Set"); + Logger.INFO("Selecting GT 5.7/5.8 Recipe Set"); } if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ this.ourProxy = new LibProxy2(); - Utils.LOG_INFO("Selecting GT 5.9 Recipe Set"); + Logger.INFO("Selecting GT 5.9 Recipe Set"); } } catch (final NoSuchMethodException e) { this.ourProxy = null; @@ -27,7 +27,7 @@ public final class GregtechRecipe { } public boolean addSmeltingAndAlloySmeltingRecipe(final ItemStack aInput, final ItemStack aOutput) { - Utils.LOG_WARNING("Adding a GT Furnace/Alloy Smelter Recipe"+"| Input:"+aInput.getDisplayName()+" | Output:"+aOutput.getDisplayName()+" |"); + Logger.WARNING("Adding a GT Furnace/Alloy Smelter Recipe"+"| Input:"+aInput.getDisplayName()+" | Output:"+aOutput.getDisplayName()+" |"); return this.ourProxy.addSmeltingAndAlloySmeltingRecipe(aInput, aOutput); } @@ -47,7 +47,7 @@ class LibProxy1 extends LibraryProxy { @Override public boolean addSmeltingAndAlloySmeltingRecipe(final ItemStack aInput, final ItemStack aOutput) { try { - Utils.LOG_INFO("Trying with Gt 5.7/5.8 Method."); + Logger.INFO("Trying with Gt 5.7/5.8 Method."); return (boolean) this.m1.invoke(null, aInput, aOutput); } catch (final Exception e) { throw new RuntimeException(e); @@ -65,7 +65,7 @@ class LibProxy2 extends LibraryProxy { @Override public boolean addSmeltingAndAlloySmeltingRecipe(final ItemStack aInput, final ItemStack aOutput) { try { - Utils.LOG_INFO("Trying with Gt 5.9 Method."); + Logger.INFO("Trying with Gt 5.9 Method."); return (boolean) this.m2.invoke(null, aInput, aOutput, true); } catch (final Exception e) { throw new RuntimeException(e); diff --git a/src/Java/gtPlusPlus/core/util/inventory/InventoryUtils.java b/src/Java/gtPlusPlus/core/util/inventory/InventoryUtils.java index 51ae393c06..779f9b14c1 100644 --- a/src/Java/gtPlusPlus/core/util/inventory/InventoryUtils.java +++ b/src/Java/gtPlusPlus/core/util/inventory/InventoryUtils.java @@ -20,7 +20,7 @@ public class InventoryUtils { { for (int i1 = 0; i1 < ((IInventory) tileentity).getSizeInventory(); ++i1) { - ItemStack itemstack = (ItemStack) ((IInventory) tileentity).getStackInSlot(i1); + ItemStack itemstack = ((IInventory) tileentity).getStackInSlot(i1); if (itemstack != null) { @@ -38,11 +38,11 @@ public class InventoryUtils { } itemstack.stackSize -= j1; - entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); float f3 = 0.05F; - entityitem.motionX = (double)((float)mRandom.nextGaussian() * f3); - entityitem.motionY = (double)((float)mRandom.nextGaussian() * f3 + 0.2F); - entityitem.motionZ = (double)((float)mRandom.nextGaussian() * f3); + entityitem.motionX = (float)mRandom.nextGaussian() * f3; + entityitem.motionY = (float)mRandom.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float)mRandom.nextGaussian() * f3; if (itemstack.hasTagCompound()) { diff --git a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java index c212afda2f..098cb3e953 100644 --- a/src/Java/gtPlusPlus/core/util/item/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java @@ -11,6 +11,7 @@ import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.item.base.BasicSpawnEgg; import gtPlusPlus.core.item.base.dusts.BaseItemDust; @@ -115,7 +116,7 @@ public class ItemUtils { GT_OreDictUnificator.registerOre(oreDictName, new ItemStack(itemStackWithMeta.getItem()));*/ } } catch (final NullPointerException e) { - Utils.LOG_ERROR(itemName+" not found. [NULL]"); + Logger.ERROR(itemName+" not found. [NULL]"); } } @@ -123,7 +124,7 @@ public class ItemUtils { try { GT_OreDictUnificator.registerOre(oreDictName, stack); } catch (final NullPointerException e) { - Utils.LOG_ERROR(stack.getDisplayName()+" not registered. [NULL]"); + Logger.ERROR(stack.getDisplayName()+" not registered. [NULL]"); } } @@ -144,7 +145,7 @@ public class ItemUtils { } return null; } catch (final NullPointerException e) { - Utils.LOG_ERROR(itemName+" not found. [NULL]"); + Logger.ERROR(itemName+" not found. [NULL]"); return null; } } @@ -167,7 +168,7 @@ public class ItemUtils { } return null; } catch (final NullPointerException e) { - Utils.LOG_ERROR(FQRN+" not found. [NULL]"); + Logger.ERROR(FQRN+" not found. [NULL]"); return null; } } @@ -180,7 +181,7 @@ public class ItemUtils { } Item em = item; final Item em1 = item; - Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); + Logger.WARNING("Found: "+em1.getUnlocalizedName()+":"+meta); if (em1 != null){ if (null == em){ em = em1; @@ -282,11 +283,11 @@ public class ItemUtils { public static ItemStack getItemStackOfAmountFromOreDictNoBroken(final String oredictName, final int amount){ if (CORE.DEBUG){ - Utils.LOG_WARNING("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(1)); - Utils.LOG_WARNING("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(2)); - Utils.LOG_WARNING("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(3)); - Utils.LOG_WARNING("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(4)); - Utils.LOG_WARNING("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(5)); + Logger.WARNING("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(1)); + Logger.WARNING("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(2)); + Logger.WARNING("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(3)); + Logger.WARNING("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(4)); + Logger.WARNING("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(5)); } try{ @@ -309,7 +310,7 @@ public class ItemUtils { } } } - Utils.LOG_WARNING(oredictName+" was not valid."); + Logger.WARNING(oredictName+" was not valid."); return null; } catch (final Throwable t){ @@ -324,7 +325,7 @@ public class ItemUtils { return returnValue.copy(); } } - Utils.LOG_WARNING(material+" was not valid."); + Logger.WARNING(material+" was not valid."); return null; } @@ -400,20 +401,20 @@ public class ItemUtils { } public static MultiPickaxeBase generateMultiPick(final boolean GT_Durability, final ToolMaterial customMaterial, final String name, final int durability, final short[] rgba, final Object enchantment){ - Utils.LOG_WARNING("Generating a Multi-Pick out of "+name); + Logger.WARNING("Generating a Multi-Pick out of "+name); final short[] rgb = rgba; int dur = customMaterial.getMaxUses(); - Utils.LOG_WARNING("Determined durability for "+name+" is "+dur); + Logger.WARNING("Determined durability for "+name+" is "+dur); if (GT_Durability){ dur = durability*100; - Utils.LOG_WARNING("Using gregtech durability value, "+name+" is now "+dur+"."); + Logger.WARNING("Using gregtech durability value, "+name+" is now "+dur+"."); } else if (dur <= 0){ dur = durability; - Utils.LOG_WARNING("Determined durability too low, "+name+" is now "+dur+" based on the GT material durability."); + Logger.WARNING("Determined durability too low, "+name+" is now "+dur+" based on the GT material durability."); } if (dur <= 0){ - Utils.LOG_WARNING("Still too low, "+name+" will now go unused."); + Logger.WARNING("Still too low, "+name+" will now go unused."); return null; } @@ -437,7 +438,7 @@ public class ItemUtils { if (MP_Redstone.isValid){ return MP_Redstone; } - Utils.LOG_WARNING("Pickaxe was not valid."); + Logger.WARNING("Pickaxe was not valid."); return null; } @@ -457,20 +458,20 @@ public class ItemUtils { } public static MultiSpadeBase generateMultiShovel(final boolean GT_Durability, final ToolMaterial customMaterial, final String name, final int durability, final short[] rgba){ - Utils.LOG_WARNING("Generating a Multi-Spade out of "+name); + Logger.WARNING("Generating a Multi-Spade out of "+name); final short[] rgb = rgba; int dur = customMaterial.getMaxUses(); - Utils.LOG_WARNING("Determined durability for "+name+" is "+dur); + Logger.WARNING("Determined durability for "+name+" is "+dur); if (GT_Durability){ dur = durability*100; - Utils.LOG_WARNING("Using gregtech durability value, "+name+" is now "+dur+"."); + Logger.WARNING("Using gregtech durability value, "+name+" is now "+dur+"."); } else if (dur <= 0){ dur = durability; - Utils.LOG_WARNING("Determined durability too low, "+name+" is now "+dur+" based on the GT material durability."); + Logger.WARNING("Determined durability too low, "+name+" is now "+dur+" based on the GT material durability."); } if (dur <= 0){ - Utils.LOG_WARNING("Still too low, "+name+" will now go unused."); + Logger.WARNING("Still too low, "+name+" will now go unused."); return null; } final MultiSpadeBase MP_Redstone = new MultiSpadeBase( diff --git a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java index 66c991ce99..48279a91d9 100644 --- a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java +++ b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java @@ -1,19 +1,14 @@ package gtPlusPlus.core.util.materials; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.List; import org.apache.commons.lang3.reflect.FieldUtils; import gregtech.api.enums.*; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.StringUtils; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; @@ -217,6 +212,7 @@ public class MaterialUtils { }*/ + @SuppressWarnings("deprecation") public static String getMaterialName(Materials mat){ String mName; try { @@ -231,26 +227,4 @@ public class MaterialUtils { return mName; } - public static boolean tryEnableMaterial(Materials mMaterial){ - if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - return false; - } - return ReflectionUtils.setField(mMaterial, "mHasParentMod", true); - } - - public static boolean tryEnableMaterialPart(OrePrefixes prefix, Materials mMaterial){ - if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - return false; - } - try { - Method enableComponent = Class.forName("gregtech.api.enums.OrePrefixes").getDeclaredMethod("enableComponent", Materials.class); - enableComponent.invoke(prefix, mMaterial); - return true; - } - catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException | ClassNotFoundException e) { - Utils.LOG_INFO("Failed to enabled "+prefix.mRegularLocalName+" for "+mMaterial.mDefaultLocalName); - } - return false; - } - } diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java index 3361591ce8..adb5548f1d 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 gregtech.api.enums.GT_Values; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.objects.XSTR; @@ -315,10 +316,10 @@ public class MathUtils { temp = "0F0F0F"; } - Utils.LOG_WARNING("Operating with "+temp); + Logger.WARNING("Operating with "+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)+"."); + Logger.WARNING("Made "+temp+" - Hopefully it's not a mess."); + Logger.WARNING("It will decode into "+Integer.decode(temp)+"."); return Integer.decode(temp); } diff --git a/src/Java/gtPlusPlus/core/util/nbt/ModularArmourUtils.java b/src/Java/gtPlusPlus/core/util/nbt/ModularArmourUtils.java index 5d9da4da1e..2e8e29c372 100644 --- a/src/Java/gtPlusPlus/core/util/nbt/ModularArmourUtils.java +++ b/src/Java/gtPlusPlus/core/util/nbt/ModularArmourUtils.java @@ -2,7 +2,7 @@ package gtPlusPlus.core.util.nbt; import baubles.api.BaubleType; import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.array.Pair; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -115,7 +115,7 @@ public class ModularArmourUtils { } public static void setBaubleType(ItemStack aStack, BT aMod) { - Utils.LOG_INFO("Changing bauble type."); + Logger.INFO("Changing bauble type."); NBTTagCompound tNBT = NBTUtils.getNBT(aStack); if (aMod != null) { tNBT.setInteger("mBaubleType", aMod.getID()); diff --git a/src/Java/gtPlusPlus/core/util/nbt/NBTUtils.java b/src/Java/gtPlusPlus/core/util/nbt/NBTUtils.java index 31d00efc94..58d47eb0fa 100644 --- a/src/Java/gtPlusPlus/core/util/nbt/NBTUtils.java +++ b/src/Java/gtPlusPlus/core/util/nbt/NBTUtils.java @@ -7,7 +7,7 @@ import java.util.Map; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraft.entity.Entity; @@ -210,11 +210,11 @@ public class NBTUtils { Map<?, ?> mInternalMap = ReflectionUtils.getField(aNBT, "tagMap"); if (mInternalMap != null) { for (Map.Entry<?, ?> e : mInternalMap.entrySet()) { - Utils.LOG_INFO("Key: " + e.getKey().toString() + " | Value: " + e.getValue()); + Logger.INFO("Key: " + e.getKey().toString() + " | Value: " + e.getValue()); } return true; } else { - Utils.LOG_INFO("Data map reflected from NBTTagCompound was not valid."); + Logger.INFO("Data map reflected from NBTTagCompound was not valid."); return false; } } @@ -408,7 +408,7 @@ public class NBTUtils { Map<?, ?> mInternalMap = ReflectionUtils.getField(aNBT, "tagMap"); if (mInternalMap != null) { for (Map.Entry<?, ?> e : mInternalMap.entrySet()) { - Utils.LOG_INFO("Key: " + e.getKey().toString() + " | Value: " + e.getValue().toString()); + Logger.INFO("Key: " + e.getKey().toString() + " | Value: " + e.getValue().toString()); if (e.getValue().getClass() == String.class){ createStringTagCompound(aStack, "mEntityTag", (String) e.getKey(), (String) e.getValue()); } diff --git a/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java b/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java index b09b1a1056..ce2888ef29 100644 --- a/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java +++ b/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java @@ -4,7 +4,7 @@ import java.io.*; import java.net.*; import java.util.Enumeration; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; public class NetworkUtils { @@ -26,13 +26,13 @@ public class NetworkUtils { return tempLine; } catch (final MalformedURLException e) { - Utils.LOG_INFO("Bad URL for Version Check."); + Logger.INFO("Bad URL for Version Check."); } catch (final IOException e) { - Utils.LOG_INFO("IOException during Version Check."); + Logger.INFO("IOException during Version Check."); } } - Utils.LOG_INFO("Network Not Available during Version Check."); + Logger.INFO("Network Not Available during Version Check."); return "offline"; } @@ -50,11 +50,11 @@ public class NetworkUtils { return true; } else { - Utils.LOG_INFO("No sites responded to network connectivity test."); + Logger.INFO("No sites responded to network connectivity test."); } } else { - Utils.LOG_INFO("Network Adapter was not valid."); + Logger.INFO("Network Adapter was not valid."); } } catch (SocketException e) {} diff --git a/src/Java/gtPlusPlus/core/util/player/PlayerCache.java b/src/Java/gtPlusPlus/core/util/player/PlayerCache.java index c397e0f12f..5d4581910c 100644 --- a/src/Java/gtPlusPlus/core/util/player/PlayerCache.java +++ b/src/Java/gtPlusPlus/core/util/player/PlayerCache.java @@ -3,8 +3,8 @@ package gtPlusPlus.core.util.player; import java.io.*; import java.util.*; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; @@ -18,12 +18,12 @@ public class PlayerCache { if (cache != null){ CORE.PlayerCache = PlayerCache.readPropertiesFileAsMap(); - Utils.LOG_INFO("Loaded PlayerCache.dat"); + Logger.INFO("Loaded PlayerCache.dat"); } } catch (final Exception e) { - Utils.LOG_INFO("Failed to initialise PlayerCache.dat"); + Logger.INFO("Failed to initialise PlayerCache.dat"); PlayerCache.createPropertiesFile("PLAYER_", "DATA"); //e.printStackTrace(); } @@ -36,7 +36,7 @@ public class PlayerCache { props.setProperty(playerName+" ", playerUUIDasString); final OutputStream out = new FileOutputStream(cache); props.store(out, "Player Cache."); - Utils.LOG_INFO("PlayerCache.dat created for future use."); + Logger.INFO("PlayerCache.dat created for future use."); out.close(); } catch (final Exception e ) { @@ -71,11 +71,11 @@ public class PlayerCache { oos.writeObject(playerInfo); oos.close(); fos.close(); - Utils.LOG_INFO("Serialized Player data saved in PlayerCache.dat"); + Logger.INFO("Serialized Player data saved in PlayerCache.dat"); } catch (final IOException e) { - Utils.LOG_INFO("No PlayerCache file found, creating one."); + Logger.INFO("No PlayerCache file found, creating one."); createPropertiesFile(playerName, playerUUIDasString); } } @@ -136,11 +136,11 @@ public class PlayerCache { return null; }catch(final ClassNotFoundException c) { - Utils.LOG_INFO("Class not found"); + Logger.INFO("Class not found"); c.printStackTrace(); return null; } - Utils.LOG_WARNING("Deserialized PlayerCache.."); + Logger.WARNING("Deserialized PlayerCache.."); return map; } diff --git a/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java b/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java index 82de626976..32488f074d 100644 --- a/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java +++ b/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java @@ -1,12 +1,10 @@ package gtPlusPlus.core.util.player; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.UUID; +import java.util.*; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -26,7 +24,7 @@ public class PlayerUtils { final List<EntityPlayer> i = new ArrayList<>(); final Iterator<EntityPlayerMP> iterator = MinecraftServer.getServer().getConfigurationManager().playerEntityList.iterator(); while (iterator.hasNext()) { - i.add((EntityPlayer) (iterator.next())); + i.add((iterator.next())); } for (final EntityPlayer temp : i) { if (temp.getDisplayName().toLowerCase().equals(name.toLowerCase())){ @@ -157,7 +155,11 @@ public class PlayerUtils { return null; } + @SideOnly(Side.CLIENT) public static final boolean isPlayerAlkalus(){ + if (Utils.isServer()){ + return false; + } return isPlayerAlkalus(Minecraft.getMinecraft().thePlayer); } diff --git a/src/Java/gtPlusPlus/core/util/player/UtilsMining.java b/src/Java/gtPlusPlus/core/util/player/UtilsMining.java index d52dd7ee88..4f0402a18e 100644 --- a/src/Java/gtPlusPlus/core/util/player/UtilsMining.java +++ b/src/Java/gtPlusPlus/core/util/player/UtilsMining.java @@ -1,6 +1,6 @@ package gtPlusPlus.core.util.player; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; @@ -35,7 +35,7 @@ public class UtilsMining { } else { - Utils.LOG_WARNING("Incorrect Tool for mining this block."); + Logger.WARNING("Incorrect Tool for mining this block."); } } } catch (final NullPointerException e){ @@ -179,29 +179,29 @@ public class UtilsMining { try { blockClass = block.getClass().toString().toLowerCase(); - Utils.LOG_WARNING(blockClass); + Logger.WARNING(blockClass); if (blockClass.toLowerCase().contains(LIQUID)){ - Utils.LOG_WARNING(block.toString()+" is a Liquid."); + Logger.WARNING(block.toString()+" is a Liquid."); return false; } else if (blockClass.toLowerCase().contains(ORE)){ - Utils.LOG_WARNING(block.toString()+" is an Ore."); + Logger.WARNING(block.toString()+" is an Ore."); return true; } else if (block.getHarvestLevel(world.getBlockMetadata(xyz[0], xyz[1], xyz[2])) >= miningLevel){ - Utils.LOG_WARNING(block.toString()+" is minable."); + Logger.WARNING(block.toString()+" is minable."); return true; } else if (blockClass.toLowerCase().contains(AIR)){ - Utils.LOG_WARNING(block.toString()+" is Air."); + Logger.WARNING(block.toString()+" is Air."); return false; } else if (blockClass.toLowerCase().contains(BLOCK)){ - Utils.LOG_WARNING(block.toString()+" is a block of some kind."); + Logger.WARNING(block.toString()+" is a block of some kind."); return false; } else { - Utils.LOG_WARNING(block.toString()+" is mystery."); + Logger.WARNING(block.toString()+" is mystery."); return false; } } diff --git a/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java b/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java index 7d094b7a43..cdb8255231 100644 --- a/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java +++ b/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java @@ -4,11 +4,11 @@ import java.util.*; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.handler.COMPAT_HANDLER; import gtPlusPlus.core.handler.Recipes.LateRegistrationHandler; import gtPlusPlus.core.handler.Recipes.RegistrationHandler; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.shapeless.ShapelessUtils; import net.minecraft.item.Item; @@ -23,15 +23,15 @@ public class RecipeUtils { final ArrayList<Object> validSlots = new ArrayList<>(); if (resultItem == null){ - Utils.LOG_WARNING("Found a recipe with an invalid output, yet had a valid inputs. Skipping."); + Logger.WARNING("Found a recipe with an invalid output, yet had a valid inputs. Skipping."); return false; } if ((slot_1 == null) && (slot_2 == null) && (slot_3 == null) && (slot_4 == null) && (slot_5 == null) && (slot_6 == null) && (slot_7 == null) && (slot_8 == null) && (slot_9 == null)){ - Utils.LOG_WARNING("Found a recipe with 0 inputs, yet had a valid output."); - Utils.LOG_WARNING("Error found while adding a recipe for: "+resultItem.getDisplayName()+" | Please report this issue on Github."); + Logger.WARNING("Found a recipe with 0 inputs, yet had a valid output."); + Logger.WARNING("Error found while adding a recipe for: "+resultItem.getDisplayName()+" | Please report this issue on Github."); RegistrationHandler.recipesFailed++; return false; } @@ -39,35 +39,35 @@ public class RecipeUtils { //Utils.LOG_WARNING("Trying to add a recipe for "+resultItem.toString()); String a,b,c,d,e,f,g,h,i; if (slot_1 == null){ a = " ";} else { a = "1";validSlots.add('1');validSlots.add(slot_1);} - Utils.LOG_WARNING(a); + Logger.WARNING(a); if (slot_2 == null){ b = " ";} else { b = "2";validSlots.add('2');validSlots.add(slot_2);} - Utils.LOG_WARNING(b); + Logger.WARNING(b); if (slot_3 == null){ c = " ";} else { c = "3";validSlots.add('3');validSlots.add(slot_3);} - Utils.LOG_WARNING(c); + Logger.WARNING(c); if (slot_4 == null){ d = " ";} else { d = "4";validSlots.add('4');validSlots.add(slot_4);} - Utils.LOG_WARNING(d); + Logger.WARNING(d); if (slot_5 == null){ e = " ";} else { e = "5";validSlots.add('5');validSlots.add(slot_5);} - Utils.LOG_WARNING(e); + Logger.WARNING(e); if (slot_6 == null){ f = " ";} else { f = "6";validSlots.add('6');validSlots.add(slot_6);} - Utils.LOG_WARNING(f); + Logger.WARNING(f); if (slot_7 == null){ g = " ";} else { g = "7";validSlots.add('7');validSlots.add(slot_7);} - Utils.LOG_WARNING(g); + Logger.WARNING(g); if (slot_8 == null){ h = " ";} else { h = "8";validSlots.add('8');validSlots.add(slot_8);} - Utils.LOG_WARNING(h); + Logger.WARNING(h); if (slot_9 == null){ i = " ";} else { i = "9";validSlots.add('9');validSlots.add(slot_9);} - Utils.LOG_WARNING(i); + Logger.WARNING(i); - Utils.LOG_ERROR("_______"); + Logger.ERROR("_______"); final String lineOne = a+b+c; - Utils.LOG_ERROR("|"+a+"|"+b+"|"+c+"|"); - Utils.LOG_ERROR("_______"); + Logger.ERROR("|"+a+"|"+b+"|"+c+"|"); + Logger.ERROR("_______"); final String lineTwo = d+e+f; - Utils.LOG_ERROR("|"+d+"|"+e+"|"+f+"|"); - Utils.LOG_ERROR("_______"); + Logger.ERROR("|"+d+"|"+e+"|"+f+"|"); + Logger.ERROR("_______"); final String lineThree = g+h+i; - Utils.LOG_ERROR("|"+g+"|"+h+"|"+i+"|"); - Utils.LOG_ERROR("_______"); + Logger.ERROR("|"+g+"|"+h+"|"+i+"|"); + Logger.ERROR("_______"); validSlots.add(0, lineOne); validSlots.add(1, lineTwo); @@ -79,26 +79,26 @@ public class RecipeUtils { if (advancedLog){ int j = 0; final int l = validSlots.size(); - Utils.LOG_WARNING("l:"+l); + Logger.WARNING("l:"+l); while (j <= l) { - Utils.LOG_WARNING("j:"+j); + Logger.WARNING("j:"+j); if (j <= 2){ - Utils.LOG_WARNING("ArrayList Values: "+validSlots.get(j)); - Utils.LOG_WARNING("Adding 1."); + Logger.WARNING("ArrayList Values: "+validSlots.get(j)); + Logger.WARNING("Adding 1."); j++; } else if (j == l){ - Utils.LOG_WARNING("Done iteration."); + Logger.WARNING("Done iteration."); break; } else { - Utils.LOG_WARNING("ArrayList Values: '"+validSlots.get(j)+"' "+validSlots.get(j+1)); + Logger.WARNING("ArrayList Values: '"+validSlots.get(j)+"' "+validSlots.get(j+1)); if (j < (l-2)){ - Utils.LOG_WARNING("Adding 2."); + Logger.WARNING("Adding 2."); j=j+2; } else { - Utils.LOG_WARNING("Done iteration."); + Logger.WARNING("Done iteration."); break; } } @@ -124,7 +124,7 @@ public class RecipeUtils { //k.getClass(); //k.printStackTrace(); //k.getLocalizedMessage(); - Utils.LOG_INFO("@@@: Invalid Recipe detected for: "+resultItem.getUnlocalizedName()); + Logger.INFO("@@@: Invalid Recipe detected for: "+resultItem.getUnlocalizedName()); if (!COMPAT_HANDLER.areInitItemsLoaded){ RegistrationHandler.recipesFailed++; } @@ -140,35 +140,35 @@ public class RecipeUtils { final ArrayList<Object> validSlots = new ArrayList<>(); - Utils.LOG_WARNING("Trying to add a recipe for "+Output.toString()); + Logger.WARNING("Trying to add a recipe for "+Output.toString()); String a,b,c,d,e,f,g,h,i; if (slot_1 == null){ a = " ";} else { a = "1";validSlots.add('1');validSlots.add(slot_1);} - Utils.LOG_WARNING(a); + Logger.WARNING(a); if (slot_2 == null){ b = " ";} else { b = "2";validSlots.add('2');validSlots.add(slot_2);} - Utils.LOG_WARNING(b); + Logger.WARNING(b); if (slot_3 == null){ c = " ";} else { c = "3";validSlots.add('3');validSlots.add(slot_3);} - Utils.LOG_WARNING(c); + Logger.WARNING(c); if (slot_4 == null){ d = " ";} else { d = "4";validSlots.add('4');validSlots.add(slot_4);} - Utils.LOG_WARNING(d); + Logger.WARNING(d); if (slot_5 == null){ e = " ";} else { e = "5";validSlots.add('5');validSlots.add(slot_5);} - Utils.LOG_WARNING(e); + Logger.WARNING(e); if (slot_6 == null){ f = " ";} else { f = "6";validSlots.add('6');validSlots.add(slot_6);} - Utils.LOG_WARNING(f); + Logger.WARNING(f); if (slot_7 == null){ g = " ";} else { g = "7";validSlots.add('7');validSlots.add(slot_7);} - Utils.LOG_WARNING(g); + Logger.WARNING(g); if (slot_8 == null){ h = " ";} else { h = "8";validSlots.add('8');validSlots.add(slot_8);} - Utils.LOG_WARNING(h); + Logger.WARNING(h); if (slot_9 == null){ i = " ";} else { i = "9";validSlots.add('9');validSlots.add(slot_9);} - Utils.LOG_WARNING(i); + Logger.WARNING(i); - Utils.LOG_ERROR("_______"); - Utils.LOG_ERROR("|"+a+"|"+b+"|"+c+"|"); - Utils.LOG_ERROR("_______"); - Utils.LOG_ERROR("|"+d+"|"+e+"|"+f+"|"); - Utils.LOG_ERROR("_______"); - Utils.LOG_ERROR("|"+g+"|"+h+"|"+i+"|"); - Utils.LOG_ERROR("_______"); + Logger.ERROR("_______"); + Logger.ERROR("|"+a+"|"+b+"|"+c+"|"); + Logger.ERROR("_______"); + Logger.ERROR("|"+d+"|"+e+"|"+f+"|"); + Logger.ERROR("_______"); + Logger.ERROR("|"+g+"|"+h+"|"+i+"|"); + Logger.ERROR("_______"); validSlots.add(0, a); validSlots.add(1, b); @@ -184,7 +184,7 @@ public class RecipeUtils { //GameRegistry.addRecipe(new ShapelessOreRecipe(Output, outputAmount), (Object[]) validSlots.toArray()); GameRegistry.addRecipe(new ShapelessOreRecipe(Output, validSlots.toArray())); //GameRegistry.addShapelessRecipe(new ItemStack(output_ITEM, 1), new Object[] {slot_1, slot_2}); - Utils.LOG_WARNING("Success! Added a recipe for "+Output.getDisplayName()); + Logger.WARNING("Success! Added a recipe for "+Output.getDisplayName()); RegistrationHandler.recipesSuccess++; } catch(final RuntimeException k){ @@ -192,7 +192,7 @@ public class RecipeUtils { k.getClass(); k.printStackTrace(); k.getLocalizedMessage(); - Utils.LOG_WARNING("@@@: Invalid Recipe detected for: "+Output.getUnlocalizedName()); + Logger.WARNING("@@@: Invalid Recipe detected for: "+Output.getUnlocalizedName()); RegistrationHandler.recipesFailed++; } @@ -201,7 +201,7 @@ public class RecipeUtils { } public static void recipeBuilder(final Object[] array, final ItemStack outPut) { - Utils.LOG_SPECIFIC_WARNING("object Array - recipeBuilder", "Attempting to build a recipe using an object array as an input, splitting it, then running the normal recipeBuilder() method.", 396); + Logger.SPECIFIC_WARNING("object Array - recipeBuilder", "Attempting to build a recipe using an object array as an input, splitting it, then running the normal recipeBuilder() method.", 396); Object a=null; Object b=null; Object c=null; @@ -263,10 +263,10 @@ public class RecipeUtils { if ((x instanceof Item) || (x instanceof ItemStack)){ if (x instanceof Item){ final ItemStack r = new ItemStack((Item) x); - Utils.LOG_WARNING("Removing Recipe for "+r.getUnlocalizedName()); + Logger.WARNING("Removing Recipe for "+r.getUnlocalizedName()); } else { - Utils.LOG_WARNING("Removing Recipe for "+((ItemStack) x).getUnlocalizedName()); + Logger.WARNING("Removing Recipe for "+((ItemStack) x).getUnlocalizedName()); } if (x instanceof ItemStack){ final Item r = ((ItemStack) x).getItem(); @@ -274,49 +274,49 @@ public class RecipeUtils { x = r; } else { - Utils.LOG_WARNING("Recipe removal failed - Tell Alkalus."); + Logger.WARNING("Recipe removal failed - Tell Alkalus."); return false; } } if (RecipeUtils.attemptRecipeRemoval((Item) x)){ - Utils.LOG_WARNING("Recipe removal successful"); + Logger.WARNING("Recipe removal successful"); return true; } - Utils.LOG_WARNING("Recipe removal failed - Tell Alkalus."); + Logger.WARNING("Recipe removal failed - Tell Alkalus."); return false; } return false; } private static boolean attemptRecipeRemoval(final Item I){ - Utils.LOG_WARNING("Create list of recipes."); + Logger.WARNING("Create list of recipes."); final List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList(); final Iterator<IRecipe> items = recipes.iterator(); - Utils.LOG_WARNING("Begin list iteration."); + Logger.WARNING("Begin list iteration."); while (items.hasNext()) { final ItemStack is = items.next().getRecipeOutput(); if ((is != null) && (is.getItem() == I)){ items.remove(); - Utils.LOG_WARNING("Remove a recipe with "+I.getUnlocalizedName()+" as output."); + Logger.WARNING("Remove a recipe with "+I.getUnlocalizedName()+" as output."); continue; } } - Utils.LOG_WARNING("All recipes should be gone?"); + Logger.WARNING("All recipes should be gone?"); if (!items.hasNext()){ - Utils.LOG_WARNING("We iterated once, let's try again to double check."); + Logger.WARNING("We iterated once, let's try again to double check."); final Iterator<IRecipe> items2 = recipes.iterator(); while (items2.hasNext()) { final ItemStack is = items2.next().getRecipeOutput(); if ((is != null) && (is.getItem() == I)){ items.remove(); - Utils.LOG_WARNING("REMOVING MISSED RECIPE - RECHECK CONSTRUCTORS"); + Logger.WARNING("REMOVING MISSED RECIPE - RECHECK CONSTRUCTORS"); return true; } } - Utils.LOG_WARNING("Should be all gone now after double checking, so return true."); + Logger.WARNING("Should be all gone now after double checking, so return true."); return true; } - Utils.LOG_WARNING("Return false, because something went wrong."); + Logger.WARNING("Return false, because something went wrong."); return false; } @@ -394,7 +394,7 @@ public class RecipeUtils { } else { if (OutputItem != null){ - Utils.LOG_WARNING("Adding recipe for "+OutputItem.getDisplayName()+" failed. Error 62."); + Logger.WARNING("Adding recipe for "+OutputItem.getDisplayName()+" failed. Error 62."); } RegistrationHandler.recipesFailed++; return false; @@ -404,7 +404,7 @@ public class RecipeUtils { public static boolean addShapedGregtechRecipe(final Object[] inputs, ItemStack output){ if (inputs.length != 9){ - Utils.LOG_WARNING("Input array for "+output.getDisplayName()+" does not equal 9. "+inputs.length+" is the actual size."); + Logger.WARNING("Input array for "+output.getDisplayName()+" does not equal 9. "+inputs.length+" is the actual size."); RegistrationHandler.recipesFailed++; return false; @@ -413,17 +413,17 @@ public class RecipeUtils { for (int x=0;x<9;x++){ if (inputs[x] == null){ inputs[x] = " "; - Utils.LOG_WARNING("Input slot "+x+" changed from NULL to a blank space."); + Logger.WARNING("Input slot "+x+" changed from NULL to a blank space."); } else if (!(inputs[x] instanceof ItemStack) && !(inputs[x] instanceof String)){ if (output != null){ - Utils.LOG_WARNING("Invalid Item inserted into inputArray. Item:"+output.getDisplayName()+" has a bad recipe. Please report to Alkalus."); + Logger.WARNING("Invalid Item inserted into inputArray. Item:"+output.getDisplayName()+" has a bad recipe. Please report to Alkalus."); RegistrationHandler.recipesFailed++; return false; } else { - Utils.LOG_WARNING("Output is Null for a recipe. Report to Alkalus."); + Logger.WARNING("Output is Null for a recipe. Report to Alkalus."); output = ItemUtils.getItemStackOfAmountFromOreDict("sadibasdkjnad", 1); } } @@ -442,13 +442,13 @@ public class RecipeUtils { 'G', inputs[6], 'H', inputs[7], 'I', inputs[8]})){ - Utils.LOG_WARNING("Success! Added a recipe for "+output.getDisplayName()); + Logger.WARNING("Success! Added a recipe for "+output.getDisplayName()); RegistrationHandler.recipesSuccess++; return true; } else { if (output != null){ - Utils.LOG_WARNING("Adding recipe for "+output.getDisplayName()+" failed. Error 61."); + Logger.WARNING("Adding recipe for "+output.getDisplayName()+" failed. Error 61."); } return false; } @@ -458,7 +458,7 @@ public class RecipeUtils { //Catch Invalid Recipes if (inputItems.length > 9 || inputItems.length < 1){ if (OutputItem != null){ - Utils.LOG_WARNING("Invalid input array for shapeless recipe, which should output "+OutputItem.getDisplayName()); + Logger.WARNING("Invalid input array for shapeless recipe, which should output "+OutputItem.getDisplayName()); } return false; } diff --git a/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java b/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java index d0ad6d3361..29ca257134 100644 --- a/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java +++ b/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java @@ -2,7 +2,7 @@ package gtPlusPlus.core.util.recipe.shapeless; import java.util.ArrayList; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -34,11 +34,11 @@ public class ShapelessUtils { { if ((object1 == null)) { - Utils.LOG_INFO(("Invalid shapeless input, ignoring!")); + Logger.INFO(("Invalid shapeless input, ignoring!")); } else if (!(object1 instanceof Block) && (object1 != null)) { - Utils.LOG_INFO(("Invalid shapeless recipe!")); + Logger.INFO(("Invalid shapeless recipe!")); return false; } else { diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index 5f7a60f546..047f941aef 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -1,7 +1,6 @@ package gtPlusPlus.core.util.reflect; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; +import java.lang.reflect.*; import java.net.URL; import java.util.HashSet; import java.util.Scanner; @@ -9,20 +8,22 @@ import java.util.Scanner; import org.apache.commons.lang3.reflect.FieldUtils; import gregtech.GT_Mod; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import net.minecraft.client.Minecraft; public class ReflectionUtils { - public static Field getField(final Class<?> clazz, final String fieldName) throws NoSuchFieldException { + public static Field getField(final Class clazz, final String fieldName) throws NoSuchFieldException { try { return clazz.getDeclaredField(fieldName); } catch (final NoSuchFieldException e) { final Class<?> superClass = clazz.getSuperclass(); if (superClass == null) { + Logger.REFLECTION("Failed to get Field from Class. "+fieldName+" does not existing within "+clazz.getCanonicalName()+"."); throw e; } + Logger.REFLECTION("Failed to get Field from Class. "+fieldName+" does not existing within "+clazz.getCanonicalName()+". Trying super class."); return getField(superClass, fieldName); } } @@ -45,8 +46,10 @@ public class ReflectionUtils { field.setAccessible(true); return (V) field.get(object); } catch (final NoSuchFieldException e) { + Logger.REFLECTION("getField("+object.toString()+", "+fieldName+") failed."); clazz = clazz.getSuperclass(); } catch (final Exception e) { + Logger.REFLECTION("getField("+object.toString()+", "+fieldName+") failed."); throw new IllegalStateException(e); } } @@ -62,8 +65,10 @@ public class ReflectionUtils { field.set(object, fieldValue); return true; } catch (final NoSuchFieldException e) { + Logger.REFLECTION("setField("+object.toString()+", "+fieldName+") failed."); clazz = clazz.getSuperclass(); } catch (final Exception e) { + Logger.REFLECTION("setField("+object.toString()+", "+fieldName+") failed."); throw new IllegalStateException(e); } } @@ -71,7 +76,7 @@ public class ReflectionUtils { } public static boolean becauseIWorkHard(){ - /* TODO: fix this stuff \u002a\u002f\u0066\u0069\u006e\u0061\u006c\u0020\u0048\u0061\u0073\u0068\u0053\u0065\u0074\u003c\u0053\u0074\u0072\u0069\u006e\u0067\u003e\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0048\u0061\u0073\u0068\u0053\u0065\u0074\u003c\u003e\u0028\u0029\u003b\u000a\u0009\u0009\u004f\u0062\u006a\u0065\u0063\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u003b\u0009\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000a\u0009\u0009\u0009\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u0020\u003d\u0020\u0043\u006c\u0069\u0065\u006e\u0074\u0050\u0072\u006f\u0078\u0079\u0046\u0069\u006e\u0064\u0065\u0072\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0047\u0054\u005f\u004d\u006f\u0064\u002e\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0029\u003b\u0009\u0009\u0009\u0009\u000a\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0066\u0069\u006e\u0061\u006c\u0020\u0052\u0065\u0066\u006c\u0065\u0063\u0074\u0069\u0076\u0065\u004f\u0070\u0065\u0072\u0061\u0074\u0069\u006f\u006e\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0031\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u0020\u003d\u0020\u006e\u0075\u006c\u006c\u003b\u000a\u0009\u0009\u0009\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u006f\u0062\u0074\u0061\u0069\u006e\u0065\u0064\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0020\u006f\u0066\u0020\u0061\u0020\u0063\u006c\u0069\u0065\u006e\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u002e\u0022\u0029\u003b\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u000a\u0009\u0009\u007d\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000a\u0009\u0009\u0009\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0020\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0028\u006e\u0065\u0077\u0020\u0055\u0052\u004c\u0028\u0022\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0067\u0072\u0065\u0067\u0074\u0065\u0063\u0068\u002e\u006f\u0076\u0065\u0072\u006d\u0069\u006e\u0064\u0064\u006c\u0031\u002e\u0063\u006f\u006d\u002f\u0063\u006f\u006d\u002f\u0067\u0072\u0065\u0067\u006f\u0072\u0069\u0075\u0073\u0074\u002f\u0067\u0072\u0065\u0067\u0074\u0065\u0063\u0068\u002f\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0072\u006c\u0069\u0073\u0074\u002e\u0074\u0078\u0074\u0022\u0029\u002e\u006f\u0070\u0065\u006e\u0053\u0074\u0072\u0065\u0061\u006d\u0028\u0029\u0029\u003b\u000a\u0009\u0009\u0009\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0057\u0041\u0052\u004e\u0049\u004e\u0047\u0028\u0022\u0054\u0072\u0079\u0069\u006e\u0067\u0020\u0074\u006f\u0020\u0062\u0075\u0069\u006c\u0064\u0020\u0061\u0020\u0048\u0061\u0073\u0068\u0053\u0065\u0074\u002e\u0022\u0029\u003b\u000a\u0009\u0009\u0009\u0077\u0068\u0069\u006c\u0065\u0020\u0028\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u002e\u0068\u0061\u0073\u004e\u0065\u0078\u0074\u004c\u0069\u006e\u0065\u0028\u0029\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0009\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0074\u004e\u0061\u006d\u0065\u0020\u003d\u0020\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u002e\u006e\u0065\u0078\u0074\u004c\u0069\u006e\u0065\u0028\u0029\u003b\u000a\u000a\u0009\u0009\u0009\u0009\u0069\u0066\u0020\u0028\u0021\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u0028\u0074\u004e\u0061\u006d\u0065\u002e\u0074\u006f\u004c\u006f\u0077\u0065\u0072\u0043\u0061\u0073\u0065\u0028\u0029\u0029\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0009\u0009\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0061\u0064\u0064\u0028\u0074\u004e\u0061\u006d\u0065\u002e\u0074\u006f\u004c\u006f\u0077\u0065\u0072\u0043\u0061\u0073\u0065\u0028\u0029\u0029\u003b\u000a\u0009\u0009\u0009\u0009\u007d\u000a\u0009\u0009\u0009\u0009\u000a\u0009\u0009\u0009\u0009\u002f\u002f\u0041\u0064\u0064\u0020\u004d\u0079\u0073\u0065\u006c\u0066\u000a\u0009\u0009\u0009\u0009\u0069\u0066\u0020\u0028\u0021\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u0028\u0022\u0064\u0072\u0061\u006b\u006e\u0079\u0074\u0065\u0031\u0022\u0029\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0009\u0009\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0057\u0041\u0052\u004e\u0049\u004e\u0047\u0028\u0022\u0041\u0064\u0064\u0065\u0064\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0076\u0061\u006c\u0075\u0065\u002e\u0022\u0029\u003b\u000a\u0009\u0009\u0009\u0009\u0009\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0061\u0064\u0064\u0028\u0022\u0064\u0072\u0061\u006b\u006e\u0079\u0074\u0065\u0031\u0022\u0029\u003b\u000a\u0009\u0009\u0009\u0009\u007d\u000a\u0009\u0009\u0009\u0009\u000a\u0009\u0009\u0009\u0009\u002f\u002f\u0041\u0064\u0064\u0020\u0074\u0068\u0065\u0020\u0063\u0061\u0070\u0065\u0064\u0020\u0074\u0065\u0073\u0074\u0020\u0068\u0065\u0072\u006f\u000a\u0009\u0009\u0009\u0009\u0069\u0066\u0020\u0028\u0043\u004f\u0052\u0045\u002e\u0044\u0045\u0056\u0045\u004e\u0056\u0029\u007b\u000a\u0009\u0009\u0009\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000a\u0009\u0009\u0009\u0009\u0009\u0009\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0064\u0065\u0076\u0050\u006c\u0061\u0079\u0065\u0072\u0020\u003d\u0020\u004d\u0069\u006e\u0065\u0063\u0072\u0061\u0066\u0074\u002e\u0067\u0065\u0074\u004d\u0069\u006e\u0065\u0063\u0072\u0061\u0066\u0074\u0028\u0029\u002e\u0067\u0065\u0074\u0053\u0065\u0073\u0073\u0069\u006f\u006e\u0028\u0029\u002e\u0067\u0065\u0074\u0055\u0073\u0065\u0072\u006e\u0061\u006d\u0065\u0028\u0029\u002e\u0074\u006f\u004c\u006f\u0077\u0065\u0072\u0043\u0061\u0073\u0065\u0028\u0029\u003b\u000a\u0009\u0009\u0009\u0009\u0009\u0009\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0046\u006f\u0075\u006e\u0064\u0020\u0022\u002b\u0064\u0065\u0076\u0050\u006c\u0061\u0079\u0065\u0072\u0029\u003b\u000a\u0009\u0009\u0009\u0009\u0009\u0009\u0069\u0066\u0020\u0028\u0021\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u0028\u0064\u0065\u0076\u0050\u006c\u0061\u0079\u0065\u0072\u0029\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0009\u0009\u0009\u0009\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0057\u0041\u0052\u004e\u0049\u004e\u0047\u0028\u0022\u0041\u0064\u0064\u0065\u0064\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0076\u0061\u006c\u0075\u0065\u002e\u0022\u0029\u003b\u000a\u0009\u0009\u0009\u0009\u0009\u0009\u0009\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0061\u0064\u0064\u0028\u0064\u0065\u0076\u0050\u006c\u0061\u0079\u0065\u0072\u0029\u003b\u000a\u0009\u0009\u0009\u0009\u0009\u0009\u007d\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u000a\u0009\u0009\u0009\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0054\u0068\u0072\u006f\u0077\u0061\u0062\u006c\u0065\u0020\u0074\u0029\u007b\u000a\u0009\u0009\u0009\u0009\u0009\u0009\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u0061\u0064\u0064\u0069\u006e\u0067\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0076\u0061\u006c\u0075\u0065\u0020\u0069\u006e\u0020\u0063\u0075\u0072\u0072\u0065\u006e\u0074\u0020\u0065\u006e\u0076\u0069\u0072\u006f\u006e\u006d\u0065\u006e\u0074\u002e\u0022\u0029\u003b\u000a\u0009\u0009\u0009\u0009\u0009\u007d\u000a\u0009\u0009\u0009\u0009\u007d\u000a\u000a\u0009\u0009\u0009\u007d\u000a\u0009\u0009\u0009\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u002e\u0063\u006c\u006f\u0073\u0065\u0028\u0029\u003b\u000a\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0066\u0069\u006e\u0061\u006c\u0020\u0054\u0068\u0072\u006f\u0077\u0061\u0062\u006c\u0065\u0020\u0065\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0057\u0041\u0052\u004e\u0049\u004e\u0047\u0028\u0022\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u0067\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0074\u0068\u0065\u0020\u0077\u0065\u0062\u0020\u006c\u0069\u0073\u0074\u002e\u0022\u0029\u003b\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u0020\u0020\u0020\u0020\u0020\u0009\u000a\u0009\u0009\u007d\u0009\u0009\u000a\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u000a\u0009\u0009\u0009\u0046\u0069\u0065\u006c\u0064\u0055\u0074\u0069\u006c\u0073\u002e\u0077\u0072\u0069\u0074\u0065\u0046\u0069\u0065\u006c\u0064\u0028\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u002c\u0020\u0022\u006d\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u0022\u002c\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002c\u0020\u0074\u0072\u0075\u0065\u0029\u003b\u000a\u0009\u0009\u0009\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0057\u0041\u0052\u004e\u0049\u004e\u0047\u0028\u0022\u0041\u0064\u0064\u0065\u0064\u0020\u006d\u006f\u0064\u0069\u0066\u0069\u0065\u0064\u0020\u0068\u0061\u0073\u0068\u0073\u0065\u0074\u0020\u0062\u0061\u0063\u006b\u0020\u0069\u006e\u0074\u006f\u0020\u0074\u0068\u0065\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u002e\u0022\u0029\u003b\u0020\u0020\u0009\u0009\u0009\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0074\u0072\u0075\u0065\u003b\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u000a\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0066\u0069\u006e\u0061\u006c\u0020\u0054\u0068\u0072\u006f\u0077\u0061\u0062\u006c\u0065\u0020\u0065\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0052\u0065\u0066\u006c\u0065\u0063\u0074\u0069\u006f\u006e\u0020\u0069\u006e\u0074\u006f\u0020\u0061\u0063\u0074\u0069\u0076\u0065\u0020\u0063\u006c\u0069\u0065\u006e\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0020\u0066\u0061\u0069\u006c\u0065\u0064\u002e\u0022\u0029\u003b\u000a\u0009\u0009\u0009\u0065\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u0020\u0020\u0020\u0020\u0020\u0020\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u0020\u0020\u0009\u000a\u0009\u0009\u007d\u002f\u002a */ + /* TODO: fix this stuff \u002a\u002f\u0066\u0069\u006e\u0061\u006c\u0020\u0048\u0061\u0073\u0068\u0053\u0065\u0074\u003c\u0053\u0074\u0072\u0069\u006e\u0067\u003e\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0048\u0061\u0073\u0068\u0053\u0065\u0074\u003c\u003e\u0028\u0029\u003b\u000a\u0009\u0009\u004f\u0062\u006a\u0065\u0063\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u003b\u0009\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000a\u0009\u0009\u0009\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u0020\u003d\u0020\u0043\u006c\u0069\u0065\u006e\u0074\u0050\u0072\u006f\u0078\u0079\u0046\u0069\u006e\u0064\u0065\u0072\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0047\u0054\u005f\u004d\u006f\u0064\u002e\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0029\u003b\u0009\u0009\u0009\u0009\u000a\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0066\u0069\u006e\u0061\u006c\u0020\u0052\u0065\u0066\u006c\u0065\u0063\u0074\u0069\u0076\u0065\u004f\u0070\u0065\u0072\u0061\u0074\u0069\u006f\u006e\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0031\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u0020\u003d\u0020\u006e\u0075\u006c\u006c\u003b\u000a\u0009\u0009\u0009Logger\u002eINFO\u0028\u0022\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u006f\u0062\u0074\u0061\u0069\u006e\u0065\u0064\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0020\u006f\u0066\u0020\u0061\u0020\u0063\u006c\u0069\u0065\u006e\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u002e\u0022\u0029\u003b\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u000a\u0009\u0009\u007d\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000a\u0009\u0009\u0009\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0020\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0028\u006e\u0065\u0077\u0020\u0055\u0052\u004c\u0028\u0022\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0067\u0072\u0065\u0067\u0074\u0065\u0063\u0068\u002e\u006f\u0076\u0065\u0072\u006d\u0069\u006e\u0064\u0064\u006c\u0031\u002e\u0063\u006f\u006d\u002f\u0063\u006f\u006d\u002f\u0067\u0072\u0065\u0067\u006f\u0072\u0069\u0075\u0073\u0074\u002f\u0067\u0072\u0065\u0067\u0074\u0065\u0063\u0068\u002f\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0072\u006c\u0069\u0073\u0074\u002e\u0074\u0078\u0074\u0022\u0029\u002e\u006f\u0070\u0065\u006e\u0053\u0074\u0072\u0065\u0061\u006d\u0028\u0029\u0029\u003b\u000a\u0009\u0009\u0009Logger\u002eWARNING\u0028\u0022\u0054\u0072\u0079\u0069\u006e\u0067\u0020\u0074\u006f\u0020\u0062\u0075\u0069\u006c\u0064\u0020\u0061\u0020\u0048\u0061\u0073\u0068\u0053\u0065\u0074\u002e\u0022\u0029\u003b\u000a\u0009\u0009\u0009\u0077\u0068\u0069\u006c\u0065\u0020\u0028\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u002e\u0068\u0061\u0073\u004e\u0065\u0078\u0074\u004c\u0069\u006e\u0065\u0028\u0029\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0009\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0074\u004e\u0061\u006d\u0065\u0020\u003d\u0020\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u002e\u006e\u0065\u0078\u0074\u004c\u0069\u006e\u0065\u0028\u0029\u003b\u000a\u000a\u0009\u0009\u0009\u0009\u0069\u0066\u0020\u0028\u0021\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u0028\u0074\u004e\u0061\u006d\u0065\u002e\u0074\u006f\u004c\u006f\u0077\u0065\u0072\u0043\u0061\u0073\u0065\u0028\u0029\u0029\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0009\u0009\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0061\u0064\u0064\u0028\u0074\u004e\u0061\u006d\u0065\u002e\u0074\u006f\u004c\u006f\u0077\u0065\u0072\u0043\u0061\u0073\u0065\u0028\u0029\u0029\u003b\u000a\u0009\u0009\u0009\u0009\u007d\u000a\u0009\u0009\u0009\u0009\u000a\u0009\u0009\u0009\u0009\u002f\u002f\u0041\u0064\u0064\u0020\u004d\u0079\u0073\u0065\u006c\u0066\u000a\u0009\u0009\u0009\u0009\u0069\u0066\u0020\u0028\u0021\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u0028\u0022\u0064\u0072\u0061\u006b\u006e\u0079\u0074\u0065\u0031\u0022\u0029\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0009\u0009Logger\u002eWARNING\u0028\u0022\u0041\u0064\u0064\u0065\u0064\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0076\u0061\u006c\u0075\u0065\u002e\u0022\u0029\u003b\u000a\u0009\u0009\u0009\u0009\u0009\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0061\u0064\u0064\u0028\u0022\u0064\u0072\u0061\u006b\u006e\u0079\u0074\u0065\u0031\u0022\u0029\u003b\u000a\u0009\u0009\u0009\u0009\u007d\u000a\u0009\u0009\u0009\u0009\u000a\u0009\u0009\u0009\u0009\u002f\u002f\u0041\u0064\u0064\u0020\u0074\u0068\u0065\u0020\u0063\u0061\u0070\u0065\u0064\u0020\u0074\u0065\u0073\u0074\u0020\u0068\u0065\u0072\u006f\u000a\u0009\u0009\u0009\u0009\u0069\u0066\u0020\u0028\u0043\u004f\u0052\u0045\u002e\u0044\u0045\u0056\u0045\u004e\u0056\u0029\u007b\u000a\u0009\u0009\u0009\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000a\u0009\u0009\u0009\u0009\u0009\u0009\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0064\u0065\u0076\u0050\u006c\u0061\u0079\u0065\u0072\u0020\u003d\u0020\u004d\u0069\u006e\u0065\u0063\u0072\u0061\u0066\u0074\u002e\u0067\u0065\u0074\u004d\u0069\u006e\u0065\u0063\u0072\u0061\u0066\u0074\u0028\u0029\u002e\u0067\u0065\u0074\u0053\u0065\u0073\u0073\u0069\u006f\u006e\u0028\u0029\u002e\u0067\u0065\u0074\u0055\u0073\u0065\u0072\u006e\u0061\u006d\u0065\u0028\u0029\u002e\u0074\u006f\u004c\u006f\u0077\u0065\u0072\u0043\u0061\u0073\u0065\u0028\u0029\u003b\u000a\u0009\u0009\u0009\u0009\u0009\u0009Logger\u002eINFO\u0028\u0022\u0046\u006f\u0075\u006e\u0064\u0020\u0022\u002b\u0064\u0065\u0076\u0050\u006c\u0061\u0079\u0065\u0072\u0029\u003b\u000a\u0009\u0009\u0009\u0009\u0009\u0009\u0069\u0066\u0020\u0028\u0021\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u0028\u0064\u0065\u0076\u0050\u006c\u0061\u0079\u0065\u0072\u0029\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0009\u0009\u0009\u0009Logger\u002eWARNING\u0028\u0022\u0041\u0064\u0064\u0065\u0064\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0076\u0061\u006c\u0075\u0065\u002e\u0022\u0029\u003b\u000a\u0009\u0009\u0009\u0009\u0009\u0009\u0009\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0061\u0064\u0064\u0028\u0064\u0065\u0076\u0050\u006c\u0061\u0079\u0065\u0072\u0029\u003b\u000a\u0009\u0009\u0009\u0009\u0009\u0009\u007d\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u000a\u0009\u0009\u0009\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0054\u0068\u0072\u006f\u0077\u0061\u0062\u006c\u0065\u0020\u0074\u0029\u007b\u000a\u0009\u0009\u0009\u0009\u0009\u0009Logger\u002eINFO\u0028\u0022\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u0061\u0064\u0064\u0069\u006e\u0067\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0076\u0061\u006c\u0075\u0065\u0020\u0069\u006e\u0020\u0063\u0075\u0072\u0072\u0065\u006e\u0074\u0020\u0065\u006e\u0076\u0069\u0072\u006f\u006e\u006d\u0065\u006e\u0074\u002e\u0022\u0029\u003b\u000a\u0009\u0009\u0009\u0009\u0009\u007d\u000a\u0009\u0009\u0009\u0009\u007d\u000a\u000a\u0009\u0009\u0009\u007d\u000a\u0009\u0009\u0009\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u002e\u0063\u006c\u006f\u0073\u0065\u0028\u0029\u003b\u000a\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0066\u0069\u006e\u0061\u006c\u0020\u0054\u0068\u0072\u006f\u0077\u0061\u0062\u006c\u0065\u0020\u0065\u0029\u0020\u007b\u000a\u0009\u0009\u0009Logger\u002eWARNING\u0028\u0022\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u0067\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0074\u0068\u0065\u0020\u0077\u0065\u0062\u0020\u006c\u0069\u0073\u0074\u002e\u0022\u0029\u003b\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u0020\u0020\u0020\u0020\u0020\u0009\u000a\u0009\u0009\u007d\u0009\u0009\u000a\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u000a\u0009\u0009\u0009\u0046\u0069\u0065\u006c\u0064\u0055\u0074\u0069\u006c\u0073\u002e\u0077\u0072\u0069\u0074\u0065\u0046\u0069\u0065\u006c\u0064\u0028\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u002c\u0020\u0022\u006d\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u0022\u002c\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002c\u0020\u0074\u0072\u0075\u0065\u0029\u003b\u000a\u0009\u0009\u0009Logger\u002eWARNING\u0028\u0022\u0041\u0064\u0064\u0065\u0064\u0020\u006d\u006f\u0064\u0069\u0066\u0069\u0065\u0064\u0020\u0068\u0061\u0073\u0068\u0073\u0065\u0074\u0020\u0062\u0061\u0063\u006b\u0020\u0069\u006e\u0074\u006f\u0020\u0074\u0068\u0065\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u002e\u0022\u0029\u003b\u0020\u0020\u0009\u0009\u0009\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0074\u0072\u0075\u0065\u003b\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u000a\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0066\u0069\u006e\u0061\u006c\u0020\u0054\u0068\u0072\u006f\u0077\u0061\u0062\u006c\u0065\u0020\u0065\u0029\u0020\u007b\u000a\u0009\u0009\u0009Logger\u002eINFO\u0028\u0022\u0052\u0065\u0066\u006c\u0065\u0063\u0074\u0069\u006f\u006e\u0020\u0069\u006e\u0074\u006f\u0020\u0061\u0063\u0074\u0069\u0076\u0065\u0020\u0063\u006c\u0069\u0065\u006e\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0020\u0066\u0061\u0069\u006c\u0065\u0064\u002e\u0022\u0029\u003b\u000a\u0009\u0009\u0009\u0065\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u0020\u0020\u0020\u0020\u0020\u0020\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u0020\u0020\u0009\u000a\u0009\u0009\u007d\u002f\u002a */ } public static boolean doesClassExist(final String classname) { @@ -162,6 +167,37 @@ public class ReflectionUtils { fieldA.setByte(clazz, newValue);*/ } + + public static boolean invoke(Object objectInstance, String methodName, Class[] parameters, Object[] values){ + if (objectInstance == null || methodName == null || parameters == null || values == null){ + Logger.REFLECTION("Null value when trying to Dynamically invoke "+methodName+" on an object of type: "+objectInstance.getClass().getName()); + return false; + } + Class mLocalClass = (objectInstance instanceof Class ? (Class) objectInstance : objectInstance.getClass()); + Logger.REFLECTION("Trying to invoke "+methodName+" on an instance of "+mLocalClass.getCanonicalName()+"."); + try { + Method mInvokingMethod = mLocalClass.getDeclaredMethod(methodName, parameters); + if (mInvokingMethod != null){ + Logger.REFLECTION(methodName+" was not null."); + if ((boolean) mInvokingMethod.invoke(objectInstance, values)){ + Logger.REFLECTION("Successfully invoked "+methodName+"."); + return true; + } + else { + Logger.REFLECTION("Invocation failed for "+methodName+"."); + } + } + else { + Logger.REFLECTION(methodName+" is null."); + } + } + catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + Logger.REFLECTION("Failed to Dynamically invoke "+methodName+" on an object of type: "+mLocalClass.getName()); + } + + Logger.REFLECTION("Invoke failed or did something wrong."); + return false; + } diff --git a/src/Java/gtPlusPlus/core/util/wrapper/var.java b/src/Java/gtPlusPlus/core/util/wrapper/var.java index 1b73d035bc..06de3cde73 100644 --- a/src/Java/gtPlusPlus/core/util/wrapper/var.java +++ b/src/Java/gtPlusPlus/core/util/wrapper/var.java @@ -1,7 +1,7 @@ package gtPlusPlus.core.util.wrapper; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; @@ -23,7 +23,7 @@ public class var{ for (int i=0;i<input.length();i++) { if (input.charAt(i) == token) { input = input.replace(input.charAt(i), ' '); - Utils.LOG_WARNING("MATCH FOUND"); + Logger.WARNING("MATCH FOUND"); } input = input.replaceAll(" ", ""); } diff --git a/src/Java/gtPlusPlus/core/world/darkworld/Dimension_DarkWorld.java b/src/Java/gtPlusPlus/core/world/darkworld/Dimension_DarkWorld.java index 71d0e59492..22b8973cdb 100644 --- a/src/Java/gtPlusPlus/core/world/darkworld/Dimension_DarkWorld.java +++ b/src/Java/gtPlusPlus/core/world/darkworld/Dimension_DarkWorld.java @@ -5,23 +5,20 @@ import java.util.Random; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.world.darkworld.block.*; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.world.darkworld.block.blockDarkWorldPortal; import gtPlusPlus.core.world.darkworld.item.itemDarkWorldPortalTrigger; import gtPlusPlus.core.world.darkworld.world.WorldProviderMod; import net.minecraft.block.Block; import net.minecraft.init.Blocks; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; -@SuppressWarnings("unchecked") public class Dimension_DarkWorld { public Object instance; - public static int DIMID = 227; + public static int DIMID = CORE.DARKWORLD_ID; public static blockDarkWorldPortal portalBlock; public static itemDarkWorldPortalTrigger portalItem; @@ -29,7 +26,7 @@ public class Dimension_DarkWorld { public static Block blockSecondLayer; public static Block blockMainFiller = Blocks.stone; public static Block blockSecondaryFiller; - public static Block blockFluidLakes = ModBlocks.blockFluidSludge; + public static Block blockFluidLakes; public static Block blockPortalFrame; diff --git a/src/Java/gtPlusPlus/core/world/darkworld/biome/BiomeGenerator_Custom.java b/src/Java/gtPlusPlus/core/world/darkworld/biome/BiomeGenerator_Custom.java index 7bb47e4e24..0dc84b8aa3 100644 --- a/src/Java/gtPlusPlus/core/world/darkworld/biome/BiomeGenerator_Custom.java +++ b/src/Java/gtPlusPlus/core/world/darkworld/biome/BiomeGenerator_Custom.java @@ -1,5 +1,8 @@ package gtPlusPlus.core.world.darkworld.biome; +import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.*; +import static net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.*; + import java.util.Random; import gtPlusPlus.core.block.ModBlocks; @@ -11,23 +14,8 @@ import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.BiomeGenBase; -import net.minecraft.world.gen.feature.WorldGenAbstractTree; -import net.minecraft.world.gen.feature.WorldGenBigMushroom; -import net.minecraft.world.gen.feature.WorldGenCactus; -import net.minecraft.world.gen.feature.WorldGenClay; -import net.minecraft.world.gen.feature.WorldGenDeadBush; -import net.minecraft.world.gen.feature.WorldGenFlowers; -import net.minecraft.world.gen.feature.WorldGenLiquids; -import net.minecraft.world.gen.feature.WorldGenMinable; -import net.minecraft.world.gen.feature.WorldGenPumpkin; -import net.minecraft.world.gen.feature.WorldGenReed; -import net.minecraft.world.gen.feature.WorldGenSand; -import net.minecraft.world.gen.feature.WorldGenWaterlily; -import net.minecraft.world.gen.feature.WorldGenerator; - -import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.*; -import static net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.*; -import net.minecraftforge.common.*; +import net.minecraft.world.gen.feature.*; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.terraingen.*; public class BiomeGenerator_Custom extends BiomeDecorator { @@ -144,7 +132,8 @@ public class BiomeGenerator_Custom extends BiomeDecorator { this.generateLakes = true; } - public void decorateChunk(World p_150512_1_, Random p_150512_2_, BiomeGenBase p_150512_3_, int p_150512_4_, int p_150512_5_) + @Override + public void decorateChunk(World p_150512_1_, Random p_150512_2_, BiomeGenBase p_150512_3_, int p_150512_4_, int p_150512_5_) { if (this.currentWorld != null) { @@ -162,7 +151,8 @@ public class BiomeGenerator_Custom extends BiomeDecorator { } } - protected void genDecorations(BiomeGenBase p_150513_1_) + @Override + protected void genDecorations(BiomeGenBase p_150513_1_) { MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(currentWorld, randomGenerator, chunk_X, chunk_Z)); this.generateOres(); @@ -373,7 +363,8 @@ public class BiomeGenerator_Custom extends BiomeDecorator { /** * Standard ore generation helper. Generates most ores. */ - protected void genStandardOre1(int p_76795_1_, WorldGenerator p_76795_2_, int p_76795_3_, int p_76795_4_) + @Override + protected void genStandardOre1(int p_76795_1_, WorldGenerator p_76795_2_, int p_76795_3_, int p_76795_4_) { for (int l = 0; l < p_76795_1_; ++l) { @@ -387,7 +378,8 @@ public class BiomeGenerator_Custom extends BiomeDecorator { /** * Standard ore generation helper. Generates Lapis Lazuli. */ - protected void genStandardOre2(int p_76793_1_, WorldGenerator p_76793_2_, int p_76793_3_, int p_76793_4_) + @Override + protected void genStandardOre2(int p_76793_1_, WorldGenerator p_76793_2_, int p_76793_3_, int p_76793_4_) { for (int l = 0; l < p_76793_1_; ++l) { @@ -401,7 +393,8 @@ public class BiomeGenerator_Custom extends BiomeDecorator { /** * Generates ores in the current chunk */ - protected void generateOres() + @Override + protected void generateOres() { MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Pre(currentWorld, randomGenerator, chunk_X, chunk_Z)); if (TerrainGen.generateOre(currentWorld, randomGenerator, dirtGen, chunk_X, chunk_Z, DIRT)) diff --git a/src/Java/gtPlusPlus/core/world/darkworld/biome/Biome_DarkWorld.java b/src/Java/gtPlusPlus/core/world/darkworld/biome/Biome_DarkWorld.java index ccd977a87e..92f3f43d95 100644 --- a/src/Java/gtPlusPlus/core/world/darkworld/biome/Biome_DarkWorld.java +++ b/src/Java/gtPlusPlus/core/world/darkworld/biome/Biome_DarkWorld.java @@ -1,25 +1,21 @@ package gtPlusPlus.core.world.darkworld.biome; +import java.lang.reflect.Field; import java.util.Random; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.entity.monster.EntitySickBlaze; import gtPlusPlus.core.entity.monster.EntityStaballoyConstruct; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.core.world.darkworld.Dimension_DarkWorld; -import net.minecraft.entity.monster.EntityBlaze; -import net.minecraft.entity.monster.EntityCaveSpider; -import net.minecraft.entity.monster.EntityCreeper; -import net.minecraft.entity.monster.EntityEnderman; -import net.minecraft.entity.monster.EntityGhast; -import net.minecraft.entity.monster.EntitySkeleton; -import net.minecraft.entity.monster.EntitySpider; -import net.minecraft.entity.monster.EntityZombie; -import net.minecraft.entity.passive.*; +import net.minecraft.entity.monster.EntityPigZombie; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.passive.EntitySquid; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -28,7 +24,7 @@ import net.minecraftforge.common.BiomeManager; public class Biome_DarkWorld { - public static BiomeGenbiomeDarkWorld biome = new BiomeGenbiomeDarkWorld(); + public static BiomeGenDarkWorld biome = new BiomeGenDarkWorld(); public Object instance; @@ -38,8 +34,6 @@ public class Biome_DarkWorld { public void load() { BiomeDictionary.registerBiomeType(biome, BiomeDictionary.Type.DEAD); BiomeManager.addSpawnBiome(biome); - // BiomeManager.desertBiomes.add(new BiomeManager.BiomeEntry(biome, - // 10)); } public void generateNether(World world, Random random, int chunkX, int chunkZ) { @@ -61,12 +55,14 @@ public class Biome_DarkWorld { public void preInit(FMLPreInitializationEvent event) { } - static class BiomeGenbiomeDarkWorld extends BiomeGenBase { + static class BiomeGenDarkWorld extends BiomeGenBase { @SuppressWarnings("unchecked") - public BiomeGenbiomeDarkWorld() { + public BiomeGenDarkWorld() { super(CORE.DARKBIOME_ID); + this.setBiomeID(); this.theBiomeDecorator = new BiomeGenerator_Custom(); - Utils.LOG_INFO("Dark World Temperature Category: "+getTempCategory()); + this.theBiomeDecorator.treesPerChunk = 10; + Logger.INFO("Dark World Temperature Category: "+getTempCategory()); this.setBiomeName("Dark World"); this.topBlock = Dimension_DarkWorld.blockTopLayer; this.fillerBlock = Dimension_DarkWorld.blockSecondLayer; @@ -82,29 +78,42 @@ public class Biome_DarkWorld { this.spawnableCreatureList.clear(); this.spawnableWaterCreatureList.clear(); this.spawnableCaveCreatureList.clear(); - - //Enemies - this.spawnableMonsterList.add(new SpawnListEntry(EntitySickBlaze.class, 10, 4, 10)); - this.spawnableMonsterList.add(new SpawnListEntry(EntitySickBlaze.class, 60, 1, 2)); - this.spawnableMonsterList.add(new SpawnListEntry(EntityStaballoyConstruct.class, 30, 1, 2)); - //this.spawnableMonsterList.add(new SpawnListEntry(EntityStaballoyConstruct.class, 5, 1, 5)); - - addToMonsterSpawnLists(EntityBlaze.class, 5, 1, 5); - addToMonsterSpawnLists(EntityCaveSpider.class, 5, 1, 5); - addToMonsterSpawnLists(EntityCreeper.class, 4, 1, 2); - addToMonsterSpawnLists(EntityEnderman.class, 5, 1, 5); - addToMonsterSpawnLists(EntitySkeleton.class, 5, 1, 5); - addToMonsterSpawnLists(EntitySpider.class, 5, 1, 5); - addToMonsterSpawnLists(EntityZombie.class, 5, 1, 5); - - //Passive - this.spawnableCreatureList.add(new SpawnListEntry(EntityCow.class, 5, 5, 10)); - this.spawnableCreatureList.add(new SpawnListEntry(EntityBat.class, 4, 4, 8)); - this.spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 5, 4, 10)); - - //Water - this.spawnableWaterCreatureList.add(new SpawnListEntry(EntitySquid.class, 5, 1, 10)); - + + //Enemies + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySickBlaze.class, 100, 2, 6)); + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityPigZombie.class, 75, 4, 16)); + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityStaballoyConstruct.class, 20, 1, 2)); + + //Animals + this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 1, 1, 6)); + this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8)); + + } + + private synchronized boolean setBiomeID() { + BiomeGenBase[] mTempList; + try { + Field mInternalBiomeList = ReflectionUtils.getField(BiomeGenBase.class, "biomeList"); + Field mClone = mInternalBiomeList; + mTempList = (BiomeGenBase[]) mInternalBiomeList.get(null); + if (mTempList != null){ + mTempList[CORE.DARKBIOME_ID] = this; + mInternalBiomeList.set(null, mTempList); + if (mClone != mInternalBiomeList && mClone.hashCode() != mInternalBiomeList.hashCode()){ + ReflectionUtils.setFinalStatic(mInternalBiomeList, mTempList); + Logger.REFLECTION("Set Biome ID for Dark World Biome internally in 'biomeList' field from "+BiomeGenBase.class.getCanonicalName()+"."); + return true; + } + else { + Logger.REFLECTION("Failed to set Biome ID for Dark World Biome internally in 'biomeList' field from "+BiomeGenBase.class.getCanonicalName()+"."); + } + } + return false; + } + catch (Exception e) { + Logger.REFLECTION("Could not access 'biomeList' field in "+BiomeGenBase.class.getCanonicalName()+"."); + return false; + } } @SideOnly(Side.CLIENT) @@ -122,8 +131,8 @@ public class Biome_DarkWorld { public int getSkyColorByTemp(float par1) { return 0xF67A14; } - - @SuppressWarnings("unchecked") + + @SuppressWarnings({ "unchecked", "unused" }) private boolean addToMonsterSpawnLists(Class<?> EntityClass, int a, int b, int c){ //this.spawnableMonsterList.add(new SpawnListEntry(EntityClass, a, b, c)); this.spawnableCaveCreatureList.add(new SpawnListEntry(EntityClass, a, b, c)); diff --git a/src/Java/gtPlusPlus/core/world/darkworld/block/DarkWorldContentLoader.java b/src/Java/gtPlusPlus/core/world/darkworld/block/DarkWorldContentLoader.java new file mode 100644 index 0000000000..0eab691720 --- /dev/null +++ b/src/Java/gtPlusPlus/core/world/darkworld/block/DarkWorldContentLoader.java @@ -0,0 +1,68 @@ +package gtPlusPlus.core.world.darkworld.block; + +import static gtPlusPlus.core.world.darkworld.Dimension_DarkWorld.*; + +import cpw.mods.fml.common.registry.GameRegistry; +import gtPlusPlus.core.block.base.BlockBaseFluid; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.world.darkworld.item.itemDarkWorldPortalTrigger; +import net.minecraft.init.Blocks; +import net.minecraftforge.fluids.FluidRegistry; + +public class DarkWorldContentLoader { + + //Static Vars + public static blockDarkWorldSludgeFluid SLUDGE; + + + public synchronized static void run() { + initMisc(); + initItems(); + initBlocks(); + } + + public synchronized static boolean initMisc(){ + + //Fluids + SLUDGE = (blockDarkWorldSludgeFluid) new blockDarkWorldSludgeFluid( + "sludge", + Utils.rgbtoHexValue(30, 130, 30)) + .setDensity(1800) + .setGaseous(false) + .setLuminosity(2) + .setViscosity(25000) + .setTemperature(300); + FluidRegistry.registerFluid(SLUDGE); + + return true; + } + + public synchronized static boolean initItems(){ + portalItem = (itemDarkWorldPortalTrigger) (new itemDarkWorldPortalTrigger().setUnlocalizedName("dimensionDarkWorld_trigger")); + GameRegistry.registerItem(portalItem, "dimensionDarkWorld_trigger"); + + return true; + } + + public synchronized static boolean initBlocks(){ + + //Create Block Instances + blockFluidLakes = new BlockBaseFluid("Sludge", SLUDGE, blockDarkWorldSludgeFluid.SLUDGE).setLightLevel(2f).setLightOpacity(1).setBlockName("blockDarkWorldSludgeFluid"); + portalBlock = new blockDarkWorldPortal(); + blockTopLayer = new blockDarkWorldGround(); + blockSecondLayer = new blockDarkWorldPollutedDirt(); + blockPortalFrame = new blockDarkWorldPortalFrame(); + + //Registry + GameRegistry.registerBlock(blockTopLayer, "blockDarkWorldGround"); + GameRegistry.registerBlock(blockSecondLayer, "blockDarkWorldGround2"); + GameRegistry.registerBlock(blockPortalFrame, "blockDarkWorldPortalFrame"); + + //Make Flammable + Blocks.fire.setFireInfo(blockTopLayer, 30, 20); + + return true; + } + + +} diff --git a/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldPollutedDirt.java b/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldPollutedDirt.java index 2168677d56..5f3f7e0bfd 100644 --- a/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldPollutedDirt.java +++ b/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldPollutedDirt.java @@ -5,7 +5,6 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.creative.AddToCreativeTab; import net.minecraft.block.BlockDirt; -import net.minecraft.block.BlockGrass; import net.minecraft.world.ColorizerGrass; import net.minecraft.world.IBlockAccess; @@ -19,6 +18,7 @@ public class blockDarkWorldPollutedDirt extends BlockDirt { LanguageRegistry.addName(this, "Polluted Soil"); } + @Override @SideOnly(Side.CLIENT) public int getBlockColor() { @@ -30,6 +30,7 @@ public class blockDarkWorldPollutedDirt extends BlockDirt { /** * Returns the color this block should be rendered. Used by leaves. */ + @Override @SideOnly(Side.CLIENT) public int getRenderColor(int p_149741_1_) { @@ -40,6 +41,7 @@ public class blockDarkWorldPollutedDirt extends BlockDirt { * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called * when first determining what to render. */ + @Override @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_) { diff --git a/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldSludgeFluid.java b/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldSludgeFluid.java new file mode 100644 index 0000000000..c3c9beddc8 --- /dev/null +++ b/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldSludgeFluid.java @@ -0,0 +1,98 @@ +package gtPlusPlus.core.world.darkworld.block; + +import net.minecraft.block.material.*; +import net.minecraftforge.fluids.Fluid; + +public class blockDarkWorldSludgeFluid extends Fluid { + + + public static final Material SLUDGE = new MaterialLiquid(MapColor.dirtColor); + + protected static int mapColor = 0xFFFFFFFF; + protected static float overlayAlpha = 0.2F; + //protected static SoundEvent emptySound = SoundEvents.ITEM_BUCKET_EMPTY; + //protected static SoundEvent fillSound = SoundEvents.ITEM_BUCKET_FILL; + protected static Material material = SLUDGE; + + + public blockDarkWorldSludgeFluid(String fluidName, int rgbColour) { + this(fluidName, rgbColour, null); + } + + public blockDarkWorldSludgeFluid(String fluidName, int rgbColour, Float overlayAlpha) { + super(fluidName); + setColor(rgbColour); + if (overlayAlpha != null){ + setAlpha(overlayAlpha.floatValue()); + } + else { + setAlpha(0); + } + } + + @Override + public int getColor() + { + return mapColor; + } + + public blockDarkWorldSludgeFluid setColor(int parColor) + { + mapColor = parColor; + return this; + } + + public float getAlpha() + { + return overlayAlpha; + } + + public blockDarkWorldSludgeFluid setAlpha(float parOverlayAlpha) + { + overlayAlpha = parOverlayAlpha; + return this; + } + + /*public blockDarkWorldSludgeFluid setEmptySound(SoundEvent parSound) + { + emptySound = parSound; + return this; + } + + public SoundEvent getEmptySound() + { + return emptySound; + } + + @Override + public blockDarkWorldSludgeFluid setFillSound(SoundEvent parSound) + { + fillSound = parSound; + return this; + } + + @Override + public SoundEvent getFillSound() + { + return fillSound; + }*/ + + public blockDarkWorldSludgeFluid setMaterial(Material parMaterial) + { + material = parMaterial; + return this; + } + + public Material getMaterial() + { + return material; + } + + /*@Override + public boolean doesVaporize(FluidStack fluidStack) + { + if (block == null) + return false; + return block.getDefaultState().getMaterial() == getMaterial(); + }*/ +} diff --git a/src/Java/gtPlusPlus/core/world/darkworld/chunk/ChunkProviderModded.java b/src/Java/gtPlusPlus/core/world/darkworld/chunk/ChunkProviderModded.java index 2e5ce4510e..82b21d7c0d 100644 --- a/src/Java/gtPlusPlus/core/world/darkworld/chunk/ChunkProviderModded.java +++ b/src/Java/gtPlusPlus/core/world/darkworld/chunk/ChunkProviderModded.java @@ -3,7 +3,7 @@ package gtPlusPlus.core.world.darkworld.chunk; import java.util.List; import java.util.Random; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.world.darkworld.Dimension_DarkWorld; import net.minecraft.block.Block; import net.minecraft.block.BlockFalling; @@ -171,7 +171,12 @@ public class ChunkProviderModded implements IChunkProvider { p_147424_3_[j3 += short1] = Dimension_DarkWorld.blockMainFiller; } else if (k2 * 8 + l2 < b0) { - p_147424_3_[j3 += short1] = Blocks.water; //River Fluid + try { + p_147424_3_[j3 += short1] = Dimension_DarkWorld.blockFluidLakes; //River Fluid . + } + catch (Throwable t){ + p_147424_3_[j3 += short1] = Blocks.water; //River Fluid Fallback + } } else { p_147424_3_[j3 += short1] = null; @@ -391,7 +396,7 @@ public class ChunkProviderModded implements IChunkProvider { } catch (NullPointerException n){ n.getStackTrace(); (new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, k1, l1, i2); - Utils.LOG_INFO("Error while generating DarkWorld Lake."); + Logger.INFO("Error while generating DarkWorld Lake."); } } @@ -406,7 +411,7 @@ public class ChunkProviderModded implements IChunkProvider { try{ (new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, k1, l1, i2); } catch (NullPointerException n){ - Utils.LOG_INFO("Error while generating DarkWorld Lake. [2]"); + Logger.INFO("Error while generating DarkWorld Lake. [2]"); } } } diff --git a/src/Java/gtPlusPlus/core/world/darkworld/gen/WorldGenDeadLilly.java b/src/Java/gtPlusPlus/core/world/darkworld/gen/WorldGenDeadLilly.java index 292eff3289..22c3b5a090 100644 --- a/src/Java/gtPlusPlus/core/world/darkworld/gen/WorldGenDeadLilly.java +++ b/src/Java/gtPlusPlus/core/world/darkworld/gen/WorldGenDeadLilly.java @@ -1,13 +1,15 @@ package gtPlusPlus.core.world.darkworld.gen; import java.util.Random; + import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenWaterlily; public class WorldGenDeadLilly extends WorldGenWaterlily { - public boolean generate(World world, Random rand, int x, int y, int z) + @Override + public boolean generate(World world, Random rand, int x, int y, int z) { for (int l = 0; l < 10; ++l) { diff --git a/src/Java/gtPlusPlus/core/world/darkworld/gen/WorldGenMinable_Custom.java b/src/Java/gtPlusPlus/core/world/darkworld/gen/WorldGenMinable_Custom.java index 4dc033214f..58937c8a40 100644 --- a/src/Java/gtPlusPlus/core/world/darkworld/gen/WorldGenMinable_Custom.java +++ b/src/Java/gtPlusPlus/core/world/darkworld/gen/WorldGenMinable_Custom.java @@ -1,6 +1,10 @@ package gtPlusPlus.core.world.darkworld.gen; +import static gtPlusPlus.core.lib.CORE.PI; + import java.util.Random; + +import gtPlusPlus.api.objects.Logger; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.MathHelper; @@ -9,83 +13,77 @@ import net.minecraft.world.gen.feature.WorldGenMinable; public class WorldGenMinable_Custom extends WorldGenMinable { - /** The block to generate. */ - private Block oreToGenerate; - /** The number of blocks to generate. */ - private int numberOfBlocks; - /** The block to replace. */ - private Block blockToReplace; - /** The meta of the block. */ - private int mineableBlockMeta; - - public WorldGenMinable_Custom(Block block, int count){ - super(block, count, Blocks.stone); - } - - public WorldGenMinable_Custom(Block block, int count, Block target){ - super(block, count, target); - this.oreToGenerate = block; - this.numberOfBlocks = count; - this.blockToReplace = target; - } - - public WorldGenMinable_Custom(Block block, int meta, int number, Block target){ - this(block, number, target); - this.mineableBlockMeta = meta; - } + /** The block to generate. */ + private Block oreToGenerate; + /** The number of blocks to generate. */ + private int numberOfBlocks; + /** The block to replace. */ + private Block blockToReplace; + /** The meta of the block. */ + private int mineableBlockMeta; - public boolean generate(World world, Random rand, int x, int y, int z) - { - float f = rand.nextFloat() * (float)Math.PI; - double d0 = (double)((float)(x + 16) + MathHelper.sin(f) * (float)this.numberOfBlocks / 4.0F); - double d1 = (double)((float)(x + 16) - MathHelper.sin(f) * (float)this.numberOfBlocks / 4.0F); - double d2 = (double)((float)(z + 16) + MathHelper.cos(f) * (float)this.numberOfBlocks / 4.0F); - double d3 = (double)((float)(z + 16) - MathHelper.cos(f) * (float)this.numberOfBlocks / 4.0F); - double d4 = (double)(y + rand.nextInt(5) - 2); - double d5 = (double)(y + rand.nextInt(5) - 2); + public WorldGenMinable_Custom(final Block block, final int count){ + super(block, count, Blocks.stone); + } - for (int l = 0; l <= this.numberOfBlocks; ++l) - { - double d6 = d0 + (d1 - d0) * (double)l / (double)this.numberOfBlocks; - double d7 = d4 + (d5 - d4) * (double)l / (double)this.numberOfBlocks; - double d8 = d2 + (d3 - d2) * (double)l / (double)this.numberOfBlocks; - double d9 = rand.nextDouble() * (double)this.numberOfBlocks / 8.0D; - double d10 = (double)(MathHelper.sin((float)l * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * d9 + 1.0D; - double d11 = (double)(MathHelper.sin((float)l * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * d9 + 1.0D; - int i1 = MathHelper.floor_double(d6 - d10 / 2.0D); - int j1 = MathHelper.floor_double(d7 - d11 / 2.0D); - int k1 = MathHelper.floor_double(d8 - d10 / 2.0D); - int l1 = MathHelper.floor_double(d6 + d10 / 2.0D); - int i2 = MathHelper.floor_double(d7 + d11 / 2.0D); - int j2 = MathHelper.floor_double(d8 + d10 / 2.0D); + public WorldGenMinable_Custom(final Block block, final int count, final Block target){ + super(block, count, target); + this.oreToGenerate = block; + this.numberOfBlocks = count; + this.blockToReplace = target; + } - for (int k2 = i1; k2 <= l1; ++k2) - { - double d12 = ((double)k2 + 0.5D - d6) / (d10 / 2.0D); + public WorldGenMinable_Custom(final Block block, final int meta, final int number, final Block target){ + this(block, number, target); + this.mineableBlockMeta = meta; + } - if (d12 * d12 < 1.0D) - { - for (int l2 = j1; l2 <= i2; ++l2) - { - double d13 = ((double)l2 + 0.5D - d7) / (d11 / 2.0D); + @Override + public boolean generate(final World world, final Random rand, final int x, final int y, final int z) + { + final float f = rand.nextFloat() * PI; + final double d0 = x + 16 + ((MathHelper.sin(f) * this.numberOfBlocks) / 4.0F); + final double d1 = (x + 16) - ((MathHelper.sin(f) * this.numberOfBlocks) / 4.0F); + final double d2 = z + 16 + ((MathHelper.cos(f) * this.numberOfBlocks) / 4.0F); + final double d3 = (z + 16) - ((MathHelper.cos(f) * this.numberOfBlocks) / 4.0F); + final double d4 = (y + rand.nextInt(8)) - 1; + final double d5 = (y + rand.nextInt(8)) - 1; - if (d12 * d12 + d13 * d13 < 1.0D) - { - for (int i3 = k1; i3 <= j2; ++i3) - { - double d14 = ((double)i3 + 0.5D - d8) / (d10 / 2.0D); + for (int l = 0; l <= this.numberOfBlocks; ++l) + { + final double d6 = d0 + (((d1 - d0) * l) / this.numberOfBlocks); + final double d7 = d4 + (((d5 - d4) * l) / this.numberOfBlocks); + final double d8 = d2 + (((d3 - d2) * l) / this.numberOfBlocks); + final double d9 = (rand.nextDouble() * this.numberOfBlocks) / 8.0D; + final double d10 = ((MathHelper.sin((l * PI) / this.numberOfBlocks) + 1.0F) * d9) + 1.0D; + final double d11 = ((MathHelper.sin((l * PI) / this.numberOfBlocks) + 1.0F) * d9) + 1.0D; + final int i1 = MathHelper.floor_double(d6 - (d10 / 2.0D)); + final int j1 = MathHelper.floor_double(d7 - (d11 / 2.0D)); + final int k1 = MathHelper.floor_double(d8 - (d10 / 2.0D)); + final int l1 = MathHelper.floor_double(d6 + (d10 / 2.0D)); + final int i2 = MathHelper.floor_double(d7 + (d11 / 2.0D)); + final int j2 = MathHelper.floor_double(d8 + (d10 / 2.0D)); - if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && world.getBlock(k2, l2, i3).isReplaceableOreGen(world, k2, l2, i3, blockToReplace)) - { - world.setBlock(k2, l2, i3, this.oreToGenerate, mineableBlockMeta, 2); - } - } - } - } - } - } - } + for (int k2 = i1; k2 <= l1; ++k2){ + final double d12 = ((k2 + 0.5D) - d6) / (d10 / 2.0D); + if ((d12 * d12) < 1.0D){ + for (int l2 = j1; l2 <= i2; ++l2){ + final double d13 = ((l2 + 0.5D) - d7) / (d11 / 2.0D); + if (((d12 * d12) + (d13 * d13)) < 1.0D){ + for (int i3 = k1; i3 <= j2; ++i3){ + final double d14 = ((i3 + 0.5D) - d8) / (d10 / 2.0D); + if ((((d12 * d12) + (d13 * d13) + (d14 * d14)) < 1.0D) && world.getBlock(k2, l2, i3).isReplaceableOreGen(world, k2, l2, i3, this.blockToReplace)) + { + world.setBlock(k2, l2, i3, this.oreToGenerate, this.mineableBlockMeta, 3); + Logger.INFO("Generated a "+this.oreToGenerate.getLocalizedName()+" at x: "+k2+" | y: "+l2+" | z: "+i3); + } + } + } + } + } + } + } - return true; - } + return true; + } }
\ 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 new file mode 100644 index 0000000000..f04609dc6f --- /dev/null +++ b/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Base.java @@ -0,0 +1,412 @@ +package gtPlusPlus.core.world.darkworld.gen.gt; + +import java.util.*; + +import cpw.mods.fml.common.IWorldGenerator; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.util.GT_Log; +import gregtech.api.world.GT_Worldgen; +import gtPlusPlus.api.objects.CSPRNG; +import gtPlusPlus.core.world.darkworld.Dimension_DarkWorld; +import gtPlusPlus.xmod.gregtech.api.objects.XSTR; +import net.minecraft.block.Block; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.ChunkProviderEnd; +import net.minecraft.world.gen.ChunkProviderHell; +import net.minecraft.world.gen.feature.WorldGenMinable; + +public class WorldGen_GT_Base implements IWorldGenerator{ + + /** + * Class Variables + */ + + /** + * Control percentage of filled 3x3 chunks. Lower number means less oreveins spawn + */ + public static int oreveinPercentage; + /** + * Control number of attempts to find a valid orevein. Generally this maximum limit isn't hit, selecting a vein is cheap + */ + public static int oreveinAttempts; + /** + * Control number of attempts to place a valid orevein. If a vein wasn't placed due to height restrictions, completely in the water, etc, another attempt is tried. + */ + public static int oreveinMaxPlacementAttempts; + /** + * Debug parameter for world generation. Tracks chunks added/removed from run queue. + */ + public static boolean debugWorldGen = false; + /** + * Try re-implement Richard Hendrick's Chunk by Chunk Ore Generation from his GT5u fork. + */ + + public static List<Runnable> mList = new ArrayList<Runnable>(); + public static HashSet<Long> ProcChunks = new HashSet<Long>(); + // This is probably not going to work. Trying to create a fake orevein to put into hashtable when there will be no ores in a vein. + public static WorldGen_GT_Ore_Layer noOresInVein = new WorldGen_GT_Ore_Layer( "NoOresInVein", false, 0, 255, 0, 255, 16, false, false, false, false, false, false, Materials.Aluminium, Materials.Aluminium, Materials.Aluminium, Materials.Aluminium); + public static Hashtable<Long, WorldGen_GT_Ore_Layer> validOreveins = new Hashtable<Long, WorldGen_GT_Ore_Layer>(1024); + public boolean mIsGenerating = false; + public static final Object listLock = new Object(); + //private static boolean gcAsteroids = true; + + + public WorldGen_GT_Base(){ + GameRegistry.registerWorldGenerator(this, 7735); + if (debugWorldGen) { + GT_Log.out.println("GTPP_Worldgenerator created"); + } + } + + + @Override + public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { + if (world.provider.dimensionId == Dimension_DarkWorld.DIMID) { + generateSafely(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider); + } + } + + public synchronized void generateSafely(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){ + int xDim = Dimension_DarkWorld.DIMID; + switch(world.provider.dimensionId){ + case -1: //Nether + generateNether(world, random, chunkX * 16, chunkZ * 16); + break; + case 0: //Overworld + generateSurface(world, random, chunkX * 16, chunkZ * 16); + break; + case 1: //End + generateEnd(world, random, chunkX * 16, chunkZ * 16); + break; + default: //Any other dimension + if (world.provider.dimensionId != xDim){ + break; + } + else { + generateDarkWorld(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider); + break; + } + } + } + + private void generateEnd(World world, Random random, int x, int z) + { + //... + } + + private void generateSurface(World world, Random random, int x, int z) + { + //... + } + + private void generateNether(World world, Random random, int x, int z) + { + //... + } + + private void generateDarkWorld(Random aRandom, int aX, int aZ, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider){ + synchronized (listLock) + { + WorldGen_GT_Base.mList.add(new WorldGenContainer(new XSTR(Math.abs(aRandom.nextInt()) +1), aX, aZ, ((aChunkGenerator instanceof ChunkProviderEnd)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.sky) ? 1 : ((aChunkGenerator instanceof ChunkProviderHell)) || (aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8) == BiomeGenBase.hell) ? -1 : 0, aWorld, aChunkGenerator, aChunkProvider, aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8).biomeName)); + if (debugWorldGen) GT_Log.out.println( + "ADD WorldSeed:"+aWorld.getSeed() + + " DimId" + aWorld.provider.dimensionId + + " chunk x:" + aX + + " z:" + aZ + + " SIZE: " + WorldGen_GT_Base.mList.size() + ); + } + + if (!this.mIsGenerating) { + this.mIsGenerating = true; + int mList_sS=WorldGen_GT_Base.mList.size(); + mList_sS = Math.min(mList_sS, 5); // Run a maximum of 5 chunks at a time through worldgen. Extra chunks get done later. + for (int i = 0; i < mList_sS; i++) { + WorldGenContainer toRun = (WorldGenContainer) WorldGen_GT_Base.mList.get(0); + if (debugWorldGen) GT_Log.out.println( + "RUN WorldSeed:"+aWorld.getSeed()+ + " DimId" + aWorld.provider.dimensionId + + " chunk x:" + toRun.mX + + " z:" + toRun.mZ + + " SIZE: " + WorldGen_GT_Base.mList.size() + + " i: " + i + ); + synchronized (listLock) + { + WorldGen_GT_Base.mList.remove(0); + } + toRun.run(); + } + this.mIsGenerating = false; + } + } + + public void generateOre(Block block, World world, Random random, int chunk_x, int chunk_z, int maxX, int maxZ, int maxVeinSize, int chancesToSpawn, int minY, int maxY, Block generateIn) + { + + + int heightRange = maxY - minY; + WorldGenMinable worldgenminable = new WorldGenMinable(block, maxVeinSize, generateIn); + for (int k1 = 0; k1 < chancesToSpawn; ++k1) + { + int xrand = random.nextInt(16); + int yrand = random.nextInt(heightRange) + minY; + int zrand = random.nextInt(16); + worldgenminable.generate(world, random, chunk_x+xrand, yrand, chunk_z+zrand); + } + } + + + + + + + + + + + + + + public static class WorldGenContainer + implements Runnable { + public final Random mRandom; + public final int mX; + public final int mZ; + public final int mDimensionType; + public final World mWorld; + public final IChunkProvider mChunkGenerator; + public final IChunkProvider mChunkProvider; + public final String mBiome; + // Local class to track which orevein seeds must be checked when doing chunkified worldgen + class NearbySeeds { + public int mX; + public int mZ; + NearbySeeds( int x, int z) { + this.mX = x; + this.mZ = z; + } + }; + public static ArrayList<NearbySeeds> seedList = new ArrayList<NearbySeeds>(); + + // aX and aZ are now the by-chunk X and Z for the chunk of interest + public WorldGenContainer(Random aRandom, int aX, int aZ, int aDimensionType, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider, String aBiome) { + this.mRandom = aRandom; + this.mX = aX; + this.mZ = aZ; + this.mDimensionType = aDimensionType; + this.mWorld = aWorld; + this.mChunkGenerator = aChunkGenerator; + this.mChunkProvider = aChunkProvider; + this.mBiome = aBiome; + } + + public void worldGenFindVein( int oreseedX, int oreseedZ) { + // Explanation of oreveinseed implementation. + // (long)this.mWorld.getSeed()<<16) Deep Dark does two oregen passes, one with getSeed set to +1 the original world seed. This pushes that +1 off the low bits of oreseedZ, so that the hashes are far apart for the two passes. + // ((this.mWorld.provider.dimensionId & 0xffL)<<56) Puts the dimension in the top bits of the hash, to make sure to get unique hashes per dimension + // ((long)oreseedX & 0x000000000fffffffL) << 28) Puts the chunk X in the bits 29-55. Cuts off the top few bits of the chunk so we have bits for dimension. + // ( (long)oreseedZ & 0x000000000fffffffL )) Puts the chunk Z in the bits 0-27. Cuts off the top few bits of the chunk so we have bits for dimension. + long oreveinSeed = (this.mWorld.getSeed()<<16) ^ ((this.mWorld.provider.dimensionId & 0xffL)<<56 |( (oreseedX & 0x000000000fffffffL) << 28) | ( oreseedZ & 0x000000000fffffffL )); // Use an RNG that is identical every time it is called for this oreseed. + CSPRNG oreveinRNG = CSPRNG.generate(new XSTR(oreveinSeed)); + int oreveinPercentageRoll = oreveinRNG.nextInt(100); // Roll the dice, see if we get an orevein here at all + int noOrePlacedCount=0; + String tDimensionName = ""; + if (debugWorldGen) { tDimensionName = this.mWorld.provider.getDimensionName(); } + + if (debugWorldGen) GT_Log.out.println( + " Finding oreveins for oreveinSeed="+ oreveinSeed + + " mX="+ this.mX + + " mZ="+ this.mZ + + " oreseedX="+ oreseedX + + " oreseedZ="+ oreseedZ + + " worldSeed="+this.mWorld.getSeed() + ); + + // Search for a valid orevein for this dimension + if(validOreveins.size() > 0 && !validOreveins.containsKey(oreveinSeed) ) { + if ( (oreveinPercentageRoll<oreveinPercentage) && (WorldGen_GT_Ore_Layer.sWeight > 0) && (WorldGen_GT_Ore_Layer.sList.size() > 0)) { + int placementAttempts = 0; + boolean oreveinFound = false; + int i; + for( i = 0; (i < oreveinAttempts) && (!oreveinFound) && (placementAttempts<oreveinMaxPlacementAttempts); i++ ) { + int tRandomWeight = oreveinRNG.nextInt(WorldGen_GT_Ore_Layer.sWeight); + for (WorldGen_GT_Ore_Layer tWorldGen : WorldGen_GT_Ore_Layer.sList) { + tRandomWeight -= ( tWorldGen).mWeight; + if (tRandomWeight <= 0) { + try { + // Adjust the seed so that this layer has a series of unique random numbers. Otherwise multiple attempts at this same oreseed will get the same offset and X/Z values. If an orevein failed, any orevein with the + // same minimum heights would fail as well. This prevents that, giving each orevein a unique height each pass through here. + int placementResult = tWorldGen.executeWorldgenChunkified(this.mWorld, new XSTR( oreveinSeed ^ (tWorldGen.mPrimaryMeta)), this.mBiome, this.mDimensionType, this.mX*16, this.mZ*16, oreseedX*16, oreseedZ*16, this.mChunkGenerator, this.mChunkProvider); + switch(placementResult) { + case WorldGen_GT_Ore_Layer.ORE_PLACED: + if (debugWorldGen) GT_Log.out.println( + " Added oreveinSeed=" + oreveinSeed + + " tries at oremix=" + i + + " placementAttempts=" + placementAttempts + + " dimensionName=" + tDimensionName + ); + validOreveins.put(oreveinSeed, tWorldGen); + oreveinFound = true; + break; + case WorldGen_GT_Ore_Layer.NO_ORE_IN_BOTTOM_LAYER: + placementAttempts++; + // SHould do retry in this case until out of chances + break; + case WorldGen_GT_Ore_Layer.NO_OVERLAP: + // Orevein didn't reach this chunk, can't add it yet to the hash + break; + } + break; // Try the next orevein + } catch (Throwable e) { + if (debugWorldGen) GT_Log.out.println( + "Exception occurred on oreVein" + tWorldGen + + " oreveinSeed="+ oreveinSeed + + " mX="+ this.mX + + " mZ="+ this.mZ + + " oreseedX="+ oreseedX + + " oreseedZ="+ oreseedZ + ); + e.printStackTrace(GT_Log.err); + } + } + } + } + // Only add an empty orevein if are unable to place a vein at the oreseed chunk. + if ((!oreveinFound) && (this.mX == oreseedX) && (this.mZ == oreseedZ)){ + if (debugWorldGen) GT_Log.out.println( + " Empty oreveinSeed="+ oreveinSeed + + " mX="+ this.mX + + " mZ="+ this.mZ + + " oreseedX="+ oreseedX + + " oreseedZ="+ oreseedZ + + " tries at oremix=" + i + + " placementAttempts=" + placementAttempts + + " dimensionName=" + tDimensionName + ); + validOreveins.put(oreveinSeed, noOresInVein ); + } + } else if(oreveinPercentageRoll >= oreveinPercentage) { + if (debugWorldGen) GT_Log.out.println( + " Skipped oreveinSeed="+ oreveinSeed + + " mX="+ this.mX + + " mZ="+ this.mZ + + " oreseedX=" + oreseedX + + " oreseedZ="+ oreseedZ + + " RNG=" + oreveinPercentageRoll + + " %=" + oreveinPercentage+ + " dimensionName=" + tDimensionName + ); + validOreveins.put(oreveinSeed, noOresInVein); + } + }else { + // oreseed is located in the previously processed table + if (debugWorldGen) GT_Log.out.print( + " Valid oreveinSeed="+ oreveinSeed + + " validOreveins.size()=" + validOreveins.size() + " " + ); + WorldGen_GT_Ore_Layer tWorldGen = validOreveins.get(oreveinSeed); + oreveinRNG.setSeed(oreveinSeed ^ (tWorldGen.mPrimaryMeta)); // Reset RNG to only be based on oreseed X/Z and type of vein + int placementResult = tWorldGen.executeWorldgenChunkified(this.mWorld, oreveinRNG, this.mBiome, this.mDimensionType, this.mX*16, this.mZ*16, oreseedX*16, oreseedZ*16, this.mChunkGenerator, this.mChunkProvider); + switch( placementResult ) + { + case WorldGen_GT_Ore_Layer.NO_ORE_IN_BOTTOM_LAYER: + if (debugWorldGen) GT_Log.out.println( + " No ore in bottom layer" + ); + break; + case WorldGen_GT_Ore_Layer.NO_OVERLAP: + if (debugWorldGen) GT_Log.out.println( + " No overlap" + ); + } + } + } + + @Override + public void run() { + long startTime = System.nanoTime(); + int oreveinMaxSize; + + // Determine bounding box on how far out to check for oreveins affecting this chunk + // For now, manually reducing oreveinMaxSize when not in the Underdark for performance + if(this.mWorld.provider.getDimensionName().equals("Underdark") ) { + oreveinMaxSize=32; // Leave Deep Dark/Underdark max oregen at 32, instead of 64 + } else { + oreveinMaxSize=32; + } + + int wXbox = this.mX - (oreveinMaxSize/16); + int eXbox = this.mX + (oreveinMaxSize/16 + 1); // Need to add 1 since it is compared using a < + int nZbox = this.mZ - (oreveinMaxSize/16); + int sZbox = this.mZ + (oreveinMaxSize/16 + 1); + + // Search for orevein seeds and add to the list; + for( int x = wXbox; x < eXbox; x++ ) { + for( int z = nZbox; z < sZbox; z++ ) { + // Determine if this X/Z is an orevein seed + if ( ( (Math.abs(x)%3) == 1) && ( (Math.abs(z)%3) == 1 ) ) { + if (debugWorldGen) GT_Log.out.println( + "Adding seed x="+x+ + " z="+z + ); + seedList.add( new NearbySeeds(x,z) ); + } + } + } + + // Now process each oreseed vs this requested chunk + for( ; seedList.size() != 0; seedList.remove(0) ) { + if (debugWorldGen) GT_Log.out.println( + "Processing seed x="+seedList.get(0).mX+ + " z="+seedList.get(0).mZ + ); + worldGenFindVein( seedList.get(0).mX, seedList.get(0).mZ ); + } + + long oregenTime = System.nanoTime(); + + // Do leftover worldgen for this chunk (GT_Stones and GT_small_ores) + try { + for (GT_Worldgen tWorldGen : GregTech_API.sWorldgenList) { + /* + if (debugWorldGen) GT_Log.out.println( + "tWorldGen.mWorldGenName="+tWorldGen.mWorldGenName + ); + */ + tWorldGen.executeWorldgen(this.mWorld, this.mRandom, this.mBiome, this.mDimensionType, this.mX*16, this.mZ*16, this.mChunkGenerator, this.mChunkProvider); + } + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); + } + + long leftOverTime = System.nanoTime(); + + + + Chunk tChunk = this.mWorld.getChunkFromBlockCoords(this.mX, this.mZ); + if (tChunk != null) { + tChunk.isModified = true; + } + long endTime = System.nanoTime(); + long duration = (endTime - startTime); + if (debugWorldGen) { + GT_Log.out.println( + " Oregen took " + (oregenTime-startTime)+ + " Leftover gen took " + (leftOverTime - oregenTime ) + + " Worldgen took " + duration + + " nanoseconds" + ); + } + } + } + + +} + + diff --git a/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Ore_Layer.java b/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Ore_Layer.java new file mode 100644 index 0000000000..3f2673a770 --- /dev/null +++ b/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Ore_Layer.java @@ -0,0 +1,272 @@ +package gtPlusPlus.core.world.darkworld.gen.gt; + +import static gtPlusPlus.core.world.darkworld.gen.gt.WorldGen_GT_Base.debugWorldGen; + +import java.util.ArrayList; +import java.util.Random; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.util.GT_Log; +import gregtech.api.world.GT_Worldgen; +import gregtech.common.blocks.GT_TileEntity_Ores; +import gregtech.loaders.misc.GT_Achievements; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkProvider; + +public class WorldGen_GT_Ore_Layer + extends GT_Worldgen { + public static ArrayList<WorldGen_GT_Ore_Layer> sList = new ArrayList<WorldGen_GT_Ore_Layer>(); + public static int sWeight = 0; + public final short mMinY; + public final short mMaxY; + public final short mWeight; + public final short mDensity; + public final short mSize; + public final short mPrimaryMeta; + public final short mSecondaryMeta; + public final short mBetweenMeta; + public final short mSporadicMeta; + //public final String mBiome; + public final String mRestrictBiome; + public final boolean mOverworld; + public final boolean mNether; + public final boolean mEnd; + public static final int WRONG_BIOME=0; + public static final int WRONG_DIMENSION=1; + public static final int NO_ORE_IN_BOTTOM_LAYER=2; + public static final int NO_OVERLAP=3; + public static final int ORE_PLACED=4; + + + //public final boolean mMoon; + //public final boolean mMars; + //public final boolean mAsteroid; + public final String aTextWorldgen = "worldgen."; + + public WorldGen_GT_Ore_Layer(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, boolean aOverworld, boolean aNether, boolean aEnd, boolean GC_UNUSED1, boolean GC_UNUSED2, boolean GC_UNUSED3, Materials aPrimary, Materials aSecondary, Materials aBetween, Materials aSporadic) { + super(aName, sList, aDefault); + this.mOverworld = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Overworld", aOverworld); + this.mNether = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Nether", aNether); + this.mEnd = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "TheEnd", aEnd); + //this.mMoon = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Moon", aMoon); + //this.mMars = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Mars", aMars); + //this.mAsteroid = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Asteroid", aAsteroid); + this.mMinY = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MinHeight", aMinY)); + short mMaxY = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "MaxHeight", aMaxY)); + if (mMaxY < (this.mMinY + 7)) { + GT_Log.out.println( + "Oremix " + this.mWorldGenName + + " has invalid Min/Max heights!" + ); + mMaxY = (short) (this.mMinY + 7); + } + this.mMaxY = mMaxY; + this.mWeight = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight)); + this.mDensity = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Density", aDensity)); + this.mSize = ((short) Math.max(1, GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Size", aSize))); + this.mPrimaryMeta = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OrePrimaryLayer", aPrimary.mMetaItemSubID)); + this.mSecondaryMeta = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSecondaryLayer", aSecondary.mMetaItemSubID)); + this.mBetweenMeta = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporadiclyInbetween", aBetween.mMetaItemSubID)); + this.mSporadicMeta = ((short) GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "OreSporaticlyAround", aSporadic.mMetaItemSubID)); + this.mRestrictBiome = GregTech_API.sWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RestrictToBiomeName", "None"); + + //if (mPrimaryMeta != -1 && GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)] == null) throw new IllegalArgumentException("A Material for the supplied ID " + mPrimaryMeta + " for " + mWorldGenName + " does not exist"); + //if (mSecondaryMeta != -1 && GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)] == null) throw new IllegalArgumentException("A Material for the supplied ID " + mSecondaryMeta + " for " + mWorldGenName + " does not exist"); + //if (mBetweenMeta != -1 && GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)] == null) throw new IllegalArgumentException("A Material for the supplied ID " + mBetweenMeta + " for " + mWorldGenName + " does not exist"); + //if (mPrimaryMeta != -1 && GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)] == null) throw new IllegalArgumentException("A Material for the supplied ID " + mSporadicMeta + " for " + mWorldGenName + " does not exist"); + + if (this.mEnabled) { + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)], aMinY, aMaxY, aWeight, aOverworld, aNether, aEnd); + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)], aMinY, aMaxY, aWeight, aOverworld, aNether, aEnd); + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)], aMinY, aMaxY, aWeight, aOverworld, aNether, aEnd); + GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)], aMinY, aMaxY, aWeight, aOverworld, aNether, aEnd); + sWeight += this.mWeight; + } + } + + public int executeWorldgenChunkified(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, int aSeedX, int aSeedZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { + if( mWorldGenName.equals("NoOresInVein") ) { + if (debugWorldGen) GT_Log.out.println( + " NoOresInVein" + ); + // This is a special empty orevein + return ORE_PLACED; + } + if (!isGenerationAllowed(aWorld, aDimensionType, ((aDimensionType == -1) && (this.mNether)) || ((aDimensionType == 0) && (this.mOverworld)) || ((aDimensionType == 1) && (this.mEnd)) ? aDimensionType : aDimensionType ^ 0xFFFFFFFF)) { + /* // Debug code, but spams log + if (debugWorldGen) { + GT_Log.out.println( + "Wrong dimension" + ); + } + */ + return WRONG_DIMENSION; + } + if (!this.mRestrictBiome.equals("None") && !(this.mRestrictBiome.equals(aBiome))) { + return WRONG_BIOME; + } + int[] placeCount=new int[4]; + + int tMinY = mMinY + aRandom.nextInt(mMaxY - mMinY - 5); + // Determine West/East ends of orevein + int wXVein = aSeedX - aRandom.nextInt(mSize); // West side + int eXVein = aSeedX + 16 + aRandom.nextInt(mSize); + // Limit Orevein to only blocks present in current chunk + int wX = Math.max( wXVein, aChunkX + 2); // Bias placement by 2 blocks to prevent worldgen cascade. + int eX = Math.min( eXVein, aChunkX + 2 + 16); + if (wX >= eX) { //No overlap between orevein and this chunk exists in X + /* + if (debugWorldGen) { + GT_Log.out.println( + "No X overlap" + ); + } + */ + return NO_OVERLAP; + } + // Determine North/Sound ends of orevein + int nZVein = aSeedZ - aRandom.nextInt(mSize); + int sZVein = aSeedZ + 16 + aRandom.nextInt(mSize); + + int nZ = Math.max(nZVein, aChunkZ + 2); // Bias placement by 2 blocks to prevent worldgen cascade. + int sZ = Math.min(sZVein, aChunkZ + 2 + 16); + if (nZ >= sZ) { //No overlap between orevein and this chunk exists in Z + /* + if (debugWorldGen) { + GT_Log.out.println( + "No Z overlap" + ); + } + */ + return NO_OVERLAP; + } + // Adjust the density down the more chunks we are away from the oreseed. The 5 chunks surrounding the seed should always be max density due to truncation of Math.sqrt(). + int localDensity = Math.max(1, this.mDensity / ((int)Math.sqrt(2 + Math.pow(aChunkX/16 - aSeedX/16, 2) + Math.pow(aChunkZ/16 - aSeedZ/16, 2))) ); + + // To allow for early exit due to no ore placed in the bottom layer (probably because we are in the sky), unroll 1 pass through the loop + // Now we do bottom-level-first oregen, and work our way upwards. + int level = tMinY - 1; //Dunno why, but the first layer is actually played one below tMinY. Go figure. + for (int tX = wX; tX < eX; tX++) { + int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity); + for (int tZ = nZ; tZ < sZ; tZ++) { + int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity); + if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSecondaryMeta > 0) ) { + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSecondaryMeta, false, false)) { + placeCount[1]++; + } + } + else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta > 0) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) + placeCount[3]++; + } + } + } + if ((placeCount[1]+placeCount[3])==0) { + if (debugWorldGen) GT_Log.out.println( + " No ore in bottom layer" + ); + return NO_ORE_IN_BOTTOM_LAYER; // Exit early, didn't place anything in the bottom layer + } + for (level = tMinY; level < (tMinY-1+3); level++) { + for (int tX = wX; tX < eX; tX++) { + int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity); + for (int tZ = nZ; tZ < sZ; tZ++) { + int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity); + if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSecondaryMeta > 0) ) { + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSecondaryMeta, false, false)) { + placeCount[1]++; + } + } + else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta > 0) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) + placeCount[3]++; + } + } + } + } + // Low Middle layer is between + sporadic + // level should be = tMinY-1+3 from end of for loop + for (int tX = wX; tX < eX; tX++) { + int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity); + for (int tZ = nZ; tZ < sZ; tZ++) { + int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity); + if ((aRandom.nextInt(2) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mBetweenMeta > 0) ) { // Between are only 1 per vertical column, reduce by 1/2 to compensate + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, false)) { + placeCount[2]++; + } + } + else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta > 0) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) + placeCount[3]++; + } + } + } + // High Middle layer is between + primary + sporadic + level++; // Increment level to next layer + for (int tX = wX; tX < eX; tX++) { + int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity); + for (int tZ = nZ; tZ < sZ; tZ++) { + int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity); + if ((aRandom.nextInt(2) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mBetweenMeta > 0) ) { // Between are only 1 per vertical column, reduce by 1/2 to compensate + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, false)) { + placeCount[2]++; + } + } + else if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mPrimaryMeta > 0) ) { + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mPrimaryMeta, false, false)) { + placeCount[0]++; + } + } + else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta > 0) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) + placeCount[3]++; + } + } + } + // Top two layers are primary + sporadic + level++; // Increment level to next layer + for( ; level < (tMinY + 6); level++){ // should do two layers + for (int tX = wX; tX < eX; tX++) { + int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity); + for (int tZ = nZ; tZ < sZ; tZ++) { + int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity); + if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mPrimaryMeta > 0) ) { + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mPrimaryMeta, false, false)) { + placeCount[0]++; + } + } + else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta > 0) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate + if (GT_TileEntity_Ores.setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) + placeCount[3]++; + } + } + } + } + if (debugWorldGen) { + String tDimensionName = aWorld.provider.getDimensionName(); + GT_Log.out.println( + "Generated Orevein:" + this.mWorldGenName + + " Dimension=" + tDimensionName + + " mX="+aChunkX/16+ + " mZ="+aChunkZ/16+ + " oreseedX="+ aSeedX/16 + + " oreseedZ="+ aSeedZ/16 + + " cY="+tMinY+ + " wXVein" + wXVein + + " eXVein" + eXVein + + " nZVein" + nZVein + + " sZVein" + sZVein + + " locDen=" + localDensity + + " Den=" + this.mDensity + + " Sec="+placeCount[1]+ + " Spo="+placeCount[3]+ + " Bet="+placeCount[2]+ + " Pri="+placeCount[0] + ); + } + // Something (at least the bottom layer must have 1 block) must have been placed, return true + return ORE_PLACED; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_Ores.java b/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_Ores.java new file mode 100644 index 0000000000..76ccfdcc80 --- /dev/null +++ b/src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_Ores.java @@ -0,0 +1,53 @@ +package gtPlusPlus.core.world.darkworld.gen.gt; + +import gtPlusPlus.core.util.array.Pair; +import gtPlusPlus.core.world.darkworld.object.BoxedQuad; +import net.minecraft.block.Block; + +public class WorldGen_Ores { + + /** + * Set Ore Types on by one. + */ + + public static volatile Pair<Block, Integer> Geikielite; // MgTiO3 + public static volatile Pair<Block, Integer> Zimbabweite; // (Na,K)2PbAs4(Nb,Ta,Ti)4O18 + public static volatile Pair<Block, Integer> Titanite; // CaTiSiO5 + public static volatile Pair<Block, Integer> Zirconolite; // CaZrTi2O7 + public static volatile Pair<Block, Integer> Crocoite; // PbCrO4 + public static volatile Pair<Block, Integer> Nichromite; // (Ni,Co,Fe)(Cr,Fe,Al)2O4 + public static volatile Pair<Block, Integer> Yttriaite; // Y2O3 + public static volatile Pair<Block, Integer> Samarskite_Y; // (YFe3+Fe2+U,Th,Ca)2(Nb,Ta)2O8 + public static volatile Pair<Block, Integer> Samarskite_Yb; // (YbFe3+)2(Nb,Ta)2O8 + public static volatile Pair<Block, Integer> Zircon; // ZrSiO4 + public static volatile Pair<Block, Integer> Gadolinite_Ce; // (Ce2,La,Nd,Y)2FeBe2Si1O14 + public static volatile Pair<Block, Integer> Gadolinite_Y; // (Ce,La,Nd,Y2)2FeBe2Si4O9 + public static volatile Pair<Block, Integer> Lepersonnite; // Ca(Gd,Dy)2(UO2)24(SiO4)4(CO3)8(OH)24·48H2O + public static volatile Pair<Block, Integer> Xenotime; // YPO4 + public static volatile Pair<Block, Integer> Yttrialite; // Y2Th2Si2O7 + public static volatile Pair<Block, Integer> Yttrocerite; // CaF5YCe + public static volatile Pair<Block, Integer> Polycrase; // YCaCeUThTi2Nb2Ta2O6 + public static volatile Pair<Block, Integer> Zircophyllite; // (K,Na)3(Mn,Fe)7(Zr,Ti,Nb)2Si8O24(OH,F)7 + public static volatile Pair<Block, Integer> Zirkelite; // (Ca,Th,Ce)Zr(Ti,Nb)2O7 + public static volatile Pair<Block, Integer> Lanthanite_La; // (La)2(CO3)3·8(H2O). + public static volatile Pair<Block, Integer> Lanthanite_Ce; // (Ce)2(CO3)3·8(H2O). + public static volatile Pair<Block, Integer> Lanthanite_Nd; // (Nd)2(CO3)3·8(H2O). + public static volatile Pair<Block, Integer> Hibonite; // ((Ca,Ce)(Al,Ti,Mg)12O19) + public static volatile Pair<Block, Integer> Cerite; // (Ce,La,Ca)9(Mg,Fe+3)(SiO4)6(SiO3OH)(OH)3 + public static volatile Pair<Block, Integer> Agardite_Y; // (YCa)Cu5(As2O4)3(OH)6·3H2O + public static volatile Pair<Block, Integer> Agardite_Cd; // (CdCa)Cu7(AsO2)4(O2H)5·3H2O + public static volatile Pair<Block, Integer> Agardite_La; // (LaCa)Cu5(AsO6)2(OH)4·3H2O + public static volatile Pair<Block, Integer> Agardite_Nd; // (NdCa)Cu6(As3O3)2(O2H)6·3H2O + public static volatile Pair<Block, Integer> Fluorcaphite; // (Ca,Sr,Ce,Na)5(PO4)3F + public static volatile Pair<Block, Integer> Florencite; // SmAl3(PO4)2(OH)6 + public static volatile Pair<Block, Integer> Cryolite; // Na3AlF6 + //public static volatile Pair<Block, Integer> Pyroxene; // + + + + + + public static volatile BoxedQuad<Integer, Integer, Integer, Integer> OreVein1 = new BoxedQuad(null, null, null, null); + + +} diff --git a/src/Java/gtPlusPlus/core/world/darkworld/object/BoxedQuad.java b/src/Java/gtPlusPlus/core/world/darkworld/object/BoxedQuad.java new file mode 100644 index 0000000000..d3c400896b --- /dev/null +++ b/src/Java/gtPlusPlus/core/world/darkworld/object/BoxedQuad.java @@ -0,0 +1,55 @@ +package gtPlusPlus.core.world.darkworld.object; + +import gtPlusPlus.core.util.array.Pair; +import net.minecraft.block.Block; + +public class BoxedQuad<K,V,C,R> { + + private final Pair<Block, Integer> key; + private final Pair<Block, Integer> value; + private final Pair<Block, Integer> value2; + private final Pair<Block, Integer> value3; + private final Pair<Block, Integer> [] mInternalPairArray; + + + public BoxedQuad(final Pair<Block, Integer> key, final Pair<Block, Integer> value, final Pair<Block, Integer> value2, final Pair<Block, Integer> value3){ + this.key = key; + this.value = value; + this.value2 = value2; + this.value3 = value3; + mInternalPairArray = new Pair[]{key, value, value2, value3}; + } + + final public Pair<Block, Integer> getKey(){ + return this.key; + } + + final public Pair<Block, Integer> getValue_1(){ + return this.value; + } + + final public Pair<Block, Integer> getValue_2(){ + return this.value2; + } + + final public Pair<Block, Integer> getValue_3(){ + return this.value3; + } + + final synchronized Pair<Block, Integer> unbox(int pos){ + return this.mInternalPairArray[pos]; + } + + final synchronized Block getBlock(int pos){ + return this.mInternalPairArray[pos].getKey(); + } + + final synchronized int getMeta(int pos){ + return this.mInternalPairArray[pos].getValue(); + } + + + + + +}
\ No newline at end of file |