From d4f11459f2e78e954a4c060c92861614c114d1cb Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Sun, 19 Jun 2016 14:53:32 +1000 Subject: +More classes stolen from GT to implement my own items on a metaitem. +Added LuV -> Max Voltage Machine components. +Added Rocket Engines, High tier diesel generators. +Added new textures for everything. +Added BedLocator_Base.java - Debug item for testing and NBT data storage. +Added Machine_Charger.java - Another Debug machine for testing NBT value manipulation. --- src/Java/miscutil/core/block/ModBlocks.java | 46 +- .../miscutil/core/block/antigrief/TowerDevice.java | 276 --------- .../miscutil/core/block/fluids/BlocktestFluid.java | 50 -- .../core/block/general/antigrief/TowerDevice.java | 276 +++++++++ .../general/fluids/BlockFluidJackDaniels.java | 51 ++ .../block/general/fluids/FluidRegistryHandler.java | 49 ++ .../block/heliumgen/block/HeliumGenerator.java | 164 ------ .../container/ContainerHeliumGenerator.java | 75 --- .../block/heliumgen/gui/GUIHeliumGenerator.java | 72 --- .../block/heliumgen/slots/InvSlotRadiation.java | 78 --- .../tileentity/TileEntityHeliumGenerator.java | 648 --------------------- .../core/block/machine/Machine_Charger.java | 82 +++ .../miscutil/core/block/machine/Machine_NHG.java | 2 +- .../machine/heliumgen/block/HeliumGenerator.java | 164 ++++++ .../container/ContainerHeliumGenerator.java | 75 +++ .../machine/heliumgen/gui/GUIHeliumGenerator.java | 72 +++ .../machine/heliumgen/slots/InvSlotRadiation.java | 78 +++ .../tileentity/TileEntityHeliumGenerator.java | 648 +++++++++++++++++++++ src/Java/miscutil/core/common/CommonProxy.java | 8 +- .../miscutil/core/container/Container_Charger.java | 81 +++ .../miscutil/core/container/Container_NHG.java | 2 +- .../miscutil/core/creative/AddToCreativeTab.java | 4 + .../core/creative/MiscUtilCreativeTabBlock.java | 18 - .../core/creative/MiscUtilCreativeTabMachines.java | 18 - .../core/creative/MiscUtilCreativeTabMisc.java | 18 - .../core/creative/MiscUtilCreativeTabTools.java | 18 - .../creative/tabs/MiscUtilCreativeTabBlock.java | 18 + .../creative/tabs/MiscUtilCreativeTabMachines.java | 18 + .../creative/tabs/MiscUtilCreativeTabMisc.java | 18 + .../creative/tabs/MiscUtilCreativeTabTools.java | 18 + src/Java/miscutil/core/gui/ModGUI.java | 6 +- .../miscutil/core/gui/machine/GUI_Charger.java | 50 ++ src/Java/miscutil/core/gui/machine/GUI_NHG.java | 2 +- src/Java/miscutil/core/handler/COMPAT_HANDLER.java | 4 + src/Java/miscutil/core/handler/GuiHandler.java | 13 +- .../gregtech/GregtechIndustrialCentrifuge.java | 2 +- .../gregtech/GregtechIndustrialCokeOven.java | 2 +- .../gregtech/GregtechIndustrialPlatePress.java | 2 +- .../gregtech/GregtechRocketFuelGenerator.java | 34 ++ .../gregtech/GregtechSteamCondenser.java | 2 +- src/Java/miscutil/core/item/ModItems.java | 24 +- .../core/item/base/BaseItemWithCharge.java | 74 +++ .../core/item/general/BedLocator_Base.java | 106 ++++ .../core/item/general/fuelrods/FuelRod_Base.java | 78 ++- src/Java/miscutil/core/lib/CORE.java | 8 +- .../miscutil/core/recipe/RECIPES_GREGTECH.java | 5 + .../core/tileentities/ModTileEntities.java | 9 +- .../miscutil/core/tileentities/TileEntityNHG.java | 487 ---------------- .../core/tileentities/TileEntityReverter.java | 309 ---------- .../tileentities/general/TileEntityReverter.java | 309 ++++++++++ .../tileentities/machines/TileEntityCharger.java | 186 ++++++ .../core/tileentities/machines/TileEntityNHG.java | 501 ++++++++++++++++ .../gregtech/api/enums/GregtechItemList.java | 17 +- .../interfaces/internal/IGregtech_RecipeAdder.java | 2 + .../internal/Interface_ItemBehaviour.java | 41 ++ .../gregtech/api/items/Gregtech_Generic_Item.java | 176 ++++++ .../gregtech/api/items/Gregtech_MetaItem.java | 323 ++++++++++ .../gregtech/api/items/Gregtech_MetaItem_Base.java | 634 ++++++++++++++++++++ .../gregtech/api/items/Gregtech_MetaItem_X32.java | 194 ++++++ .../base/GregtechRocketFuelGeneratorBase.java | 263 +++++++++ .../miscutil/gregtech/api/util/GregtechRecipe.java | 93 ++- .../gregtech/common/GregtechRecipeAdder.java | 74 +-- .../common/blocks/GregtechMetaCasingBlocks.java | 2 +- .../common/items/MetaGeneratedGregtechItems.java | 125 ++++ ...GregtechMetaTileEntityIndustrialCentrifuge.java | 391 ------------- .../GregtechMetaTileEntityIndustrialCokeOven.java | 268 --------- ...GregtechMetaTileEntityIndustrialPlatePress.java | 249 -------- .../GregtechMetaTileEntityIronBlastFurnace.java | 369 ------------ .../GregtechMetaTileEntityRocketFuelGenerator.java | 119 ++++ ...GregtechMetaTileEntityIndustrialCentrifuge.java | 391 +++++++++++++ .../GregtechMetaTileEntityIndustrialCokeOven.java | 268 +++++++++ ...GregtechMetaTileEntityIndustrialPlatePress.java | 249 ++++++++ .../GregtechMetaTileEntityIronBlastFurnace.java | 369 ++++++++++++ src/resources/assets/miscutils/lang/en_US.lang | 9 +- .../textures/blocks/fluids/fluid.jackdaniels.png | Bin 0 -> 4563 bytes .../blocks/fluids/fluid.jackdaniels.png.mcmeta | 5 + .../miscutils/textures/gui/machine_Charger.png | Bin 0 -> 69634 bytes .../miscutils/textures/items/MU-metaitem.01/0.png | Bin 0 -> 501 bytes .../miscutils/textures/items/MU-metaitem.01/1.png | Bin 0 -> 501 bytes .../miscutils/textures/items/MU-metaitem.01/10.png | Bin 0 -> 358 bytes .../miscutils/textures/items/MU-metaitem.01/11.png | Bin 0 -> 358 bytes .../miscutils/textures/items/MU-metaitem.01/12.png | Bin 0 -> 411 bytes .../miscutils/textures/items/MU-metaitem.01/13.png | Bin 0 -> 411 bytes .../miscutils/textures/items/MU-metaitem.01/14.png | Bin 0 -> 411 bytes .../miscutils/textures/items/MU-metaitem.01/15.png | Bin 0 -> 411 bytes .../miscutils/textures/items/MU-metaitem.01/16.png | Bin 0 -> 461 bytes .../miscutils/textures/items/MU-metaitem.01/17.png | Bin 0 -> 461 bytes .../miscutils/textures/items/MU-metaitem.01/18.png | Bin 0 -> 461 bytes .../miscutils/textures/items/MU-metaitem.01/19.png | Bin 0 -> 461 bytes .../miscutils/textures/items/MU-metaitem.01/2.png | Bin 0 -> 501 bytes .../miscutils/textures/items/MU-metaitem.01/20.png | Bin 0 -> 617 bytes .../miscutils/textures/items/MU-metaitem.01/21.png | Bin 0 -> 617 bytes .../miscutils/textures/items/MU-metaitem.01/22.png | Bin 0 -> 617 bytes .../miscutils/textures/items/MU-metaitem.01/23.png | Bin 0 -> 617 bytes .../miscutils/textures/items/MU-metaitem.01/24.png | Bin 0 -> 482 bytes .../miscutils/textures/items/MU-metaitem.01/25.png | Bin 0 -> 482 bytes .../miscutils/textures/items/MU-metaitem.01/26.png | Bin 0 -> 482 bytes .../miscutils/textures/items/MU-metaitem.01/27.png | Bin 0 -> 482 bytes .../miscutils/textures/items/MU-metaitem.01/28.png | Bin 0 -> 545 bytes .../miscutils/textures/items/MU-metaitem.01/29.png | Bin 0 -> 545 bytes .../miscutils/textures/items/MU-metaitem.01/3.png | Bin 0 -> 501 bytes .../miscutils/textures/items/MU-metaitem.01/30.png | Bin 0 -> 545 bytes .../miscutils/textures/items/MU-metaitem.01/31.png | Bin 0 -> 545 bytes .../miscutils/textures/items/MU-metaitem.01/4.png | Bin 0 -> 415 bytes .../miscutils/textures/items/MU-metaitem.01/5.png | Bin 0 -> 415 bytes .../miscutils/textures/items/MU-metaitem.01/6.png | Bin 0 -> 415 bytes .../miscutils/textures/items/MU-metaitem.01/7.png | Bin 0 -> 415 bytes .../textures/items/MU-metaitem.01/704.png | Bin 0 -> 2976 bytes .../textures/items/MU-metaitem.01/705.png | Bin 0 -> 3008 bytes .../textures/items/MU-metaitem.01/706.png | Bin 0 -> 3014 bytes .../miscutils/textures/items/MU-metaitem.01/8.png | Bin 0 -> 358 bytes .../miscutils/textures/items/MU-metaitem.01/9.png | Bin 0 -> 358 bytes 112 files changed, 6321 insertions(+), 3668 deletions(-) delete mode 100644 src/Java/miscutil/core/block/antigrief/TowerDevice.java delete mode 100644 src/Java/miscutil/core/block/fluids/BlocktestFluid.java create mode 100644 src/Java/miscutil/core/block/general/antigrief/TowerDevice.java create mode 100644 src/Java/miscutil/core/block/general/fluids/BlockFluidJackDaniels.java create mode 100644 src/Java/miscutil/core/block/general/fluids/FluidRegistryHandler.java delete mode 100644 src/Java/miscutil/core/block/heliumgen/block/HeliumGenerator.java delete mode 100644 src/Java/miscutil/core/block/heliumgen/container/ContainerHeliumGenerator.java delete mode 100644 src/Java/miscutil/core/block/heliumgen/gui/GUIHeliumGenerator.java delete mode 100644 src/Java/miscutil/core/block/heliumgen/slots/InvSlotRadiation.java delete mode 100644 src/Java/miscutil/core/block/heliumgen/tileentity/TileEntityHeliumGenerator.java create mode 100644 src/Java/miscutil/core/block/machine/Machine_Charger.java create mode 100644 src/Java/miscutil/core/block/machine/heliumgen/block/HeliumGenerator.java create mode 100644 src/Java/miscutil/core/block/machine/heliumgen/container/ContainerHeliumGenerator.java create mode 100644 src/Java/miscutil/core/block/machine/heliumgen/gui/GUIHeliumGenerator.java create mode 100644 src/Java/miscutil/core/block/machine/heliumgen/slots/InvSlotRadiation.java create mode 100644 src/Java/miscutil/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java create mode 100644 src/Java/miscutil/core/container/Container_Charger.java delete mode 100644 src/Java/miscutil/core/creative/MiscUtilCreativeTabBlock.java delete mode 100644 src/Java/miscutil/core/creative/MiscUtilCreativeTabMachines.java delete mode 100644 src/Java/miscutil/core/creative/MiscUtilCreativeTabMisc.java delete mode 100644 src/Java/miscutil/core/creative/MiscUtilCreativeTabTools.java create mode 100644 src/Java/miscutil/core/creative/tabs/MiscUtilCreativeTabBlock.java create mode 100644 src/Java/miscutil/core/creative/tabs/MiscUtilCreativeTabMachines.java create mode 100644 src/Java/miscutil/core/creative/tabs/MiscUtilCreativeTabMisc.java create mode 100644 src/Java/miscutil/core/creative/tabs/MiscUtilCreativeTabTools.java create mode 100644 src/Java/miscutil/core/gui/machine/GUI_Charger.java create mode 100644 src/Java/miscutil/core/handler/registration/gregtech/GregtechRocketFuelGenerator.java create mode 100644 src/Java/miscutil/core/item/base/BaseItemWithCharge.java create mode 100644 src/Java/miscutil/core/item/general/BedLocator_Base.java delete mode 100644 src/Java/miscutil/core/tileentities/TileEntityNHG.java delete mode 100644 src/Java/miscutil/core/tileentities/TileEntityReverter.java create mode 100644 src/Java/miscutil/core/tileentities/general/TileEntityReverter.java create mode 100644 src/Java/miscutil/core/tileentities/machines/TileEntityCharger.java create mode 100644 src/Java/miscutil/core/tileentities/machines/TileEntityNHG.java create mode 100644 src/Java/miscutil/gregtech/api/interfaces/internal/Interface_ItemBehaviour.java create mode 100644 src/Java/miscutil/gregtech/api/items/Gregtech_Generic_Item.java create mode 100644 src/Java/miscutil/gregtech/api/items/Gregtech_MetaItem.java create mode 100644 src/Java/miscutil/gregtech/api/items/Gregtech_MetaItem_Base.java create mode 100644 src/Java/miscutil/gregtech/api/items/Gregtech_MetaItem_X32.java create mode 100644 src/Java/miscutil/gregtech/api/metatileentity/implementations/base/GregtechRocketFuelGeneratorBase.java create mode 100644 src/Java/miscutil/gregtech/common/items/MetaGeneratedGregtechItems.java delete mode 100644 src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCentrifuge.java delete mode 100644 src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCokeOven.java delete mode 100644 src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialPlatePress.java delete mode 100644 src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIronBlastFurnace.java create mode 100644 src/Java/miscutil/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java create mode 100644 src/Java/miscutil/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialCentrifuge.java create mode 100644 src/Java/miscutil/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialCokeOven.java create mode 100644 src/Java/miscutil/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialPlatePress.java create mode 100644 src/Java/miscutil/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIronBlastFurnace.java create mode 100644 src/resources/assets/miscutils/textures/blocks/fluids/fluid.jackdaniels.png create mode 100644 src/resources/assets/miscutils/textures/blocks/fluids/fluid.jackdaniels.png.mcmeta create mode 100644 src/resources/assets/miscutils/textures/gui/machine_Charger.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/0.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/1.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/10.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/11.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/12.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/13.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/14.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/15.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/16.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/17.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/18.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/19.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/2.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/20.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/21.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/22.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/23.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/24.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/25.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/26.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/27.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/28.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/29.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/3.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/30.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/31.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/4.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/5.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/6.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/7.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/704.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/705.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/706.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/8.png create mode 100644 src/resources/assets/miscutils/textures/items/MU-metaitem.01/9.png diff --git a/src/Java/miscutil/core/block/ModBlocks.java b/src/Java/miscutil/core/block/ModBlocks.java index 9893430b69..7ab4a4c5c0 100644 --- a/src/Java/miscutil/core/block/ModBlocks.java +++ b/src/Java/miscutil/core/block/ModBlocks.java @@ -1,16 +1,12 @@ package miscutil.core.block; import miscutil.core.block.base.BasicBlock; -import miscutil.core.block.fluids.BlocktestFluid; -import miscutil.core.block.heliumgen.block.HeliumGenerator; -import miscutil.core.block.machine.Machine_NHG; -import miscutil.core.lib.CORE; +import miscutil.core.block.general.fluids.FluidRegistryHandler; import miscutil.core.util.Utils; import miscutil.gregtech.common.blocks.GregtechMetaCasingBlocks; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; import cpw.mods.fml.common.registry.GameRegistry; public final class ModBlocks { @@ -23,28 +19,10 @@ public final class ModBlocks { public static Block blockCasingsMisc; public static Block blockHeliumGenerator; public static Block blockNHG; + public static Block blockCharger; - - - - //Fluids - /** - * - * Luminosity .setLuminosity(luminosity) - How much light does the fluid emit. Default: 0, Lava uses 15 - Density .setDensity(density) - How dense is the fluid, the only effect is whether or not a fluid replaces another fluid when they flow into each other. Default: 1000, the density of water at 4 degrees Celsius in kg/m³ - Temperature .setTemperature(temp) - How hot, or cold is the fluid. Has currently no effect. Default: 295, the "normal" room temperature in degrees Kelvin, this is approximately 72°F or 22°C. - Viscosity .setViscosity(viscosity) - How thick the fluid is. Determines how fast it flows. Default: 1000 for water, lava uses 6000 - Is Gaseous .setGaseous(boolean) - Indicates if the fluid is gaseous. Used for rendering. Default: false - * - */ - - public static Fluid testFluid = new Fluid("testFluid"); - public static Block testFluidBlock; + public static Fluid fluidJackDaniels = new Fluid("fluidJackDaniels"); + public static Block blockFluidJackDaniels; @@ -69,19 +47,11 @@ public final class ModBlocks { blockCasingsMisc = new GregtechMetaCasingBlocks(); //Fluids - //testFluid - testFluid.setLuminosity(12); - testFluid.setDensity(1200); - testFluid.setTemperature(420); - testFluid.setViscosity(750); - testFluid.setGaseous(true); - FluidRegistry.registerFluid(testFluid); - testFluidBlock = new BlocktestFluid(testFluid, Material.water).setBlockName("yourFluid"); - GameRegistry.registerBlock(testFluidBlock, CORE.MODID + "_" + testFluidBlock.getUnlocalizedName().substring(5)); - testFluid.setUnlocalizedName(testFluidBlock.getUnlocalizedName()); + FluidRegistryHandler.registerFluids(); - blockHeliumGenerator = GameRegistry.registerBlock(new HeliumGenerator(), "Helium_Collector"); - blockNHG = GameRegistry.registerBlock(new Machine_NHG("blockNuclearFueledHeliumGenerator"), "blockNuclearFueledHeliumGenerator"); + // blockHeliumGenerator = GameRegistry.registerBlock(new HeliumGenerator(), "Helium_Collector"); + // blockNHG = GameRegistry.registerBlock(new Machine_NHG("blockNuclearFueledHeliumGenerator"), "blockNuclearFueledHeliumGenerator"); + // blockCharger = GameRegistry.registerBlock(new Machine_Charger("blockMachineCharger"), "blockMachineCharger"); //WIP TODO diff --git a/src/Java/miscutil/core/block/antigrief/TowerDevice.java b/src/Java/miscutil/core/block/antigrief/TowerDevice.java deleted file mode 100644 index c3b0ab69a8..0000000000 --- a/src/Java/miscutil/core/block/antigrief/TowerDevice.java +++ /dev/null @@ -1,276 +0,0 @@ -package miscutil.core.block.antigrief; - -import static miscutil.core.block.ModBlocks.blockGriefSaver; - -import java.util.List; -import java.util.Random; - -import miscutil.core.creative.AddToCreativeTab; -import miscutil.core.lib.CORE; -import miscutil.core.tileentities.TileEntityReverter; -import miscutil.core.util.Utils; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class TowerDevice extends Block { - private static IIcon TEX_ANTIBUILDER; - public static final int META_ANTIBUILDER = 9; - private boolean bUnbreakable; - - public TowerDevice() - { - super(Material.wood); - setHardness(10.0F); - setResistance(35.0F); - setStepSound(Block.soundTypeWood); - setCreativeTab(AddToCreativeTab.tabMachines); - } - - public int tickRate() - { - return 15; - } - - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setBoolean("bUnbreakable", bUnbreakable); - } - - public void loadNBTData(NBTTagCompound aNBT) { - bUnbreakable = aNBT.getBoolean("bUnbreakable"); - } - - public IIcon getIcon(int side, int meta) - { - return TEX_ANTIBUILDER; - } - - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister par1IconRegister) - { - TEX_ANTIBUILDER = par1IconRegister.registerIcon(CORE.MODID + ":" + "blockAntiGrief"); - } - - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - par3List.add(new ItemStack(par1, 1, 9)); - } - - public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) - { - int meta = par1World.getBlockMetadata(x, y, z); - return false; - } - - public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) - { - int meta = world.getBlockMetadata(x, y, z); - return super.getExplosionResistance(par1Entity, world, x, y, z, explosionX, explosionY, explosionZ); - } - - public float getBlockHardness(World world, int x, int y, int z) - { - int meta = world.getBlockMetadata(x, y, z); - return super.getBlockHardness(world, x, y, z); - } - - public static boolean areNearbyLockBlocks(World world, int x, int y, int z) - { - boolean locked = false; - for (int dx = x - 2; dx <= x + 2; dx++) { - for (int dy = y - 2; dy <= y + 2; dy++) { - for (int dz = z - 2; dz <= z + 2; dz++) { - if ((world.getBlock(dx, dy, dz) == blockGriefSaver) && (world.getBlockMetadata(dx, dy, dz) == 4)) { - locked = true; - } - } - } - } - return locked; - } - - public static void unlockBlock(World par1World, int x, int y, int z) - { - Block thereBlockID = par1World.getBlock(x, y, z); - int thereBlockMeta = par1World.getBlockMetadata(x, y, z); - if ((thereBlockID == blockGriefSaver) || (thereBlockMeta == 4)) - { - changeToBlockMeta(par1World, x, y, z, 5); - par1World.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "random.click", 0.3F, 0.6F); - } - } - - private static void changeToBlockMeta(World par1World, int x, int y, int z, int meta) - { - Block thereBlockID = par1World.getBlock(x, y, z); - if ((thereBlockID == blockGriefSaver)) - { - par1World.setBlock(x, y, z, thereBlockID, meta, 3); - par1World.markBlockRangeForRenderUpdate(x, y, z, x, y, z); - par1World.notifyBlocksOfNeighborChange(x, y, z, thereBlockID); - } - } - - public void onBlockAdded(World par1World, int x, int y, int z) - { - int meta = par1World.getBlockMetadata(x, y, z); - if (!par1World.isRemote) { - - } - } - - public void onNeighborBlockChange(World par1World, int x, int y, int z, Block myBlockID) - { - int meta = par1World.getBlockMetadata(x, y, z); - if (!par1World.isRemote) - { - - } - } - - public void updateTick(World par1World, int x, int y, int z, Random par5Random) - { - if (!par1World.isRemote) - { - int meta = par1World.getBlockMetadata(x, y, z); - } - } - - private void letsBuild(World par1World, int x, int y, int z) - { - - } - - private boolean isInactiveTrapCharged(World par1World, int x, int y, int z) - { - return false; - } - - private boolean isReactorReady(World world, int x, int y, int z) - { - if ((world.getBlock(x, y + 1, z) != Blocks.redstone_block) || - (world.getBlock(x, y - 1, z) != Blocks.redstone_block) || - (world.getBlock(x + 1, y, z) != Blocks.redstone_block) || - (world.getBlock(x - 1, y, z) != Blocks.redstone_block) || - (world.getBlock(x, y, z + 1) != Blocks.redstone_block) || - (world.getBlock(x, y, z - 1) != Blocks.redstone_block)) { - return false; - } - return true; - } - - @SideOnly(Side.CLIENT) - public void randomDisplayTick(World par1World, int x, int y, int z, Random par5Random) - { - int meta = par1World.getBlockMetadata(x, y, z); - if ((meta == 3) || (meta == 1) || (meta == 9)) { - for (int i = 0; i < 1; i++) { - sparkle(par1World, x, y, z, par5Random); - } - } - } - - public void sparkle(World world, int x, int y, int z, Random rand) - { - double offset = 0.0625D; - for (int side = 0; side < 6; side++) - { - double rx = x + rand.nextFloat(); - double ry = y + rand.nextFloat(); - double rz = z + rand.nextFloat(); - if ((side == 0) && (!world.getBlock(x, y + 1, z).isOpaqueCube())) { - ry = y + 1 + offset; - } - if ((side == 1) && (!world.getBlock(x, y - 1, z).isOpaqueCube())) { - ry = y + 0 - offset; - } - if ((side == 2) && (!world.getBlock(x, y, z + 1).isOpaqueCube())) { - rz = z + 1 + offset; - } - if ((side == 3) && (!world.getBlock(x, y, z - 1).isOpaqueCube())) { - rz = z + 0 - offset; - } - if ((side == 4) && (!world.getBlock(x + 1, y, z).isOpaqueCube())) { - rx = x + 1 + offset; - } - if ((side == 5) && (!world.getBlock(x - 1, y, z).isOpaqueCube())) { - rx = x + 0 - offset; - } - if ((rx < x) || (rx > x + 1) || (ry < 0.0D) || (ry > y + 1) || (rz < z) || (rz > z + 1)) { - world.spawnParticle("reddust", rx, ry, rz, 0.0D, 0.0D, 0.0D); - } - } - } - - public static void checkAndActivateVanishBlock(World world, int x, int y, int z) - { - Block thereID = world.getBlock(x, y, z); - int thereMeta = world.getBlockMetadata(x, y, z); - } - - public static void changeToActiveVanishBlock(World par1World, int x, int y, int z, int meta) - { - changeToBlockMeta(par1World, x, y, z, meta); - par1World.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "random.pop", 0.3F, 0.6F); - - Block thereBlockID = par1World.getBlock(x, y, z); - par1World.scheduleBlockUpdate(x, y, z, thereBlockID, getTickRateFor(thereBlockID, meta, par1World.rand)); - } - - private static int getTickRateFor(Block thereBlockID, int meta, Random rand) - { - return 15; - } - - public int getLightValue(IBlockAccess world, int x, int y, int z) - { - Block blockID = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - if (blockID != this) { - return 0; - } - return 10; - } - - public boolean hasTileEntity(int metadata) - { - return (metadata == 0); - } - - public TileEntity createTileEntity(World world, int metadata) - { - if (metadata == 0) { - Utils.LOG_INFO("I have been created. [Antigriefer]"+this.getLocalizedName()); - return new TileEntityReverter(); - } - return null; - } - - public Item getItemDropped(int meta, Random par2Random, int par3) - { - switch (meta) - { - case 0: - return null; - } - return Item.getItemFromBlock(this); - } - - public int damageDropped(int meta) - { - return meta; - } -} diff --git a/src/Java/miscutil/core/block/fluids/BlocktestFluid.java b/src/Java/miscutil/core/block/fluids/BlocktestFluid.java deleted file mode 100644 index 8676f21d81..0000000000 --- a/src/Java/miscutil/core/block/fluids/BlocktestFluid.java +++ /dev/null @@ -1,50 +0,0 @@ -package miscutil.core.block.fluids; - -import miscutil.core.creative.AddToCreativeTab; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.fluids.BlockFluidClassic; -import net.minecraftforge.fluids.Fluid; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class BlocktestFluid extends BlockFluidClassic { - - @SideOnly(Side.CLIENT) - protected IIcon stillIcon; - @SideOnly(Side.CLIENT) - protected IIcon flowingIcon; - - public BlocktestFluid(Fluid fluid, Material material) { - super(fluid, material); - setCreativeTab(AddToCreativeTab.tabMisc); - } - - @Override - public IIcon getIcon(int side, int meta) { - return (side == 0 || side == 1)? stillIcon : flowingIcon; - } - - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(IIconRegister register) { - stillIcon = register.registerIcon("modid:fluidStill"); - flowingIcon = register.registerIcon("modid:fluidFlowing"); - } - - @Override - public boolean canDisplace(IBlockAccess world, int x, int y, int z) { - if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; - return super.canDisplace(world, x, y, z); - } - - @Override - public boolean displaceIfPossible(World world, int x, int y, int z) { - if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; - return super.displaceIfPossible(world, x, y, z); - } - -} diff --git a/src/Java/miscutil/core/block/general/antigrief/TowerDevice.java b/src/Java/miscutil/core/block/general/antigrief/TowerDevice.java new file mode 100644 index 0000000000..9ff0d36b33 --- /dev/null +++ b/src/Java/miscutil/core/block/general/antigrief/TowerDevice.java @@ -0,0 +1,276 @@ +package miscutil.core.block.general.antigrief; + +import static miscutil.core.block.ModBlocks.blockGriefSaver; + +import java.util.List; +import java.util.Random; + +import miscutil.core.creative.AddToCreativeTab; +import miscutil.core.lib.CORE; +import miscutil.core.tileentities.general.TileEntityReverter; +import miscutil.core.util.Utils; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class TowerDevice extends Block { + private static IIcon TEX_ANTIBUILDER; + public static final int META_ANTIBUILDER = 9; + private boolean bUnbreakable; + + public TowerDevice() + { + super(Material.wood); + setHardness(10.0F); + setResistance(35.0F); + setStepSound(Block.soundTypeWood); + setCreativeTab(AddToCreativeTab.tabMachines); + } + + public int tickRate() + { + return 15; + } + + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setBoolean("bUnbreakable", bUnbreakable); + } + + public void loadNBTData(NBTTagCompound aNBT) { + bUnbreakable = aNBT.getBoolean("bUnbreakable"); + } + + public IIcon getIcon(int side, int meta) + { + return TEX_ANTIBUILDER; + } + + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister par1IconRegister) + { + TEX_ANTIBUILDER = par1IconRegister.registerIcon(CORE.MODID + ":" + "blockAntiGrief"); + } + + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) + { + par3List.add(new ItemStack(par1, 1, 9)); + } + + public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + int meta = par1World.getBlockMetadata(x, y, z); + return false; + } + + public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) + { + int meta = world.getBlockMetadata(x, y, z); + return super.getExplosionResistance(par1Entity, world, x, y, z, explosionX, explosionY, explosionZ); + } + + public float getBlockHardness(World world, int x, int y, int z) + { + int meta = world.getBlockMetadata(x, y, z); + return super.getBlockHardness(world, x, y, z); + } + + public static boolean areNearbyLockBlocks(World world, int x, int y, int z) + { + boolean locked = false; + for (int dx = x - 2; dx <= x + 2; dx++) { + for (int dy = y - 2; dy <= y + 2; dy++) { + for (int dz = z - 2; dz <= z + 2; dz++) { + if ((world.getBlock(dx, dy, dz) == blockGriefSaver) && (world.getBlockMetadata(dx, dy, dz) == 4)) { + locked = true; + } + } + } + } + return locked; + } + + public static void unlockBlock(World par1World, int x, int y, int z) + { + Block thereBlockID = par1World.getBlock(x, y, z); + int thereBlockMeta = par1World.getBlockMetadata(x, y, z); + if ((thereBlockID == blockGriefSaver) || (thereBlockMeta == 4)) + { + changeToBlockMeta(par1World, x, y, z, 5); + par1World.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "random.click", 0.3F, 0.6F); + } + } + + private static void changeToBlockMeta(World par1World, int x, int y, int z, int meta) + { + Block thereBlockID = par1World.getBlock(x, y, z); + if ((thereBlockID == blockGriefSaver)) + { + par1World.setBlock(x, y, z, thereBlockID, meta, 3); + par1World.markBlockRangeForRenderUpdate(x, y, z, x, y, z); + par1World.notifyBlocksOfNeighborChange(x, y, z, thereBlockID); + } + } + + public void onBlockAdded(World par1World, int x, int y, int z) + { + int meta = par1World.getBlockMetadata(x, y, z); + if (!par1World.isRemote) { + + } + } + + public void onNeighborBlockChange(World par1World, int x, int y, int z, Block myBlockID) + { + int meta = par1World.getBlockMetadata(x, y, z); + if (!par1World.isRemote) + { + + } + } + + public void updateTick(World par1World, int x, int y, int z, Random par5Random) + { + if (!par1World.isRemote) + { + int meta = par1World.getBlockMetadata(x, y, z); + } + } + + private void letsBuild(World par1World, int x, int y, int z) + { + + } + + private boolean isInactiveTrapCharged(World par1World, int x, int y, int z) + { + return false; + } + + private boolean isReactorReady(World world, int x, int y, int z) + { + if ((world.getBlock(x, y + 1, z) != Blocks.redstone_block) || + (world.getBlock(x, y - 1, z) != Blocks.redstone_block) || + (world.getBlock(x + 1, y, z) != Blocks.redstone_block) || + (world.getBlock(x - 1, y, z) != Blocks.redstone_block) || + (world.getBlock(x, y, z + 1) != Blocks.redstone_block) || + (world.getBlock(x, y, z - 1) != Blocks.redstone_block)) { + return false; + } + return true; + } + + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World par1World, int x, int y, int z, Random par5Random) + { + int meta = par1World.getBlockMetadata(x, y, z); + if ((meta == 3) || (meta == 1) || (meta == 9)) { + for (int i = 0; i < 1; i++) { + sparkle(par1World, x, y, z, par5Random); + } + } + } + + public void sparkle(World world, int x, int y, int z, Random rand) + { + double offset = 0.0625D; + for (int side = 0; side < 6; side++) + { + double rx = x + rand.nextFloat(); + double ry = y + rand.nextFloat(); + double rz = z + rand.nextFloat(); + if ((side == 0) && (!world.getBlock(x, y + 1, z).isOpaqueCube())) { + ry = y + 1 + offset; + } + if ((side == 1) && (!world.getBlock(x, y - 1, z).isOpaqueCube())) { + ry = y + 0 - offset; + } + if ((side == 2) && (!world.getBlock(x, y, z + 1).isOpaqueCube())) { + rz = z + 1 + offset; + } + if ((side == 3) && (!world.getBlock(x, y, z - 1).isOpaqueCube())) { + rz = z + 0 - offset; + } + if ((side == 4) && (!world.getBlock(x + 1, y, z).isOpaqueCube())) { + rx = x + 1 + offset; + } + if ((side == 5) && (!world.getBlock(x - 1, y, z).isOpaqueCube())) { + rx = x + 0 - offset; + } + if ((rx < x) || (rx > x + 1) || (ry < 0.0D) || (ry > y + 1) || (rz < z) || (rz > z + 1)) { + world.spawnParticle("reddust", rx, ry, rz, 0.0D, 0.0D, 0.0D); + } + } + } + + public static void checkAndActivateVanishBlock(World world, int x, int y, int z) + { + Block thereID = world.getBlock(x, y, z); + int thereMeta = world.getBlockMetadata(x, y, z); + } + + public static void changeToActiveVanishBlock(World par1World, int x, int y, int z, int meta) + { + changeToBlockMeta(par1World, x, y, z, meta); + par1World.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "random.pop", 0.3F, 0.6F); + + Block thereBlockID = par1World.getBlock(x, y, z); + par1World.scheduleBlockUpdate(x, y, z, thereBlockID, getTickRateFor(thereBlockID, meta, par1World.rand)); + } + + private static int getTickRateFor(Block thereBlockID, int meta, Random rand) + { + return 15; + } + + public int getLightValue(IBlockAccess world, int x, int y, int z) + { + Block blockID = world.getBlock(x, y, z); + int meta = world.getBlockMetadata(x, y, z); + if (blockID != this) { + return 0; + } + return 10; + } + + public boolean hasTileEntity(int metadata) + { + return (metadata == 0); + } + + public TileEntity createTileEntity(World world, int metadata) + { + if (metadata == 0) { + Utils.LOG_INFO("I have been created. [Antigriefer]"+this.getLocalizedName()); + return new TileEntityReverter(); + } + return null; + } + + public Item getItemDropped(int meta, Random par2Random, int par3) + { + switch (meta) + { + case 0: + return null; + } + return Item.getItemFromBlock(this); + } + + public int damageDropped(int meta) + { + return meta; + } +} diff --git a/src/Java/miscutil/core/block/general/fluids/BlockFluidJackDaniels.java b/src/Java/miscutil/core/block/general/fluids/BlockFluidJackDaniels.java new file mode 100644 index 0000000000..1ddfcbe081 --- /dev/null +++ b/src/Java/miscutil/core/block/general/fluids/BlockFluidJackDaniels.java @@ -0,0 +1,51 @@ +package miscutil.core.block.general.fluids; + +import miscutil.core.creative.AddToCreativeTab; +import miscutil.core.lib.CORE; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.fluids.BlockFluidClassic; +import net.minecraftforge.fluids.Fluid; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BlockFluidJackDaniels extends BlockFluidClassic { + + @SideOnly(Side.CLIENT) + protected IIcon stillIcon; + @SideOnly(Side.CLIENT) + protected IIcon flowingIcon; + + public BlockFluidJackDaniels(Fluid fluid, Material material) { + super(fluid, material); + setCreativeTab(AddToCreativeTab.tabMisc); + } + + @Override + public IIcon getIcon(int side, int meta) { + return (side == 0 || side == 1)? stillIcon : flowingIcon; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(IIconRegister register) { + stillIcon = register.registerIcon(CORE.MODID+":fluids/fluid.jackdaniels"); + flowingIcon = register.registerIcon(CORE.MODID+":fluids/fluid.jackdaniels"); + } + + @Override + public boolean canDisplace(IBlockAccess world, int x, int y, int z) { + if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; + return super.canDisplace(world, x, y, z); + } + + @Override + public boolean displaceIfPossible(World world, int x, int y, int z) { + if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; + return super.displaceIfPossible(world, x, y, z); + } + +} diff --git a/src/Java/miscutil/core/block/general/fluids/FluidRegistryHandler.java b/src/Java/miscutil/core/block/general/fluids/FluidRegistryHandler.java new file mode 100644 index 0000000000..bf03203247 --- /dev/null +++ b/src/Java/miscutil/core/block/general/fluids/FluidRegistryHandler.java @@ -0,0 +1,49 @@ +package miscutil.core.block.general.fluids; + +import static miscutil.core.block.ModBlocks.blockFluidJackDaniels; +import static miscutil.core.block.ModBlocks.fluidJackDaniels; +import miscutil.core.lib.CORE; +import net.minecraft.block.material.Material; +import net.minecraftforge.fluids.FluidRegistry; +import cpw.mods.fml.common.registry.GameRegistry; + +public class FluidRegistryHandler { + + //Fluids + /** + * + * Luminosity .setLuminosity(luminosity) + How much light does the fluid emit. Default: 0, Lava uses 15 + Density .setDensity(density) + How dense is the fluid, the only effect is whether or not a fluid replaces another fluid when they flow into each other. Default: 1000, the density of water at 4 degrees Celsius in kg/m³ + Temperature .setTemperature(temp) + How hot, or cold is the fluid. Has currently no effect. Default: 295, the "normal" room temperature in degrees Kelvin, this is approximately 72°F or 22°C. + Viscosity .setViscosity(viscosity) + How thick the fluid is. Determines how fast it flows. Default: 1000 for water, lava uses 6000 + Is Gaseous .setGaseous(boolean) + Indicates if the fluid is gaseous. Used for rendering. Default: false + * + */ + + public static void registerFluids(){ + run(); + } + + private static void run(){ + fluidJackDaniels(); + } + + private static void fluidJackDaniels(){ + //testFluid + fluidJackDaniels.setLuminosity(12); + fluidJackDaniels.setDensity(1200); + fluidJackDaniels.setTemperature(420); + fluidJackDaniels.setViscosity(750); + fluidJackDaniels.setGaseous(true); + FluidRegistry.registerFluid(fluidJackDaniels); + blockFluidJackDaniels = new BlockFluidJackDaniels(fluidJackDaniels, Material.water).setBlockName("fluidJackDaniels"); + GameRegistry.registerBlock(blockFluidJackDaniels, CORE.MODID + "_" + blockFluidJackDaniels.getUnlocalizedName().substring(5)); + fluidJackDaniels.setUnlocalizedName(blockFluidJackDaniels.getUnlocalizedName()); + } + +} diff --git a/src/Java/miscutil/core/block/heliumgen/block/HeliumGenerator.java b/src/Java/miscutil/core/block/heliumgen/block/HeliumGenerator.java deleted file mode 100644 index f424097240..0000000000 --- a/src/Java/miscutil/core/block/heliumgen/block/HeliumGenerator.java +++ /dev/null @@ -1,164 +0,0 @@ -package miscutil.core.block.heliumgen.block; - -import java.util.Random; - -import miscutil.MiscUtils; -import miscutil.core.block.heliumgen.tileentity.TileEntityHeliumGenerator; -import miscutil.core.creative.AddToCreativeTab; -import miscutil.core.lib.CORE; -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.util.MathHelper; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class HeliumGenerator extends BlockContainer { - - private IIcon top, sides, front; - private Random randy = new Random(); - - public HeliumGenerator(){ - super(Material.iron); - setStepSound(Block.soundTypeMetal); - setHardness(20.0F); - setBlockName("helium_collector"); - setHarvestLevel("pickaxe", 3); - setCreativeTab(AddToCreativeTab.tabMachines); - } - - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons (IIconRegister iconRegister) - { - this.top = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_SIDE"); - this.sides = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_SIDE"); - this.front = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_FRONT"); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ - if(side == 1) - return top; - int facing = 2; - TileEntityHeliumGenerator machine = (TileEntityHeliumGenerator)world.getTileEntity(x, y, z); - if(machine != null) - facing = machine.getFacing(); - if(side == facing) - return front; - else - return sides; - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int metadata) - { - if(side == 1) - return top; - if(side == 3) - return front; - return sides; - } - - @Override - public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) - { - if (world.isRemote) - { - return true; - } - player.openGui(MiscUtils.instance, 2, world, x, y, z); - return true; - } - - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return new TileEntityHeliumGenerator(); - } - - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack item) - { - TileEntity tile = world.getTileEntity(x, y, z); - if(tile instanceof TileEntityHeliumGenerator) { - TileEntityHeliumGenerator machine = (TileEntityHeliumGenerator)tile; - int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; - - if (l == 0) - machine.setFacing((short) 2); - - if (l == 1) - machine.setFacing((short) 5); - - if (l == 2) - machine.setFacing((short) 3); - - if (l == 3) - machine.setFacing((short) 4); - } - - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int wut) - { - TileEntityHeliumGenerator collector = (TileEntityHeliumGenerator)world.getTileEntity(x, y, z); - - if (collector != null) - { - int i = 0; - for (i = 0; i < collector.getSizeInventory(); i++){ - - ItemStack itemstack = collector.getStackInSlot(i); - - if (itemstack != null) - { - float f = this.randy.nextFloat() * 0.8F + 0.1F; - float f1 = this.randy.nextFloat() * 0.8F + 0.1F; - float f2 = this.randy.nextFloat() * 0.8F + 0.1F; - - while (itemstack.stackSize > 0) - { - int j1 = this.randy.nextInt(21) + 10; - - if (j1 > itemstack.stackSize) - { - j1 = itemstack.stackSize; - } - - itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } - - float f3 = 0.05F; - entityitem.motionX = (double)((float)this.randy.nextGaussian() * f3); - entityitem.motionY = (double)((float)this.randy.nextGaussian() * f3 + 0.2F); - entityitem.motionZ = (double)((float)this.randy.nextGaussian() * f3); - world.spawnEntityInWorld(entityitem); - } - } - - world.func_147453_f(x, y, z, block); - } - } - - super.breakBlock(world, x, y, z, block, wut); - } -} diff --git a/src/Java/miscutil/core/block/heliumgen/container/ContainerHeliumGenerator.java b/src/Java/miscutil/core/block/heliumgen/container/ContainerHeliumGenerator.java deleted file mode 100644 index 7de3efd4c6..0000000000 --- a/src/Java/miscutil/core/block/heliumgen/container/ContainerHeliumGenerator.java +++ /dev/null @@ -1,75 +0,0 @@ -package miscutil.core.block.heliumgen.container; - -import ic2.core.ContainerBase; -import ic2.core.slot.SlotInvSlot; - -import java.util.List; - -import miscutil.core.block.heliumgen.tileentity.TileEntityHeliumGenerator; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Slot; -import net.minecraft.inventory.SlotFurnace; - -public class ContainerHeliumGenerator -extends ContainerBase -{ - public short size; - - public ContainerHeliumGenerator(InventoryPlayer player, TileEntityHeliumGenerator machine) - { - super(machine); - //Utils.LOG_WARNING("containerHeliumGenerator"); - short sr = machine.getReactorSize(); - this.addSlotToContainer(new SlotFurnace(player.player, machine, 2, 80, 35)); - this.size = sr; - int startX = 16; - int startY = 16; - int i = 0; - for (i = 0; i < 9; i++) - { - int x = i % this.size; - int y = i / this.size; - - addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); - } - startX = 108; - startY = 16; - for (i = 9; i < 18; i++) - { - int x = i % this.size; - int y = (i-9) / this.size; - - addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); - } - for (i = 0; i < 3; ++i) - { - for (int j = 0; j < 9; ++j) - { - this.addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - for (i = 0; i < 9; ++i) - { - this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 142)); - } - // addSlotToContainer(new SlotInvSlot(machine.coolantinputSlot, 0, 8, 25)); - //addSlotToContainer(new SlotInvSlot(machine.hotcoolinputSlot, 0, 188, 25)); - //addSlotToContainer(new SlotInvSlot(machine.coolantoutputSlot, 0, 8, 115)); - //addSlotToContainer(new SlotInvSlot(machine.hotcoolantoutputSlot, 0, 188, 115)); - } - - @Override - public List getNetworkedFields() - { - List ret = super.getNetworkedFields(); - - ret.add("heat"); - ret.add("maxHeat"); - ret.add("EmitHeat"); - /*ret.add("inputTank"); - ret.add("outputTank"); - ret.add("fluidcoolreactor");*/ - return ret; - } -} \ No newline at end of file diff --git a/src/Java/miscutil/core/block/heliumgen/gui/GUIHeliumGenerator.java b/src/Java/miscutil/core/block/heliumgen/gui/GUIHeliumGenerator.java deleted file mode 100644 index 309a7b5fba..0000000000 --- a/src/Java/miscutil/core/block/heliumgen/gui/GUIHeliumGenerator.java +++ /dev/null @@ -1,72 +0,0 @@ -package miscutil.core.block.heliumgen.gui; - -import miscutil.core.block.heliumgen.container.ContainerHeliumGenerator; -import miscutil.core.block.heliumgen.tileentity.TileEntityHeliumGenerator; -import miscutil.core.lib.CORE; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class GUIHeliumGenerator extends GuiContainer -{ - private static final ResourceLocation collectorGuiTexture = new ResourceLocation(CORE.MODID, "textures/gui/helium_collector_gui.png"); - - public GUIHeliumGenerator(InventoryPlayer player, TileEntityHeliumGenerator machine) - { - super(new ContainerHeliumGenerator(player, machine)); - } - - /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) - */ - @Override - protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) - { - String s = StatCollector.translateToLocal("Helium Collector"); - this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752); - this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); - - this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+-1), 80, 35, 2); - - short sr = 3; - int size = sr; - int startX = 16; - int startY = 16; - int i = 0; - for (i = 0; i < 9; i++) - { - int x = i % size; - int y = i / size; - this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+i), startX + 18 * x, startY + 18 * y, 4210752); - //addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); - } - startX = 108; - startY = 16; - for (i = 9; i < 18; i++) - { - int x = i % size; - int y = (i-9) / size; - this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+i), startX + 18 * x, startY + 18 * y, 4210752); - // addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); - } - - } - - @Override - protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(collectorGuiTexture); - int k = (this.width - this.xSize) / 2; - int l = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - - } -} \ No newline at end of file diff --git a/src/Java/miscutil/core/block/heliumgen/slots/InvSlotRadiation.java b/src/Java/miscutil/core/block/heliumgen/slots/InvSlotRadiation.java deleted file mode 100644 index 22491e6cf2..0000000000 --- a/src/Java/miscutil/core/block/heliumgen/slots/InvSlotRadiation.java +++ /dev/null @@ -1,78 +0,0 @@ -package miscutil.core.block.heliumgen.slots; - -import ic2.core.block.invslot.InvSlot; -import miscutil.core.block.heliumgen.tileentity.TileEntityHeliumGenerator; -import net.minecraft.item.ItemStack; - -public class InvSlotRadiation extends InvSlot -{ - public InvSlotRadiation(TileEntityHeliumGenerator base, String name1, int oldStartIndex1, int count) - { - super(base, name1, oldStartIndex1, InvSlot.Access.IO, count); - - setStackSizeLimit(1); - } - - @Override - public boolean accepts(ItemStack itemStack) - { - return ((TileEntityHeliumGenerator)this.base).isUsefulItem(itemStack, true); - } - - @Override - public int size() - { - //Utils.LOG_INFO("InvSlotRadiation/Size"); - return 3 * 6; - } - - public int rawSize() - { - return super.size(); - } - - @Override - public ItemStack get(int index) - { - return super.get(mapIndex(index)); - } - - public ItemStack get(int x, int y) - { - return super.get(y * 9 + x); - } - - @Override - public void put(int index, ItemStack content) - { - super.put(mapIndex(index), content); - } - - public void put(int x, int y, ItemStack content) - { - super.put(y * 9 + x, content); - } - - private int mapIndex(int index) - { - int size = size(); - int cols = size / 6; - if (index < size) - { - int row = index / cols; - int col = index % cols; - - return row * 9 + col; - } - index -= size; - int remCols = 9 - cols; - - int row = index / remCols; - int col = cols + index % remCols; - - return row * 9 + col; - } - - private final int rows = 6; - private final int maxCols = 9; -} diff --git a/src/Java/miscutil/core/block/heliumgen/tileentity/TileEntityHeliumGenerator.java b/src/Java/miscutil/core/block/heliumgen/tileentity/TileEntityHeliumGenerator.java deleted file mode 100644 index 8793e06d4b..0000000000 --- a/src/Java/miscutil/core/block/heliumgen/tileentity/TileEntityHeliumGenerator.java +++ /dev/null @@ -1,648 +0,0 @@ -package miscutil.core.block.heliumgen.tileentity; - -import ic2.api.Direction; -import ic2.api.reactor.IReactor; -import ic2.api.reactor.IReactorComponent; -import ic2.api.tile.IWrenchable; -import ic2.core.IC2; -import ic2.core.IC2DamageSource; -import ic2.core.Ic2Items; -import ic2.core.block.TileEntityInventory; -import ic2.core.init.MainConfig; -import ic2.core.item.reactor.ItemReactorHeatStorage; -import ic2.core.network.NetworkManager; -import ic2.core.util.ConfigUtil; - -import java.util.List; - -import miscutil.core.block.ModBlocks; -import miscutil.core.block.heliumgen.slots.InvSlotRadiation; -import miscutil.core.item.ModItems; -import miscutil.core.util.Utils; -import miscutil.core.util.item.UtilsItems; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.world.World; - -public class TileEntityHeliumGenerator extends TileEntityInventory implements IInventory ,IReactor, IWrenchable { - - private ItemStack heliumStack; - private int facing = 2; - private int progress; - - @Override - public void updateEntity(){ - Utils.LOG_WARNING("updateEntity"); - if(++progress >= 40){ - //if(++progress >= 300){ - if(heliumStack == null) - heliumStack = UtilsItems.getSimpleStack(ModItems.itemHeliumBlob); - else if(heliumStack.getItem() == ModItems.itemHeliumBlob && heliumStack.stackSize < 64) - heliumStack.stackSize++; - progress = 0; - markDirty(); - } - } - - @Override - public short getFacing(){ - return (short) facing; - } - - @Override - public void setFacing(short dir){ - facing = dir; - } - - /*@Override - public void readCustomNBT(NBTTagCompound tag) - { - this.heliumStack = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Helium")); - this.progress = tag.getInteger("Progress"); - this.facing = tag.getShort("Facing"); - this.heat = tag.getInteger("heat"); - this.prevActive = (this.active = tag.getBoolean("active")); - } - - @Override - public void writeCustomNBT(NBTTagCompound tag) - { - tag.setInteger("Progress", this.progress); - tag.setShort("Facing", (short) this.facing); - tag.setInteger("heat", this.heat); - tag.setBoolean("active", this.active); - if(heliumStack != null) { - NBTTagCompound produce = new NBTTagCompound(); - heliumStack.writeToNBT(produce); - tag.setTag("Helium", produce); - } - else - tag.removeTag("Helium"); - }*/ - - - @Override - public void readFromNBT(NBTTagCompound nbttagcompound) - { - super.readFromNBT(nbttagcompound); - - //this.heliumStack = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("Helium")); - NBTTagList list = nbttagcompound.getTagList("Items", 10); - for (int i = 0; i < list.tagCount(); ++i) { - NBTTagCompound stackTag = list.getCompoundTagAt(i); - int slot = stackTag.getByte("Slot") & 255; - this.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(stackTag)); - } - this.progress = nbttagcompound.getInteger("Progress"); - this.facing = nbttagcompound.getShort("Facing"); - this.heat = nbttagcompound.getInteger("heat"); - this.output = nbttagcompound.getShort("output"); - this.prevActive = (this.active = nbttagcompound.getBoolean("active")); - } - - @Override - public void writeToNBT(NBTTagCompound nbttagcompound) - { - super.writeToNBT(nbttagcompound); - - nbttagcompound.setInteger("Progress", this.progress); - nbttagcompound.setShort("Facing", (short) this.facing); - nbttagcompound.setInteger("heat", this.heat); - nbttagcompound.setShort("output", (short)(int)getReactorEnergyOutput()); - nbttagcompound.setBoolean("active", this.active); - /*if(heliumStack != null) { - NBTTagCompound produce = new NBTTagCompound(); - heliumStack.writeToNBT(produce); - nbttagcompound.setTag("Helium", produce); - } - else - nbttagcompound.removeTag("Helium");*/ - NBTTagList list = new NBTTagList(); - for (int i = 0; i < this.getSizeInventory(); ++i) { - if (this.getStackInSlot(i) != null) { - NBTTagCompound stackTag = new NBTTagCompound(); - stackTag.setByte("Slot", (byte) i); - this.getStackInSlot(i).writeToNBT(stackTag); - list.appendTag(stackTag); - } - } - nbttagcompound.setTag("Items", list); - } - - - @Override - public Packet getDescriptionPacket() { - NBTTagCompound tag = new NBTTagCompound(); - writeToNBT(tag); - return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, tag); - } - - @Override - public void onDataPacket(net.minecraft.network.NetworkManager net, S35PacketUpdateTileEntity packet) { - super.onDataPacket(net, packet); - readFromNBT(packet.func_148857_g()); - } - - - @Override - public int getSizeInventory() - { - return 19; - } - - @Override - public ItemStack getStackInSlot(int slot){ - return heliumStack; - } - - @Override - public ItemStack decrStackSize(int slot, int decrement){ - Utils.LOG_WARNING("decrStackSize"); - if(heliumStack == null) - return null; - if(decrement < heliumStack.stackSize){ - ItemStack take = heliumStack.splitStack(decrement); - if(heliumStack.stackSize <= 0) - heliumStack = null; - return take; - } - ItemStack take = heliumStack; - heliumStack = null; - return take; - } - - @Override - public void openInventory() {} - @Override - public void closeInventory() {} - - @Override - public boolean isUseableByPlayer(EntityPlayer player) - { - return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) == this && player.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack stack){ - return false; - } - - @Override - public int getInventoryStackLimit(){ - return 64; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack stack){ - heliumStack = stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(int slot){ - return null; - } - - /** - * Returns the name of the inventory - */ - @Override - public String getInventoryName() - { - //return "container.helium_collector"; - return "container.helium_collector"; - } - - /** - * Returns if the inventory is named - */ - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - //IC2 Nuclear Code - - - public Block[][][] surroundings = new Block[5][5][5]; - public final InvSlotRadiation reactorSlot; - public float output = 0.0F; - public int updateTicker; - public int heat = 5000; - public int maxHeat = 100000; - public float hem = 1.0F; - private int EmitHeatbuffer = 0; - public int EmitHeat = 0; - private boolean redstone = false; - private boolean fluidcoolreactor = false; - private boolean active = true; - public boolean prevActive = false; - - - public short getReactorSize() - { - //Utils.LOG_WARNING("getReactorSize"); - if (this.worldObj == null) { - Utils.LOG_WARNING("getReactorSize == 9"); - return 9; - } - short cols = 3; - //Utils.LOG_WARNING("getReactorSize == "+cols); - for (Direction direction : Direction.directions) - { - TileEntity target = direction.applyToTileEntity(this); - if ((target instanceof TileEntityHeliumGenerator)) { - cols = (short)(cols + 1); - Utils.LOG_WARNING("getReactorSize =1= "+cols); - } - } - //Utils.LOG_WARNING("getReactorSize == "+cols); - return cols; - } - - protected void updateEntityServer() - { - Utils.LOG_WARNING("updateEntityServer"); - super.updateEntity(); - - if (this.updateTicker++ % getTickRate() != 0) { - return; - } - if (!this.worldObj.doChunksNearChunkExist(this.xCoord, this.yCoord, this.zCoord, 2)) - { - this.output = 0.0F; - } - else - { - - dropAllUnfittingStuff(); - - this.output = 0.0F; - this.maxHeat = 10000; - this.hem = 1.0F; - - processChambers(); - this.EmitHeatbuffer = 0; - if (calculateHeatEffects()) { - return; - } - setActive((this.heat >= 1000) || (this.output > 0.0F)); - - markDirty(); - } - ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "output"); - } - - @Override - public void setActive(boolean active1) - { - Utils.LOG_WARNING("setActive"); - this.active = active1; - if (this.prevActive != active1) { - ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "active"); - } - this.prevActive = active1; - } - - public void dropAllUnfittingStuff() - { - Utils.LOG_WARNING("dropAllUnfittingStuff"); - for (int i = 0; i < this.reactorSlot.size(); i++) - { - ItemStack stack = this.reactorSlot.get(i); - if ((stack != null) && (!isUsefulItem(stack, false))) - { - this.reactorSlot.put(i, null); - eject(stack); - } - } - for (int i = this.reactorSlot.size(); i < this.reactorSlot.rawSize(); i++) - { - ItemStack stack = this.reactorSlot.get(i); - - this.reactorSlot.put(i, null); - eject(stack); - } - } - - public void eject(ItemStack drop) - { - Utils.LOG_WARNING("eject"); - if ((!IC2.platform.isSimulating()) || (drop == null)) { - return; - } - float f = 0.7F; - double d = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D; - double d1 = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D; - double d2 = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D; - EntityItem entityitem = new EntityItem(this.worldObj, this.xCoord + d, this.yCoord + d1, this.zCoord + d2, drop); - entityitem.delayBeforeCanPickup = 10; - this.worldObj.spawnEntityInWorld(entityitem); - } - - public boolean isUsefulItem(ItemStack stack, boolean forInsertion) - { - //Utils.LOG_WARNING("isUsefulItem"); - Item item = stack.getItem(); - if ((forInsertion) && (this.fluidcoolreactor) && - ((item instanceof ItemReactorHeatStorage)) && - (((ItemReactorHeatStorage)item).getCustomDamage(stack) > 0)) { - return false; - } - if ((item instanceof IReactorComponent)) { - return true; - } - return (item == Ic2Items.TritiumCell.getItem()) || (item == Ic2Items.reactorDepletedUraniumSimple.getItem()) || (item == Ic2Items.reactorDepletedUraniumDual.getItem()) || (item == Ic2Items.reactorDepletedUraniumQuad.getItem()) || (item == Ic2Items.reactorDepletedMOXSimple.getItem()) || (item == Ic2Items.reactorDepletedMOXDual.getItem()) || (item == Ic2Items.reactorDepletedMOXQuad.getItem()); - } - - public boolean calculateHeatEffects() - { - Utils.LOG_WARNING("calculateHeatEffects"); - if ((this.heat < 8000) || (!IC2.platform.isSimulating()) || (ConfigUtil.getFloat(MainConfig.get(), "protection/reactorExplosionPowerLimit") <= 0.0F)) { - return false; - } - float power = this.heat / this.maxHeat; - if (power >= 1.0F) - { - explode(); - return true; - } - if ((power >= 0.85F) && (this.worldObj.rand.nextFloat() <= 0.2F * this.hem)) - { - int[] coord = getRandCoord(2); - if (coord != null) - { - Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); - if (block.isAir(this.worldObj, coord[0], coord[1], coord[2])) - { - this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); - } - else if ((block.getBlockHardness(this.worldObj, coord[0], coord[1], coord[2]) >= 0.0F) && (this.worldObj.getTileEntity(coord[0], coord[1], coord[2]) == null)) - { - Material mat = block.getMaterial(); - if ((mat == Material.rock) || (mat == Material.iron) || (mat == Material.lava) || (mat == Material.ground) || (mat == Material.clay)) { - this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.flowing_lava, 15, 7); - } else { - this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); - } - } - } - } - if (power >= 0.7F) - { - List list1 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(this.xCoord - 3, this.yCoord - 3, this.zCoord - 3, this.xCoord + 4, this.yCoord + 4, this.zCoord + 4)); - for (int l = 0; l < list1.size(); l++) - { - Entity ent = (Entity)list1.get(l); - ent.attackEntityFrom(IC2DamageSource.radiation, (int)(this.worldObj.rand.nextInt(4) * this.hem)); - } - } - if ((power >= 0.5F) && (this.worldObj.rand.nextFloat() <= this.hem)) - { - int[] coord = getRandCoord(2); - if (coord != null) - { - Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); - if (block.getMaterial() == Material.water) { - this.worldObj.setBlockToAir(coord[0], coord[1], coord[2]); - } - } - } - if ((power >= 0.4F) && (this.worldObj.rand.nextFloat() <= this.hem)) - { - int[] coord = getRandCoord(2); - if ((coord != null) && - (this.worldObj.getTileEntity(coord[0], coord[1], coord[2]) == null)) - { - Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); - Material mat = block.getMaterial(); - if ((mat == Material.wood) || (mat == Material.leaves) || (mat == Material.cloth)) { - this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); - } - } - } - return false; - } - - public int[] getRandCoord(int radius) - { - if (radius <= 0) { - return null; - } - int[] c = new int[3]; - c[0] = (this.xCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius); - c[1] = (this.yCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius); - c[2] = (this.zCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius); - if ((c[0] == this.xCoord) && (c[1] == this.yCoord) && (c[2] == this.zCoord)) { - return null; - } - return c; - } - - public void processChambers() - { - Utils.LOG_WARNING("processChambers"); - int size = getReactorSize(); - for (int pass = 0; pass < 6; pass++) { - for (int y = 0; y < 3; y++) { - for (int x = 0; x < size; x++) - { - ItemStack stack = this.reactorSlot.get(x, y); - if ((stack != null) && ((stack.getItem() instanceof IReactorComponent))) - { - IReactorComponent comp = (IReactorComponent)stack.getItem(); - comp.processChamber(this, stack, x, y, pass == 0); - } - } - } - } - } - - @Override - public ChunkCoordinates getPosition() - { - return new ChunkCoordinates(this.xCoord, this.yCoord, this.zCoord); - } - - @Override - public World getWorld() { - return this.worldObj; - } - - @Override - public int getHeat() { - return this.heat; - } - - @Override - public void setHeat(int heat1) - { - this.heat = heat1; - } - - @Override - public int addHeat(int amount) - { - this.heat += amount; - return this.heat; - } - - @Override - public int getMaxHeat() - { - return this.maxHeat; - } - - @Override - public void setMaxHeat(int newMaxHeat) - { - this.maxHeat = newMaxHeat; - } - - @Override - public void addEmitHeat(int heat) - { - this.EmitHeatbuffer += heat; - } - - @Override - public float getHeatEffectModifier() - { - return this.hem; - } - - @Override - public void setHeatEffectModifier(float newHEM) - { - this.hem = newHEM; - } - - @Override - public float getReactorEnergyOutput() - { - return this.output; - } - - @Override - public double getReactorEUEnergyOutput() - { - return getOfferedEnergy(); - } - - public double getOfferedEnergy() - { - return getReactorEnergyOutput() * 5.0F * 1.0F; - } - - @Override - public float addOutput(float energy) - { - return this.output += energy; - } - - @Override - public ItemStack getItemAt(int x, int y) - { - Utils.LOG_WARNING("getItemAt"); - if ((x < 0) || (x >= getReactorSize()) || (y < 0) || (y >= 6)) { - return null; - } - return this.reactorSlot.get(x, y); - } - - @Override - public void setItemAt(int x, int y, ItemStack item) - { - Utils.LOG_WARNING("setItemAt"); - if ((x < 0) || (x >= getReactorSize()) || (y < 0) || (y >= 6)) { - return; - } - this.reactorSlot.put(x, y, item); - } - - public TileEntityHeliumGenerator() { - this.updateTicker = IC2.random.nextInt(getTickRate()); - this.reactorSlot = new InvSlotRadiation(this, "helium_collector", 0, 54); //TODO - } - - @Override - public void explode() { - Utils.LOG_WARNING("Explosion"); - //TODO - } - - @Override - public int getTickRate() - { - return 20; - } - - public boolean receiveredstone() - { - Utils.LOG_WARNING("receiveRedstone"); - if ((this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord)) || (this.redstone)) { - decrStackSize(-1, 1); - return true; - } - return false; - } - - @Override - public boolean produceEnergy() - { - Utils.LOG_WARNING("produceEnergy"); - return (receiveredstone()) && (ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/generator") > 0.0F); - } - - @Override - public void setRedstoneSignal(boolean redstone) - { - this.redstone = redstone; - } - - @Override - public boolean isFluidCooled() { - Utils.LOG_WARNING("isFluidCooled"); - return false; - } - - @Override - public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) - { - return true; - } - - @Override - public boolean wrenchCanRemove(EntityPlayer entityPlayer) - { - return true; - } - - @Override - public float getWrenchDropRate() - { - return 1F; - } - - @Override - public ItemStack getWrenchDrop(EntityPlayer entityPlayer) - { - return new ItemStack(ModBlocks.blockHeliumGenerator, 1); - } - -} diff --git a/src/Java/miscutil/core/block/machine/Machine_Charger.java b/src/Java/miscutil/core/block/machine/Machine_Charger.java new file mode 100644 index 0000000000..9efb539afb --- /dev/null +++ b/src/Java/miscutil/core/block/machine/Machine_Charger.java @@ -0,0 +1,82 @@ +package miscutil.core.block.machine; + +import java.util.ArrayList; + +import miscutil.MiscUtils; +import miscutil.core.creative.AddToCreativeTab; +import miscutil.core.lib.CORE; +import miscutil.core.tileentities.machines.TileEntityCharger; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import scala.util.Random; + +public class Machine_Charger extends BlockContainer +{ + private static final String name = "Charging Machine"; + + private final Random rand = new Random(); + + public Machine_Charger(String unlocalizedName) + { + super(Material.iron); + //GameRegistry.registerBlock(this, unlocalizedName); + this.setBlockName(unlocalizedName); + this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName); + this.setCreativeTab(AddToCreativeTab.tabMachines); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) + { + if (world.isRemote) return true; + + TileEntity te = world.getTileEntity(x, y, z); + if (te != null && te instanceof TileEntityCharger) + { + player.openGui(MiscUtils.instance, 1, world, x, y, z); + return true; + } + return false; + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int par6) + { + if (world.isRemote) return; + + ArrayList drops = new ArrayList(); + + TileEntity teRaw = world.getTileEntity(x, y, z); + + if (teRaw != null && teRaw instanceof TileEntityCharger) + { + TileEntityCharger te = (TileEntityCharger) teRaw; + + for (int i = 0; i < te.getSizeInventory(); i++) + { + ItemStack stack = te.getStackInSlot(i); + + if (stack != null) drops.add(stack.copy()); + } + } + + for (int i = 0;i < drops.size();i++) + { + EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, (ItemStack) drops.get(i)); + item.setVelocity((rand.nextDouble() - 0.5) * 0.25, rand.nextDouble() * 0.5 * 0.25, (rand.nextDouble() - 0.5) * 0.25); + world.spawnEntityInWorld(item); + } + } + + @Override + public TileEntity createNewTileEntity(World world, int par2) + { + return new TileEntityCharger(); + } +} \ No newline at end of file diff --git a/src/Java/miscutil/core/block/machine/Machine_NHG.java b/src/Java/miscutil/core/block/machine/Machine_NHG.java index 1738469fd7..fe06577307 100644 --- a/src/Java/miscutil/core/block/machine/Machine_NHG.java +++ b/src/Java/miscutil/core/block/machine/Machine_NHG.java @@ -5,7 +5,7 @@ import java.util.ArrayList; import miscutil.MiscUtils; import miscutil.core.creative.AddToCreativeTab; import miscutil.core.lib.CORE; -import miscutil.core.tileentities.TileEntityNHG; +import miscutil.core.tileentities.machines.TileEntityNHG; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; diff --git a/src/Java/miscutil/core/block/machine/heliumgen/block/HeliumGenerator.java b/src/Java/miscutil/core/block/machine/heliumgen/block/HeliumGenerator.java new file mode 100644 index 0000000000..83897db5e0 --- /dev/null +++ b/src/Java/miscutil/core/block/machine/heliumgen/block/HeliumGenerator.java @@ -0,0 +1,164 @@ +package miscutil.core.block.machine.heliumgen.block; + +import java.util.Random; + +import miscutil.MiscUtils; +import miscutil.core.block.machine.heliumgen.tileentity.TileEntityHeliumGenerator; +import miscutil.core.creative.AddToCreativeTab; +import miscutil.core.lib.CORE; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class HeliumGenerator extends BlockContainer { + + private IIcon top, sides, front; + private Random randy = new Random(); + + public HeliumGenerator(){ + super(Material.iron); + setStepSound(Block.soundTypeMetal); + setHardness(20.0F); + setBlockName("helium_collector"); + setHarvestLevel("pickaxe", 3); + setCreativeTab(AddToCreativeTab.tabMachines); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons (IIconRegister iconRegister) + { + this.top = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_SIDE"); + this.sides = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_SIDE"); + this.front = iconRegister.registerIcon(CORE.MODID+":blockHeliumCollector_FRONT"); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ + if(side == 1) + return top; + int facing = 2; + TileEntityHeliumGenerator machine = (TileEntityHeliumGenerator)world.getTileEntity(x, y, z); + if(machine != null) + facing = machine.getFacing(); + if(side == facing) + return front; + else + return sides; + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon (int side, int metadata) + { + if(side == 1) + return top; + if(side == 3) + return front; + return sides; + } + + @Override + public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) + { + if (world.isRemote) + { + return true; + } + player.openGui(MiscUtils.instance, 2, world, x, y, z); + return true; + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) + { + return new TileEntityHeliumGenerator(); + } + + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack item) + { + TileEntity tile = world.getTileEntity(x, y, z); + if(tile instanceof TileEntityHeliumGenerator) { + TileEntityHeliumGenerator machine = (TileEntityHeliumGenerator)tile; + int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + + if (l == 0) + machine.setFacing((short) 2); + + if (l == 1) + machine.setFacing((short) 5); + + if (l == 2) + machine.setFacing((short) 3); + + if (l == 3) + machine.setFacing((short) 4); + } + + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int wut) + { + TileEntityHeliumGenerator collector = (TileEntityHeliumGenerator)world.getTileEntity(x, y, z); + + if (collector != null) + { + int i = 0; + for (i = 0; i < collector.getSizeInventory(); i++){ + + ItemStack itemstack = collector.getStackInSlot(i); + + if (itemstack != null) + { + float f = this.randy.nextFloat() * 0.8F + 0.1F; + float f1 = this.randy.nextFloat() * 0.8F + 0.1F; + float f2 = this.randy.nextFloat() * 0.8F + 0.1F; + + while (itemstack.stackSize > 0) + { + int j1 = this.randy.nextInt(21) + 10; + + if (j1 > itemstack.stackSize) + { + j1 = itemstack.stackSize; + } + + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + + if (itemstack.hasTagCompound()) + { + entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); + } + + float f3 = 0.05F; + entityitem.motionX = (double)((float)this.randy.nextGaussian() * f3); + entityitem.motionY = (double)((float)this.randy.nextGaussian() * f3 + 0.2F); + entityitem.motionZ = (double)((float)this.randy.nextGaussian() * f3); + world.spawnEntityInWorld(entityitem); + } + } + + world.func_147453_f(x, y, z, block); + } + } + + super.breakBlock(world, x, y, z, block, wut); + } +} diff --git a/src/Java/miscutil/core/block/machine/heliumgen/container/ContainerHeliumGenerator.java b/src/Java/miscutil/core/block/machine/heliumgen/container/ContainerHeliumGenerator.java new file mode 100644 index 0000000000..17389a5abe --- /dev/null +++ b/src/Java/miscutil/core/block/machine/heliumgen/container/ContainerHeliumGenerator.java @@ -0,0 +1,75 @@ +package miscutil.core.block.machine.heliumgen.container; + +import ic2.core.ContainerBase; +import ic2.core.slot.SlotInvSlot; + +import java.util.List; + +import miscutil.core.block.machine.heliumgen.tileentity.TileEntityHeliumGenerator; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.inventory.SlotFurnace; + +public class ContainerHeliumGenerator +extends ContainerBase +{ + public short size; + + public ContainerHeliumGenerator(InventoryPlayer player, TileEntityHeliumGenerator machine) + { + super(machine); + //Utils.LOG_WARNING("containerHeliumGenerator"); + short sr = machine.getReactorSize(); + this.addSlotToContainer(new SlotFurnace(player.player, machine, 2, 80, 35)); + this.size = sr; + int startX = 16; + int startY = 16; + int i = 0; + for (i = 0; i < 9; i++) + { + int x = i % this.size; + int y = i / this.size; + + addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); + } + startX = 108; + startY = 16; + for (i = 9; i < 18; i++) + { + int x = i % this.size; + int y = (i-9) / this.size; + + addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); + } + for (i = 0; i < 3; ++i) + { + for (int j = 0; j < 9; ++j) + { + this.addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + } + } + + for (i = 0; i < 9; ++i) + { + this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 142)); + } + // addSlotToContainer(new SlotInvSlot(machine.coolantinputSlot, 0, 8, 25)); + //addSlotToContainer(new SlotInvSlot(machine.hotcoolinputSlot, 0, 188, 25)); + //addSlotToContainer(new SlotInvSlot(machine.coolantoutputSlot, 0, 8, 115)); + //addSlotToContainer(new SlotInvSlot(machine.hotcoolantoutputSlot, 0, 188, 115)); + } + + @Override + public List getNetworkedFields() + { + List ret = super.getNetworkedFields(); + + ret.add("heat"); + ret.add("maxHeat"); + ret.add("EmitHeat"); + /*ret.add("inputTank"); + ret.add("outputTank"); + ret.add("fluidcoolreactor");*/ + return ret; + } +} \ No newline at end of file diff --git a/src/Java/miscutil/core/block/machine/heliumgen/gui/GUIHeliumGenerator.java b/src/Java/miscutil/core/block/machine/heliumgen/gui/GUIHeliumGenerator.java new file mode 100644 index 0000000000..708ba9c924 --- /dev/null +++ b/src/Java/miscutil/core/block/machine/heliumgen/gui/GUIHeliumGenerator.java @@ -0,0 +1,72 @@ +package miscutil.core.block.machine.heliumgen.gui; + +import miscutil.core.block.machine.heliumgen.container.ContainerHeliumGenerator; +import miscutil.core.block.machine.heliumgen.tileentity.TileEntityHeliumGenerator; +import miscutil.core.lib.CORE; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class GUIHeliumGenerator extends GuiContainer +{ + private static final ResourceLocation collectorGuiTexture = new ResourceLocation(CORE.MODID, "textures/gui/helium_collector_gui.png"); + + public GUIHeliumGenerator(InventoryPlayer player, TileEntityHeliumGenerator machine) + { + super(new ContainerHeliumGenerator(player, machine)); + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + @Override + protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) + { + String s = StatCollector.translateToLocal("Helium Collector"); + this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752); + this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + + this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+-1), 80, 35, 2); + + short sr = 3; + int size = sr; + int startX = 16; + int startY = 16; + int i = 0; + for (i = 0; i < 9; i++) + { + int x = i % size; + int y = i / size; + this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+i), startX + 18 * x, startY + 18 * y, 4210752); + //addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); + } + startX = 108; + startY = 16; + for (i = 9; i < 18; i++) + { + int x = i % size; + int y = (i-9) / size; + this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+i), startX + 18 * x, startY + 18 * y, 4210752); + // addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y)); + } + + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(collectorGuiTexture); + int k = (this.width - this.xSize) / 2; + int l = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); + + } +} \ No newline at end of file diff --git a/src/Java/miscutil/core/block/machine/heliumgen/slots/InvSlotRadiation.java b/src/Java/miscutil/core/block/machine/heliumgen/slots/InvSlotRadiation.java new file mode 100644 index 0000000000..d8a9c38897 --- /dev/null +++ b/src/Java/miscutil/core/block/machine/heliumgen/slots/InvSlotRadiation.java @@ -0,0 +1,78 @@ +package miscutil.core.block.machine.heliumgen.slots; + +import ic2.core.block.invslot.InvSlot; +import miscutil.core.block.machine.heliumgen.tileentity.TileEntityHeliumGenerator; +import net.minecraft.item.ItemStack; + +public class InvSlotRadiation extends InvSlot +{ + public InvSlotRadiation(TileEntityHeliumGenerator base, String name1, int oldStartIndex1, int count) + { + super(base, name1, oldStartIndex1, InvSlot.Access.IO, count); + + setStackSizeLimit(1); + } + + @Override + public boolean accepts(ItemStack itemStack) + { + return ((TileEntityHeliumGenerator)this.base).isUsefulItem(itemStack, true); + } + + @Override + public int size() + { + //Utils.LOG_INFO("InvSlotRadiation/Size"); + return 3 * 6; + } + + public int rawSize() + { + return super.size(); + } + + @Override + public ItemStack get(int index) + { + return super.get(mapIndex(index)); + } + + public ItemStack get(int x, int y) + { + return super.get(y * 9 + x); + } + + @Override + public void put(int index, ItemStack content) + { + super.put(mapIndex(index), content); + } + + public void put(int x, int y, ItemStack content) + { + super.put(y * 9 + x, content); + } + + private int mapIndex(int index) + { + int size = size(); + int cols = size / 6; + if (index < size) + { + int row = index / cols; + int col = index % cols; + + return row * 9 + col; + } + index -= size; + int remCols = 9 - cols; + + int row = index / remCols; + int col = cols + index % remCols; + + return row * 9 + col; + } + + private final int rows = 6; + private final int maxCols = 9; +} diff --git a/src/Java/miscutil/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java b/src/Java/miscutil/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java new file mode 100644 index 0000000000..66420a72a5 --- /dev/null +++ b/src/Java/miscutil/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java @@ -0,0 +1,648 @@ +package miscutil.core.block.machine.heliumgen.tileentity; + +import ic2.api.Direction; +import ic2.api.reactor.IReactor; +import ic2.api.reactor.IReactorComponent; +import ic2.api.tile.IWrenchable; +import ic2.core.IC2; +import ic2.core.IC2DamageSource; +import ic2.core.Ic2Items; +import ic2.core.block.TileEntityInventory; +import ic2.core.init.MainConfig; +import ic2.core.item.reactor.ItemReactorHeatStorage; +import ic2.core.network.NetworkManager; +import ic2.core.util.ConfigUtil; + +import java.util.List; + +import miscutil.core.block.ModBlocks; +import miscutil.core.block.machine.heliumgen.slots.InvSlotRadiation; +import miscutil.core.item.ModItems; +import miscutil.core.util.Utils; +import miscutil.core.util.item.UtilsItems; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; + +public class TileEntityHeliumGenerator extends TileEntityInventory implements IInventory ,IReactor, IWrenchable { + + private ItemStack heliumStack; + private int facing = 2; + private int progress; + + @Override + public void updateEntity(){ + Utils.LOG_WARNING("updateEntity"); + if(++progress >= 40){ + //if(++progress >= 300){ + if(heliumStack == null) + heliumStack = UtilsItems.getSimpleStack(ModItems.itemHeliumBlob); + else if(heliumStack.getItem() == ModItems.itemHeliumBlob && heliumStack.stackSize < 64) + heliumStack.stackSize++; + progress = 0; + markDirty(); + } + } + + @Override + public short getFacing(){ + return (short) facing; + } + + @Override + public void setFacing(short dir){ + facing = dir; + } + + /*@Override + public void readCustomNBT(NBTTagCompound tag) + { + this.heliumStack = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Helium")); + this.progress = tag.getInteger("Progress"); + this.facing = tag.getShort("Facing"); + this.heat = tag.getInteger("heat"); + this.prevActive = (this.active = tag.getBoolean("active")); + } + + @Override + public void writeCustomNBT(NBTTagCompound tag) + { + tag.setInteger("Progress", this.progress); + tag.setShort("Facing", (short) this.facing); + tag.setInteger("heat", this.heat); + tag.setBoolean("active", this.active); + if(heliumStack != null) { + NBTTagCompound produce = new NBTTagCompound(); + heliumStack.writeToNBT(produce); + tag.setTag("Helium", produce); + } + else + tag.removeTag("Helium"); + }*/ + + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) + { + super.readFromNBT(nbttagcompound); + + //this.heliumStack = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("Helium")); + NBTTagList list = nbttagcompound.getTagList("Items", 10); + for (int i = 0; i < list.tagCount(); ++i) { + NBTTagCompound stackTag = list.getCompoundTagAt(i); + int slot = stackTag.getByte("Slot") & 255; + this.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(stackTag)); + } + this.progress = nbttagcompound.getInteger("Progress"); + this.facing = nbttagcompound.getShort("Facing"); + this.heat = nbttagcompound.getInteger("heat"); + this.output = nbttagcompound.getShort("output"); + this.prevActive = (this.active = nbttagcompound.getBoolean("active")); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) + { + super.writeToNBT(nbttagcompound); + + nbttagcompound.setInteger("Progress", this.progress); + nbttagcompound.setShort("Facing", (short) this.facing); + nbttagcompound.setInteger("heat", this.heat); + nbttagcompound.setShort("output", (short)(int)getReactorEnergyOutput()); + nbttagcompound.setBoolean("active", this.active); + /*if(heliumStack != null) { + NBTTagCompound produce = new NBTTagCompound(); + heliumStack.writeToNBT(produce); + nbttagcompound.setTag("Helium", produce); + } + else + nbttagcompound.removeTag("Helium");*/ + NBTTagList list = new NBTTagList(); + for (int i = 0; i < this.getSizeInventory(); ++i) { + if (this.getStackInSlot(i) != null) { + NBTTagCompound stackTag = new NBTTagCompound(); + stackTag.setByte("Slot", (byte) i); + this.getStackInSlot(i).writeToNBT(stackTag); + list.appendTag(stackTag); + } + } + nbttagcompound.setTag("Items", list); + } + + + @Override + public Packet getDescriptionPacket() { + NBTTagCompound tag = new NBTTagCompound(); + writeToNBT(tag); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, tag); + } + + @Override + public void onDataPacket(net.minecraft.network.NetworkManager net, S35PacketUpdateTileEntity packet) { + super.onDataPacket(net, packet); + readFromNBT(packet.func_148857_g()); + } + + + @Override + public int getSizeInventory() + { + return 19; + } + + @Override + public ItemStack getStackInSlot(int slot){ + return heliumStack; + } + + @Override + public ItemStack decrStackSize(int slot, int decrement){ + Utils.LOG_WARNING("decrStackSize"); + if(heliumStack == null) + return null; + if(decrement < heliumStack.stackSize){ + ItemStack take = heliumStack.splitStack(decrement); + if(heliumStack.stackSize <= 0) + heliumStack = null; + return take; + } + ItemStack take = heliumStack; + heliumStack = null; + return take; + } + + @Override + public void openInventory() {} + @Override + public void closeInventory() {} + + @Override + public boolean isUseableByPlayer(EntityPlayer player) + { + return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) == this && player.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack stack){ + return false; + } + + @Override + public int getInventoryStackLimit(){ + return 64; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack stack){ + heliumStack = stack; + } + + @Override + public ItemStack getStackInSlotOnClosing(int slot){ + return null; + } + + /** + * Returns the name of the inventory + */ + @Override + public String getInventoryName() + { + //return "container.helium_collector"; + return "container.helium_collector"; + } + + /** + * Returns if the inventory is named + */ + @Override + public boolean hasCustomInventoryName() + { + return false; + } + + //IC2 Nuclear Code + + + public Block[][][] surroundings = new Block[5][5][5]; + public final InvSlotRadiation reactorSlot; + public float output = 0.0F; + public int updateTicker; + public int heat = 5000; + public int maxHeat = 100000; + public float hem = 1.0F; + private int EmitHeatbuffer = 0; + public int EmitHeat = 0; + private boolean redstone = false; + private boolean fluidcoolreactor = false; + private boolean active = true; + public boolean prevActive = false; + + + public short getReactorSize() + { + //Utils.LOG_WARNING("getReactorSize"); + if (this.worldObj == null) { + Utils.LOG_WARNING("getReactorSize == 9"); + return 9; + } + short cols = 3; + //Utils.LOG_WARNING("getReactorSize == "+cols); + for (Direction direction : Direction.directions) + { + TileEntity target = direction.applyToTileEntity(this); + if ((target instanceof TileEntityHeliumGenerator)) { + cols = (short)(cols + 1); + Utils.LOG_WARNING("getReactorSize =1= "+cols); + } + } + //Utils.LOG_WARNING("getReactorSize == "+cols); + return cols; + } + + protected void updateEntityServer() + { + Utils.LOG_WARNING("updateEntityServer"); + super.updateEntity(); + + if (this.updateTicker++ % getTickRate() != 0) { + return; + } + if (!this.worldObj.doChunksNearChunkExist(this.xCoord, this.yCoord, this.zCoord, 2)) + { + this.output = 0.0F; + } + else + { + + dropAllUnfittingStuff(); + + this.output = 0.0F; + this.maxHeat = 10000; + this.hem = 1.0F; + + processChambers(); + this.EmitHeatbuffer = 0; + if (calculateHeatEffects()) { + return; + } + setActive((this.heat >= 1000) || (this.output > 0.0F)); + + markDirty(); + } + ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "output"); + } + + @Override + public void setActive(boolean active1) + { + Utils.LOG_WARNING("setActive"); + this.active = active1; + if (this.prevActive != active1) { + ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "active"); + } + this.prevActive = active1; + } + + public void dropAllUnfittingStuff() + { + Utils.LOG_WARNING("dropAllUnfittingStuff"); + for (int i = 0; i < this.reactorSlot.size(); i++) + { + ItemStack stack = this.reactorSlot.get(i); + if ((stack != null) && (!isUsefulItem(stack, false))) + { + this.reactorSlot.put(i, null); + eject(stack); + } + } + for (int i = this.reactorSlot.size(); i < this.reactorSlot.rawSize(); i++) + { + ItemStack stack = this.reactorSlot.get(i); + + this.reactorSlot.put(i, null); + eject(stack); + } + } + + public void eject(ItemStack drop) + { + Utils.LOG_WARNING("eject"); + if ((!IC2.platform.isSimulating()) || (drop == null)) { + return; + } + float f = 0.7F; + double d = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D; + double d1 = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D; + double d2 = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D; + EntityItem entityitem = new EntityItem(this.worldObj, this.xCoord + d, this.yCoord + d1, this.zCoord + d2, drop); + entityitem.delayBeforeCanPickup = 10; + this.worldObj.spawnEntityInWorld(entityitem); + } + + public boolean isUsefulItem(ItemStack stack, boolean forInsertion) + { + //Utils.LOG_WARNING("isUsefulItem"); + Item item = stack.getItem(); + if ((forInsertion) && (this.fluidcoolreactor) && + ((item instanceof ItemReactorHeatStorage)) && + (((ItemReactorHeatStorage)item).getCustomDamage(stack) > 0)) { + return false; + } + if ((item instanceof IReactorComponent)) { + return true; + } + return (item == Ic2Items.TritiumCell.getItem()) || (item == Ic2Items.reactorDepletedUraniumSimple.getItem()) || (item == Ic2Items.reactorDepletedUraniumDual.getItem()) || (item == Ic2Items.reactorDepletedUraniumQuad.getItem()) || (item == Ic2Items.reactorDepletedMOXSimple.getItem()) || (item == Ic2Items.reactorDepletedMOXDual.getItem()) || (item == Ic2Items.reactorDepletedMOXQuad.getItem()); + } + + public boolean calculateHeatEffects() + { + Utils.LOG_WARNING("calculateHeatEffects"); + if ((this.heat < 8000) || (!IC2.platform.isSimulating()) || (ConfigUtil.getFloat(MainConfig.get(), "protection/reactorExplosionPowerLimit") <= 0.0F)) { + return false; + } + float power = this.heat / this.maxHeat; + if (power >= 1.0F) + { + explode(); + return true; + } + if ((power >= 0.85F) && (this.worldObj.rand.nextFloat() <= 0.2F * this.hem)) + { + int[] coord = getRandCoord(2); + if (coord != null) + { + Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); + if (block.isAir(this.worldObj, coord[0], coord[1], coord[2])) + { + this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); + } + else if ((block.getBlockHardness(this.worldObj, coord[0], coord[1], coord[2]) >= 0.0F) && (this.worldObj.getTileEntity(coord[0], coord[1], coord[2]) == null)) + { + Material mat = block.getMaterial(); + if ((mat == Material.rock) || (mat == Material.iron) || (mat == Material.lava) || (mat == Material.ground) || (mat == Material.clay)) { + this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.flowing_lava, 15, 7); + } else { + this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); + } + } + } + } + if (power >= 0.7F) + { + List list1 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(this.xCoord - 3, this.yCoord - 3, this.zCoord - 3, this.xCoord + 4, this.yCoord + 4, this.zCoord + 4)); + for (int l = 0; l < list1.size(); l++) + { + Entity ent = (Entity)list1.get(l); + ent.attackEntityFrom(IC2DamageSource.radiation, (int)(this.worldObj.rand.nextInt(4) * this.hem)); + } + } + if ((power >= 0.5F) && (this.worldObj.rand.nextFloat() <= this.hem)) + { + int[] coord = getRandCoord(2); + if (coord != null) + { + Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); + if (block.getMaterial() == Material.water) { + this.worldObj.setBlockToAir(coord[0], coord[1], coord[2]); + } + } + } + if ((power >= 0.4F) && (this.worldObj.rand.nextFloat() <= this.hem)) + { + int[] coord = getRandCoord(2); + if ((coord != null) && + (this.worldObj.getTileEntity(coord[0], coord[1], coord[2]) == null)) + { + Block block = this.worldObj.getBlock(coord[0], coord[1], coord[2]); + Material mat = block.getMaterial(); + if ((mat == Material.wood) || (mat == Material.leaves) || (mat == Material.cloth)) { + this.worldObj.setBlock(coord[0], coord[1], coord[2], Blocks.fire, 0, 7); + } + } + } + return false; + } + + public int[] getRandCoord(int radius) + { + if (radius <= 0) { + return null; + } + int[] c = new int[3]; + c[0] = (this.xCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius); + c[1] = (this.yCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius); + c[2] = (this.zCoord + this.worldObj.rand.nextInt(2 * radius + 1) - radius); + if ((c[0] == this.xCoord) && (c[1] == this.yCoord) && (c[2] == this.zCoord)) { + return null; + } + return c; + } + + public void processChambers() + { + Utils.LOG_WARNING("processChambers"); + int size = getReactorSize(); + for (int pass = 0; pass < 6; pass++) { + for (int y = 0; y < 3; y++) { + for (int x = 0; x < size; x++) + { + ItemStack stack = this.reactorSlot.get(x, y); + if ((stack != null) && ((stack.getItem() instanceof IReactorComponent))) + { + IReactorComponent comp = (IReactorComponent)stack.getItem(); + comp.processChamber(this, stack, x, y, pass == 0); + } + } + } + } + } + + @Override + public ChunkCoordinates getPosition() + { + return new ChunkCoordinates(this.xCoord, this.yCoord, this.zCoord); + } + + @Override + public World getWorld() { + return this.worldObj; + } + + @Override + public int getHeat() { + return this.heat; + } + + @Override + public void setHeat(int heat1) + { + this.heat = heat1; + } + + @Override + public int addHeat(int amount) + { + this.heat += amount; + return this.heat; + } + + @Override + public int getMaxHeat() + { + return this.maxHeat; + } + + @Override + public void setMaxHeat(int newMaxHeat) + { + this.maxHeat = newMaxHeat; + } + + @Override + public void addEmitHeat(int heat) + { + this.EmitHeatbuffer += heat; + } + + @Override + public float getHeatEffectModifier() + { + return this.hem; + } + + @Override + public void setHeatEffectModifier(float newHEM) + { + this.hem = newHEM; + } + + @Override + public float getReactorEnergyOutput() + { + return this.output; + } + + @Override + public double getReactorEUEnergyOutput() + { + return getOfferedEnergy(); + } + + public double getOfferedEnergy() + { + return getReactorEnergyOutput() * 5.0F * 1.0F; + } + + @Override + public float addOutput(float energy) + { + return this.output += energy; + } + + @Override + public ItemStack getItemAt(int x, int y) + { + Utils.LOG_WARNING("getItemAt"); + if ((x < 0) || (x >= getReactorSize()) || (y < 0) || (y >= 6)) { + return null; + } + return this.reactorSlot.get(x, y); + } + + @Override + public void setItemAt(int x, int y, ItemStack item) + { + Utils.LOG_WARNING("setItemAt"); + if ((x < 0) || (x >= getReactorSize()) || (y < 0) || (y >= 6)) { + return; + } + this.reactorSlot.put(x, y, item); + } + + public TileEntityHeliumGenerator() { + this.updateTicker = IC2.random.nextInt(getTickRate()); + this.reactorSlot = new InvSlotRadiation(this, "helium_collector", 0, 54); //TODO + } + + @Override + public void explode() { + Utils.LOG_WARNING("Explosion"); + //TODO + } + + @Override + public int getTickRate() + { + return 20; + } + + public boolean receiveredstone() + { + Utils.LOG_WARNING("receiveRedstone"); + if ((this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord)) || (this.redstone)) { + decrStackSize(-1, 1); + return true; + } + return false; + } + + @Override + public boolean produceEnergy() + { + Utils.LOG_WARNING("produceEnergy"); + return (receiveredstone()) && (ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/generator") > 0.0F); + } + + @Override + public void setRedstoneSignal(boolean redstone) + { + this.redstone = redstone; + } + + @Override + public boolean isFluidCooled() { + Utils.LOG_WARNING("isFluidCooled"); + return false; + } + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) + { + return true; + } + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) + { + return true; + } + + @Override + public float getWrenchDropRate() + { + return 1F; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) + { + return new ItemStack(ModBlocks.blockHeliumGenerator, 1); + } + +} diff --git a/src/Java/miscutil/core/common/CommonProxy.java b/src/Java/miscutil/core/common/CommonProxy.java index 7c6b9b2d4f..499ea28eb6 100644 --- a/src/Java/miscutil/core/common/CommonProxy.java +++ b/src/Java/miscutil/core/common/CommonProxy.java @@ -17,6 +17,7 @@ import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; public class CommonProxy { @@ -57,9 +58,14 @@ public class CommonProxy { //Compat Handling COMPAT_HANDLER.InitialiseHandlerThenAddRecipes(); COMPAT_HANDLER.RemoveRecipesFromOtherMods(); - COMPAT_HANDLER.InitialiseLateHandlerThenAddRecipes(); COMPAT_HANDLER.startLoadingGregAPIBasedRecipes(); } + + + public void serverStarting(FMLServerStartingEvent e) + { + COMPAT_HANDLER.InitialiseLateHandlerThenAddRecipes(); + } public void registerNetworkStuff(){ ModGUI.init(); diff --git a/src/Java/miscutil/core/container/Container_Charger.java b/src/Java/miscutil/core/container/Container_Charger.java new file mode 100644 index 0000000000..cbe7156d0e --- /dev/null +++ b/src/Java/miscutil/core/container/Container_Charger.java @@ -0,0 +1,81 @@ +package miscutil.core.container; + +import miscutil.core.tileentities.machines.TileEntityCharger; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class Container_Charger extends Container +{ + private TileEntityCharger te; + + public static final int INPUT_1 = 0; + + private int slotID = 0; + + public Container_Charger(TileEntityCharger te, EntityPlayer player) + { + this.te = te; + + //Fuel Slot A + addSlotToContainer(new Slot(te, slotID++, 80, 53)); + + + + //Inventory + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 9; j++) + { + addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + } + } + // Hotbar + for (int i = 0; i < 9; i++) + { + addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) + { + ItemStack stack = null; + Slot slot = (Slot)inventorySlots.get(slotRaw); + + if (slot != null && slot.getHasStack()) + { + ItemStack stackInSlot = slot.getStack(); + stack = stackInSlot.copy(); + + if (slotRaw < 3 * 9) + { + if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) + { + return null; + } + } + else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) + { + return null; + } + + if (stackInSlot.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + else + { + slot.onSlotChanged(); + } + } + return stack; + } + + @Override + public boolean canInteractWith(EntityPlayer player) + { + return te.isUseableByPlayer(player); + } +} \ No newline at end of file diff --git a/src/Java/miscutil/core/container/Container_NHG.java b/src/Java/miscutil/core/container/Container_NHG.java index 8baed3f5bd..78461ad2b7 100644 --- a/src/Java/miscutil/core/container/Container_NHG.java +++ b/src/Java/miscutil/core/container/Container_NHG.java @@ -1,6 +1,6 @@ package miscutil.core.container; -import miscutil.core.tileentities.TileEntityNHG; +import miscutil.core.tileentities.machines.TileEntityNHG; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; diff --git a/src/Java/miscutil/core/creative/AddToCreativeTab.java b/src/Java/miscutil/core/creative/AddToCreativeTab.java index 2f271dfa9e..869f2c4925 100644 --- a/src/Java/miscutil/core/creative/AddToCreativeTab.java +++ b/src/Java/miscutil/core/creative/AddToCreativeTab.java @@ -1,5 +1,9 @@ package miscutil.core.creative; +import miscutil.core.creative.tabs.MiscUtilCreativeTabBlock; +import miscutil.core.creative.tabs.MiscUtilCreativeTabMachines; +import miscutil.core.creative.tabs.MiscUtilCreativeTabMisc; +import miscutil.core.creative.tabs.MiscUtilCreativeTabTools; import miscutil.core.lib.CORE; import net.minecraft.creativetab.CreativeTabs; diff --git a/src/Java/miscutil/core/creative/MiscUtilCreativeTabBlock.java b/src/Java/miscutil/core/creative/MiscUtilCreativeTabBlock.java deleted file mode 100644 index b048df7f12..0000000000 --- a/src/Java/miscutil/core/creative/MiscUtilCreativeTabBlock.java +++ /dev/null @@ -1,18 +0,0 @@ -package miscutil.core.creative; - -import miscutil.core.block.ModBlocks; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; - -public class MiscUtilCreativeTabBlock extends CreativeTabs { - - public MiscUtilCreativeTabBlock(String lable) { - super(lable); - } - - @Override - public Item getTabIconItem() { - return Item.getItemFromBlock(ModBlocks.blockStaballoy); - } - -} diff --git a/src/Java/miscutil/core/creative/MiscUtilCreativeTabMachines.java b/src/Java/miscutil/core/creative/MiscUtilCreativeTabMachines.java deleted file mode 100644 index 9029e8d3c7..0000000000 --- a/src/Java/miscutil/core/creative/MiscUtilCreativeTabMachines.java +++ /dev/null @@ -1,18 +0,0 @@ -package miscutil.core.creative; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Items; -import net.minecraft.item.Item; - -public class MiscUtilCreativeTabMachines extends CreativeTabs { - - public MiscUtilCreativeTabMachines(String lable) { - super(lable); - } - - @Override - public Item getTabIconItem() { - return Items.experience_bottle; - } - -} diff --git a/src/Java/miscutil/core/creative/MiscUtilCreativeTabMisc.java b/src/Java/miscutil/core/creative/MiscUtilCreativeTabMisc.java deleted file mode 100644 index ee8aebe16d..0000000000 --- a/src/Java/miscutil/core/creative/MiscUtilCreativeTabMisc.java +++ /dev/null @@ -1,18 +0,0 @@ -package miscutil.core.creative; - -import miscutil.core.item.ModItems; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; - -public class MiscUtilCreativeTabMisc extends CreativeTabs { - - public MiscUtilCreativeTabMisc(String lable) { - super(lable); - } - - @Override - public Item getTabIconItem() { - return ModItems.itemPlateVibrantAlloy; - } - -} diff --git a/src/Java/miscutil/core/creative/MiscUtilCreativeTabTools.java b/src/Java/miscutil/core/creative/MiscUtilCreativeTabTools.java deleted file mode 100644 index 75fba9e0ff..0000000000 --- a/src/Java/miscutil/core/creative/MiscUtilCreativeTabTools.java +++ /dev/null @@ -1,18 +0,0 @@ -package miscutil.core.creative; - -import miscutil.core.item.ModItems; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; - -public class MiscUtilCreativeTabTools extends CreativeTabs { - - public MiscUtilCreativeTabTools(String lable) { - super(lable); - } - - @Override - public Item getTabIconItem() { - return ModItems.itemStaballoyAxe; - } - -} diff --git a/src/Java/miscutil/core/creative/tabs/MiscUtilCreativeTabBlock.java b/src/Java/miscutil/core/creative/tabs/MiscUtilCreativeTabBlock.java new file mode 100644 index 0000000000..343eb2f341 --- /dev/null +++ b/src/Java/miscutil/core/creative/tabs/MiscUtilCreativeTabBlock.java @@ -0,0 +1,18 @@ +package miscutil.core.creative.tabs; + +import miscutil.core.block.ModBlocks; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; + +public class MiscUtilCreativeTabBlock extends CreativeTabs { + + public MiscUtilCreativeTabBlock(String lable) { + super(lable); + } + + @Override + public Item getTabIconItem() { + return Item.getItemFromBlock(ModBlocks.blockStaballoy); + } + +} diff --git a/src/Java/miscutil/core/creative/tabs/MiscUtilCreativeTabMachines.java b/src/Java/miscutil/core/creative/tabs/MiscUtilCreativeTabMachines.java new file mode 100644 index 0000000000..6bc433b93a --- /dev/null +++ b/src/Java/miscutil/core/creative/tabs/MiscUtilCreativeTabMachines.java @@ -0,0 +1,18 @@ +package miscutil.core.creative.tabs; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Items; +import net.minecraft.item.Item; + +public class MiscUtilCreativeTabMachines extends CreativeTabs { + + public MiscUtilCreativeTabMachines(String lable) { + super(lable); + } + + @Override + public Item getTabIconItem() { + return Items.experience_bottle; + } + +} diff --git a/src/Java/miscutil/core/creative/tabs/MiscUtilCreativeTabMisc.java b/src/Java/miscutil/core/creative/tabs/MiscUtilCreativeTabMisc.java new file mode 100644 index 0000000000..1330f86aee --- /dev/null +++ b/src/Java/miscutil/core/creative/tabs/MiscUtilCreativeTabMisc.java @@ -0,0 +1,18 @@ +package miscutil.core.creative.tabs; + +import miscutil.core.item.ModItems; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; + +public class MiscUtilCreativeTabMisc extends CreativeTabs { + + public MiscUtilCreativeTabMisc(String lable) { + super(lable); + } + + @Override + public Item getTabIconItem() { + return ModItems.itemPlateVibrantAlloy; + } + +} diff --git a/src/Java/miscutil/core/creative/tabs/MiscUtilCreativeTabTools.java b/src/Java/miscutil/core/creative/tabs/MiscUtilCreativeTabTools.java new file mode 100644 index 0000000000..feddf0e5aa --- /dev/null +++ b/src/Java/miscutil/core/creative/tabs/MiscUtilCreativeTabTools.java @@ -0,0 +1,18 @@ +package miscutil.core.creative.tabs; + +import miscutil.core.item.ModItems; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; + +public class MiscUtilCreativeTabTools extends CreativeTabs { + + public MiscUtilCreativeTabTools(String lable) { + super(lable); + } + + @Override + public Item getTabIconItem() { + return ModItems.itemStaballoyAxe; + } + +} diff --git a/src/Java/miscutil/core/gui/ModGUI.java b/src/Java/miscutil/core/gui/ModGUI.java index 259270d224..82f6ebf3bf 100644 --- a/src/Java/miscutil/core/gui/ModGUI.java +++ b/src/Java/miscutil/core/gui/ModGUI.java @@ -1,9 +1,9 @@ package miscutil.core.gui; import miscutil.MiscUtils; -import miscutil.core.block.heliumgen.container.ContainerHeliumGenerator; -import miscutil.core.block.heliumgen.gui.GUIHeliumGenerator; -import miscutil.core.block.heliumgen.tileentity.TileEntityHeliumGenerator; +import miscutil.core.block.machine.heliumgen.container.ContainerHeliumGenerator; +import miscutil.core.block.machine.heliumgen.gui.GUIHeliumGenerator; +import miscutil.core.block.machine.heliumgen.tileentity.TileEntityHeliumGenerator; import miscutil.core.handler.GuiHandler; import miscutil.core.util.Utils; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/Java/miscutil/core/gui/machine/GUI_Charger.java b/src/Java/miscutil/core/gui/machine/GUI_Charger.java new file mode 100644 index 0000000000..deca8d4f09 --- /dev/null +++ b/src/Java/miscutil/core/gui/machine/GUI_Charger.java @@ -0,0 +1,50 @@ +package miscutil.core.gui.machine; + +import miscutil.core.container.Container_Charger; +import miscutil.core.lib.CORE; +import miscutil.core.tileentities.machines.TileEntityCharger; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +public class GUI_Charger extends GuiContainer +{ + private ResourceLocation texture = new ResourceLocation(CORE.MODID, "textures/gui/machine_Charger.png"); + + private InventoryPlayer inventory; + private TileEntityCharger te; + + public GUI_Charger(TileEntityCharger te, EntityPlayer player) + { + super(new Container_Charger(te, player)); + inventory = player.inventory; + this.te = te; + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + Minecraft.getMinecraft().renderEngine.bindTexture(texture); + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + fontRendererObj.drawString(I18n.format(te.getInventoryName()), (xSize / 2) - (fontRendererObj.getStringWidth(I18n.format(te.getInventoryName())) / 2), 6, 4210752, false); + //fontRendererObj.drawString(I18n.format(inventory.getInventoryName()), 8, ySize - 96 + 2, 4210752); + fontRendererObj.drawString(I18n.format("Charge:"+te.getCharge()+"~"), 8, ySize - 96 + 2, 4210752); + fontRendererObj.drawString(I18n.format("Progress:"+te.getProgress()+"ticks"), 80, ySize - 96 + 2, 4210752); + } +} \ No newline at end of file diff --git a/src/Java/miscutil/core/gui/machine/GUI_NHG.java b/src/Java/miscutil/core/gui/machine/GUI_NHG.java index b536157a49..e2239d6d40 100644 --- a/src/Java/miscutil/core/gui/machine/GUI_NHG.java +++ b/src/Java/miscutil/core/gui/machine/GUI_NHG.java @@ -2,7 +2,7 @@ package miscutil.core.gui.machine; import miscutil.core.container.Container_NHG; import miscutil.core.lib.CORE; -import miscutil.core.tileentities.TileEntityNHG; +import miscutil.core.tileentities.machines.TileEntityNHG; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; diff --git a/src/Java/miscutil/core/handler/COMPAT_HANDLER.java b/src/Java/miscutil/core/handler/COMPAT_HANDLER.java index 9035039cdf..078c3984ac 100644 --- a/src/Java/miscutil/core/handler/COMPAT_HANDLER.java +++ b/src/Java/miscutil/core/handler/COMPAT_HANDLER.java @@ -24,6 +24,7 @@ import miscutil.core.handler.registration.gregtech.GregtechEnergyBuffer; import miscutil.core.handler.registration.gregtech.GregtechIndustrialCentrifuge; import miscutil.core.handler.registration.gregtech.GregtechIndustrialCokeOven; import miscutil.core.handler.registration.gregtech.GregtechIndustrialPlatePress; +import miscutil.core.handler.registration.gregtech.GregtechRocketFuelGenerator; import miscutil.core.handler.registration.gregtech.GregtechSafeBlock; import miscutil.core.handler.registration.gregtech.GregtechSteamCondenser; import miscutil.core.item.ModItems; @@ -34,6 +35,7 @@ import miscutil.core.recipe.ShapedRecipeObject; import miscutil.core.util.Utils; import miscutil.core.util.item.UtilsItems; import miscutil.core.util.recipe.UtilsRecipe; +import miscutil.gregtech.common.items.MetaGeneratedGregtechItems; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; @@ -71,6 +73,7 @@ public class COMPAT_HANDLER { public static void registerGregtechMachines() { if (Gregtech) { + new MetaGeneratedGregtechItems(); GregtechEnergyBuffer.run(); GregtechConduits.run(); GregtechSteamCondenser.run(); @@ -78,6 +81,7 @@ public class COMPAT_HANDLER { GregtechIndustrialCentrifuge.run(); GregtechIndustrialCokeOven.run(); GregtechIndustrialPlatePress.run(); + GregtechRocketFuelGenerator.run(); } } diff --git a/src/Java/miscutil/core/handler/GuiHandler.java b/src/Java/miscutil/core/handler/GuiHandler.java index 67200c6cf3..d604f1b147 100644 --- a/src/Java/miscutil/core/handler/GuiHandler.java +++ b/src/Java/miscutil/core/handler/GuiHandler.java @@ -1,8 +1,11 @@ package miscutil.core.handler; +import miscutil.core.container.Container_Charger; import miscutil.core.container.Container_NHG; +import miscutil.core.gui.machine.GUI_Charger; import miscutil.core.gui.machine.GUI_NHG; -import miscutil.core.tileentities.TileEntityNHG; +import miscutil.core.tileentities.machines.TileEntityCharger; +import miscutil.core.tileentities.machines.TileEntityNHG; import miscutil.core.util.Utils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; @@ -12,7 +15,7 @@ import cpw.mods.fml.common.network.IGuiHandler; public class GuiHandler implements IGuiHandler { private static final int GUI1 = 0; //Nuclear Helium Gen. - private static final int GUI2 = 1; //Energy Buffer + private static final int GUI2 = 1; //Energy Charger @@ -25,7 +28,7 @@ public class GuiHandler implements IGuiHandler { return new Container_NHG((TileEntityNHG)te, player); } else if (ID == GUI2){ - + return new Container_Charger((TileEntityCharger)te, player); } @@ -44,8 +47,8 @@ public class GuiHandler implements IGuiHandler { return new GUI_NHG((TileEntityNHG) te, player); } else if (ID == GUI2){ - Utils.LOG_WARNING("Opening Gui with Id: "+ID+" Energy Buffer"); - //return new GUI_Bat_Buf(); + Utils.LOG_WARNING("Opening Gui with Id: "+ID+" Charger"); + return new GUI_Charger((TileEntityCharger) te, player); } } return null; diff --git a/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialCentrifuge.java b/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialCentrifuge.java index 06da27f8a3..324131155d 100644 --- a/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialCentrifuge.java +++ b/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialCentrifuge.java @@ -2,7 +2,7 @@ package miscutil.core.handler.registration.gregtech; import miscutil.core.util.Utils; import miscutil.gregtech.api.enums.GregtechItemList; -import miscutil.gregtech.common.machines.multi.GregtechMetaTileEntityIndustrialCentrifuge; +import miscutil.gregtech.common.tileentities.machines.multi.GregtechMetaTileEntityIndustrialCentrifuge; public class GregtechIndustrialCentrifuge { diff --git a/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialCokeOven.java b/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialCokeOven.java index 00aecf6415..53f540609c 100644 --- a/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialCokeOven.java +++ b/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialCokeOven.java @@ -2,7 +2,7 @@ package miscutil.core.handler.registration.gregtech; import miscutil.core.util.Utils; import miscutil.gregtech.api.enums.GregtechItemList; -import miscutil.gregtech.common.machines.multi.GregtechMetaTileEntityIndustrialCokeOven; +import miscutil.gregtech.common.tileentities.machines.multi.GregtechMetaTileEntityIndustrialCokeOven; public class GregtechIndustrialCokeOven { diff --git a/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialPlatePress.java b/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialPlatePress.java index c66dad598d..eba567ea42 100644 --- a/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialPlatePress.java +++ b/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialPlatePress.java @@ -1,7 +1,7 @@ package miscutil.core.handler.registration.gregtech; import miscutil.gregtech.api.enums.GregtechItemList; -import miscutil.gregtech.common.machines.multi.GregtechMetaTileEntityIndustrialPlatePress; +import miscutil.gregtech.common.tileentities.machines.multi.GregtechMetaTileEntityIndustrialPlatePress; public class GregtechIndustrialPlatePress { diff --git a/src/Java/miscutil/core/handler/registration/gregtech/GregtechRocketFuelGenerator.java b/src/Java/miscutil/core/handler/registration/gregtech/GregtechRocketFuelGenerator.java new file mode 100644 index 0000000000..79e33d5a78 --- /dev/null +++ b/src/Java/miscutil/core/handler/registration/gregtech/GregtechRocketFuelGenerator.java @@ -0,0 +1,34 @@ +package miscutil.core.handler.registration.gregtech; + +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_ModHandler; +import miscutil.core.lib.LoadedMods; +import miscutil.core.util.Utils; +import miscutil.gregtech.api.enums.GregtechItemList; +import miscutil.gregtech.common.tileentities.generators.GregtechMetaTileEntityRocketFuelGenerator; + +public class GregtechRocketFuelGenerator { + + public static void run() + { + if (LoadedMods.Gregtech){ + Utils.LOG_INFO("MiscUtils: Gregtech5u Content | Registering Industrial Rocket Engines."); + run1(); + } + + } + + private static void run1(){ + GregtechItemList.Rocket_Engine_EV.set(new GregtechMetaTileEntityRocketFuelGenerator(793, "advancedgenerator.rocketFuel.tier.01", "Basic Rocket Engine", 4).getStackForm(1L)); + GregtechItemList.Rocket_Engine_IV.set(new GregtechMetaTileEntityRocketFuelGenerator(794, "advancedgenerator.rocketFuel.tier.02", "Advanced Rocket Engine", 5).getStackForm(1L)); + GregtechItemList.Rocket_Engine_LuV.set(new GregtechMetaTileEntityRocketFuelGenerator(795, "advancedgenerator.rocketFuel.tier.03", "Turbo Rocket Engine", 6).getStackForm(1L)); + + GT_ModHandler.addCraftingRecipe(GregtechItemList.Rocket_Engine_EV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"PCP", "EME", "GWG", Character.valueOf('M'), ItemList.Hull_EV, Character.valueOf('P'), ItemList.Electric_Piston_LV, Character.valueOf('E'), ItemList.Electric_Motor_LV, Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Advanced), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Aluminium), Character.valueOf('G'), OrePrefixes.gearGt.get(Materials.Titanium)}); + GT_ModHandler.addCraftingRecipe(GregtechItemList.Rocket_Engine_IV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"PCP", "EME", "GWG", Character.valueOf('M'), ItemList.Hull_IV, Character.valueOf('P'), ItemList.Electric_Piston_MV, Character.valueOf('E'), ItemList.Electric_Motor_MV, Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Elite), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Platinum), Character.valueOf('G'), OrePrefixes.gearGt.get(Materials.TungstenSteel)}); + GT_ModHandler.addCraftingRecipe(GregtechItemList.Rocket_Engine_LuV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"PCP", "EME", "GWG", Character.valueOf('M'), ItemList.Hull_LuV, Character.valueOf('P'), ItemList.Electric_Piston_HV, Character.valueOf('E'), ItemList.Electric_Motor_HV, Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Master), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Tungsten), Character.valueOf('G'), OrePrefixes.gearGt.get(Materials.Chrome)}); + + } + +} diff --git a/src/Java/miscutil/core/handler/registration/gregtech/GregtechSteamCondenser.java b/src/Java/miscutil/core/handler/registration/gregtech/GregtechSteamCondenser.java index 652f089719..afc899410b 100644 --- a/src/Java/miscutil/core/handler/registration/gregtech/GregtechSteamCondenser.java +++ b/src/Java/miscutil/core/handler/registration/gregtech/GregtechSteamCondenser.java @@ -3,7 +3,7 @@ package miscutil.core.handler.registration.gregtech; import miscutil.core.util.Utils; import miscutil.gregtech.api.enums.GregtechItemList; import miscutil.gregtech.api.metatileentity.implementations.GregtechMetaCondensor; -import miscutil.gregtech.common.machines.multi.GregtechMetaTileEntityIronBlastFurnace; +import miscutil.gregtech.common.tileentities.machines.multi.GregtechMetaTileEntityIronBlastFurnace; public class GregtechSteamCondenser { diff --git a/src/Java/miscutil/core/item/ModItems.java b/src/Java/miscutil/core/item/ModItems.java index fbec6a59a3..6da428c924 100644 --- a/src/Java/miscutil/core/item/ModItems.java +++ b/src/Java/miscutil/core/item/ModItems.java @@ -105,6 +105,9 @@ Gold Tool: 22*/ public static Item FuelRod_Uranium; public static Item FuelRod_Plutonium; + public static Item itemBedLocator_Base; + public static Item itemBaseItemWithCharge; + //@SuppressWarnings("unused") public static final void init(){ @@ -225,10 +228,10 @@ Gold Tool: 22*/ FuelRod_Uranium = new FuelRod_Base("itemFuelRod_Uranium", "Uranium", 2500, 2500); FuelRod_Plutonium = new FuelRod_Base("itemFuelRod_Plutonium", "Plutonium", 5000, 5000); //Registry - GameRegistry.registerItem(FuelRod_Empty, "itemFuelRod_Empty"); - GameRegistry.registerItem(FuelRod_Thorium, "itemFuelRod_Thorium"); - GameRegistry.registerItem(FuelRod_Uranium, "itemFuelRod_Uranium"); - GameRegistry.registerItem(FuelRod_Plutonium, "itemFuelRod_Plutonium"); + //GameRegistry.registerItem(FuelRod_Empty, "itemFuelRod_Empty"); + //GameRegistry.registerItem(FuelRod_Thorium, "itemFuelRod_Thorium"); + //GameRegistry.registerItem(FuelRod_Uranium, "itemFuelRod_Uranium"); + //GameRegistry.registerItem(FuelRod_Plutonium, "itemFuelRod_Plutonium"); } else { Utils.LOG_WARNING("IndustrialCraft2 not Found - Skipping Resources."); @@ -236,6 +239,14 @@ Gold Tool: 22*/ /* * Misc Items */ + + + //itemBedLocator_Base = new BedLocator_Base("itemBedLocator_Base"); + //GameRegistry.registerItem(itemBedLocator_Base, "itemBedLocator_Base"); + + //itemBaseItemWithCharge = new BaseItemWithCharge("itemBaseItemWithCharge", 0, 1000); + //GameRegistry.registerItem(itemBaseItemWithCharge, "itemBaseItemWithCharge"); + //Staballoy Equipment itemStaballoyPickaxe = new StaballoyPickaxe("itemStaballoyPickaxe", STABALLOY).setCreativeTab(AddToCreativeTab.tabTools); GameRegistry.registerItem(itemStaballoyPickaxe, itemStaballoyPickaxe.getUnlocalizedName()); @@ -257,10 +268,10 @@ Gold Tool: 22*/ //Buffer Cores! Item itemBufferCore; for(int i=1; i<=10; i++){ - Utils.LOG_INFO(""+i); + //Utils.LOG_INFO(""+i); itemBufferCore = new BufferCore("itemBufferCore", i).setCreativeTab(AddToCreativeTab.tabMisc); GameRegistry.registerItem(itemBufferCore, itemBufferCore.getUnlocalizedName()+i); - System.out.println("Buffer Core registration count is: "+i); + //System.out.println("Buffer Core registration count is: "+i); } //Dev Items itemStickyRubber = new Item().setUnlocalizedName("itemStickyRubber").setCreativeTab(tabMisc).setTextureName(CORE.MODID + ":itemStickyRubber"); @@ -270,6 +281,7 @@ Gold Tool: 22*/ GameRegistry.registerItem(itemIngotBatteryAlloy, "itemIngotBatteryAlloy"); itemPlateBatteryAlloy = new Item().setUnlocalizedName("itemPlateBatteryAlloy").setCreativeTab(tabMisc).setTextureName(CORE.MODID + ":itemPlateBatteryAlloy"); GameRegistry.registerItem(itemPlateBatteryAlloy, "itemPlateBatteryAlloy"); + itemHeliumBlob = new Item().setUnlocalizedName("itemHeliumBlob").setCreativeTab(tabMisc).setTextureName(CORE.MODID + ":itemHeliumBlob"); GameRegistry.registerItem(itemHeliumBlob, "itemHeliumBlob"); diff --git a/src/Java/miscutil/core/item/base/BaseItemWithCharge.java b/src/Java/miscutil/core/item/base/BaseItemWithCharge.java new file mode 100644 index 0000000000..7c88a62ed0 --- /dev/null +++ b/src/Java/miscutil/core/item/base/BaseItemWithCharge.java @@ -0,0 +1,74 @@ +package miscutil.core.item.base; + +import java.util.List; + +import miscutil.core.creative.AddToCreativeTab; +import miscutil.core.lib.CORE; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; + +public class BaseItemWithCharge extends Item{ + + public int int_Charge = 0; + public int int_Max_Charge = 0; + + public BaseItemWithCharge(String unlocalizedName, int constructor_Charge, int constructor_Max_Charge) { + this.setUnlocalizedName(unlocalizedName); + this.setTextureName(CORE.MODID + ":" + unlocalizedName); + this.setMaxStackSize(1); + this.setCreativeTab(AddToCreativeTab.tabMachines); + this.int_Charge = constructor_Charge; + this.int_Max_Charge = constructor_Max_Charge; + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + int NBT_Charge = int_Charge; + int NBT_Max_Charge = int_Max_Charge; + if (stack.stackTagCompound != null) { + NBT_Charge = stack.stackTagCompound.getInteger("charge_Current"); + NBT_Max_Charge = stack.stackTagCompound.getInteger("charge_Max"); + String tempX = String.valueOf(NBT_Charge); + String tempY = String.valueOf(NBT_Max_Charge); + String formattedX = EnumChatFormatting.RED+tempX+EnumChatFormatting.GRAY; + String formattedY = EnumChatFormatting.DARK_RED+tempY+EnumChatFormatting.GRAY; + list.add(EnumChatFormatting.GRAY+"Charge:"+formattedX+"/"+formattedY+"."); + super.addInformation(stack, aPlayer, list, bool); + } + } + + //Ticking and NBT Handling + /* Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and + * update it's contents. + * + * public int fuelRemaining = 0; + public int maximumFuel = 0; + public String fuelType = ""; + public float heat = 0; + public float maxHeat = 5000; + * + */ + @Override + public void onCreated(ItemStack itemStack, World world, EntityPlayer player) { + + } + + @Override + public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + + } + + @Override + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer par3Entity) { + itemStack.stackTagCompound = new NBTTagCompound(); + return super.onItemRightClick(itemStack, world, par3Entity); + } + + + +} diff --git a/src/Java/miscutil/core/item/general/BedLocator_Base.java b/src/Java/miscutil/core/item/general/BedLocator_Base.java new file mode 100644 index 0000000000..b4402e0689 --- /dev/null +++ b/src/Java/miscutil/core/item/general/BedLocator_Base.java @@ -0,0 +1,106 @@ +package miscutil.core.item.general; + +import java.util.List; + +import miscutil.core.creative.AddToCreativeTab; +import miscutil.core.lib.CORE; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; + +public class BedLocator_Base extends Item{ + + public int bed_X = 0; + public int bed_Y = 0; + public int bed_Z = 0; + + public BedLocator_Base(String unlocalizedName) { + this.setUnlocalizedName(unlocalizedName); + this.setTextureName(CORE.MODID + ":" + unlocalizedName); + this.setMaxStackSize(1); + this.setCreativeTab(AddToCreativeTab.tabMachines); + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + + + int NBT_X = bed_X; + int NBT_Y = bed_Y; + int NBT_Z = bed_Z; + + + if (stack.stackTagCompound != null) { + NBT_X = stack.stackTagCompound.getInteger("pos_x"); + NBT_Y = stack.stackTagCompound.getInteger("pos_y"); + NBT_Z = stack.stackTagCompound.getInteger("pos_z"); + + String tempX = String.valueOf(NBT_X); + String tempY = String.valueOf(NBT_Y); + String tempZ = String.valueOf(NBT_Z); + String formattedX = EnumChatFormatting.DARK_RED+tempX+EnumChatFormatting.GRAY; + String formattedY = EnumChatFormatting.RED+tempY+EnumChatFormatting.GRAY; + String formattedZ = EnumChatFormatting.RED+tempZ+EnumChatFormatting.GRAY; + + list.add(EnumChatFormatting.GRAY+"X: "+formattedX+"."); + list.add(EnumChatFormatting.GRAY+"Y: "+formattedY+"."); + list.add(EnumChatFormatting.GRAY+"Z: "+formattedZ+"."); + super.addInformation(stack, aPlayer, list, bool); + } + } + + //Ticking and NBT Handling + /* Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and + * update it's contents. + * + * public int fuelRemaining = 0; + public int maximumFuel = 0; + public String fuelType = ""; + public float heat = 0; + public float maxHeat = 5000; + * + */ + @Override + public void onCreated(ItemStack itemStack, World world, EntityPlayer player) { + itemStack.stackTagCompound = new NBTTagCompound(); + this.bed_X = 0; + this.bed_Y = 0; + this.bed_Z = 0; + itemStack.stackTagCompound.setInteger("pos_x", bed_X); + itemStack.stackTagCompound.setInteger("pos_y", bed_Y); + itemStack.stackTagCompound.setInteger("pos_z", bed_Z); + } + + @Override + public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + + + } + + @Override + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer par3Entity) { + itemStack.stackTagCompound = new NBTTagCompound(); + if (par3Entity.getBedLocation() != null){ + this.bed_X = par3Entity.getBedLocation().posX; + this.bed_Y = par3Entity.getBedLocation().posY; + this.bed_Z = par3Entity.getBedLocation().posZ; + } + else { + this.bed_X = 0; + this.bed_Y = 0; + this.bed_Z = 0; + } + itemStack.stackTagCompound.setInteger("pos_x", bed_X); + itemStack.stackTagCompound.setInteger("pos_y", bed_Y); + itemStack.stackTagCompound.setInteger("pos_z", bed_Z); + return super.onItemRightClick(itemStack, world, par3Entity); + } + + + +} diff --git a/src/Java/miscutil/core/item/general/fuelrods/FuelRod_Base.java b/src/Java/miscutil/core/item/general/fuelrods/FuelRod_Base.java index 20d6fcd08e..4aa9f57092 100644 --- a/src/Java/miscutil/core/item/general/fuelrods/FuelRod_Base.java +++ b/src/Java/miscutil/core/item/general/fuelrods/FuelRod_Base.java @@ -19,7 +19,6 @@ public class FuelRod_Base extends Item{ public String fuelType = ""; public float heat = 0; public float maxHeat = getMaxHeat(); - private ItemStack thisStack = null; public FuelRod_Base(String unlocalizedName, String type, int fuelLeft, int maxFuel) { this.setUnlocalizedName(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); @@ -30,12 +29,6 @@ public class FuelRod_Base extends Item{ this.fuelType = type; this.setCreativeTab(AddToCreativeTab.tabMachines); } - - /*@Override - public void setDamage(ItemStack stack, int damage) { - this.heat=heat+5; - super.setDamage(stack, damage); - }*/ private float getMaxHeat(){ float tempvar; @@ -58,6 +51,13 @@ public class FuelRod_Base extends Item{ } + private void updateVars(ItemStack stack){ + if (stack.stackTagCompound != null) { + heat = stack.stackTagCompound.getFloat("heat"); + fuelRemaining = stack.stackTagCompound.getInteger("fuelRemaining"); + } + } + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { @@ -67,12 +67,12 @@ public class FuelRod_Base extends Item{ int NBT_Fuel = fuelRemaining; String NBT_Type= fuelType; - thisStack = stack; if (stack.stackTagCompound != null) { NBT_Heat = stack.stackTagCompound.getFloat("heat"); NBT_MaxHeat = stack.stackTagCompound.getFloat("maxHeat"); NBT_Fuel = stack.stackTagCompound.getInteger("fuelRemaining"); - NBT_Type = stack.stackTagCompound.getString("fuelType");} + NBT_Type = stack.stackTagCompound.getString("fuelType"); + } String tempHeat = String.valueOf(NBT_Heat); String tempMaxHeat = String.valueOf(NBT_MaxHeat); @@ -85,6 +85,8 @@ public class FuelRod_Base extends Item{ int tempMax = maximumFuel; float tempCurrentHeat = heat; int tempFuelLeft = fuelRemaining; + + //Fuel Usage Formatting if (tempFuelLeft <= maximumFuel/3){ formattedFuelLeft = EnumChatFormatting.RED+tempFuel+EnumChatFormatting.GRAY; } @@ -97,44 +99,54 @@ public class FuelRod_Base extends Item{ else { formattedFuelLeft = EnumChatFormatting.GRAY+tempFuel+EnumChatFormatting.GRAY; } - if (tempCurrentHeat <= maxHeat/3 && tempCurrentHeat != 0){ + + //Heat Formatting + if (tempCurrentHeat <= 200 && tempCurrentHeat >= 0){ formattedHeat = EnumChatFormatting.GRAY+tempHeat+EnumChatFormatting.GRAY; } - else if (tempCurrentHeat >= maxHeat/3 && tempMax <= (maxHeat/3)*2 && tempCurrentHeat != 0){ + else if (tempCurrentHeat <= maxHeat/3 && tempCurrentHeat > 200){ formattedHeat = EnumChatFormatting.YELLOW+tempHeat+EnumChatFormatting.GRAY; } - else if (tempCurrentHeat <= (maxHeat/3)*2 && tempMax <= maxHeat && tempCurrentHeat != 0){ + else if (tempCurrentHeat >= maxHeat/3 && tempMax < (maxHeat/3)*2 && tempCurrentHeat != 0){ + formattedHeat = EnumChatFormatting.GOLD+tempHeat+EnumChatFormatting.GRAY; + } + else if (tempCurrentHeat >= ((maxHeat/3)*2) && tempMax <= maxHeat && tempCurrentHeat != 0){ formattedHeat = EnumChatFormatting.RED+tempHeat+EnumChatFormatting.GRAY; } else { formattedHeat = EnumChatFormatting.BLUE+tempHeat+EnumChatFormatting.GRAY; } - list.add(EnumChatFormatting.GRAY+"A "+formattedType+" Fuel Rod."); list.add(EnumChatFormatting.GRAY+"Running at "+formattedHeat+"/"+formattedMaxHeat+" Kelvin."); list.add(EnumChatFormatting.GRAY+"Fuel Remaining: "+formattedFuelLeft+"L."); super.addInformation(stack, aPlayer, list, bool); } - public String getType(){ - return fuelType; + public String getType(ItemStack stack){ + if (stack.stackTagCompound != null){ + return stack.stackTagCompound.getString("fuelType"); + } + return fuelType; } - public int getFuelRemaining(){ - return fuelRemaining; + public int getFuelRemaining(ItemStack stack){ + if (stack.stackTagCompound != null){ + return stack.stackTagCompound.getInteger("fuelRemaining"); + } + return 0; } public int getMaxFuel(){ return maximumFuel; } - public int getFuel(){ - if (thisStack != null){ - int i = thisStack.getItemDamage(); + public int getFuel(ItemStack stack){ + if (stack != null){ + int i = stack.getItemDamage(); int r = maximumFuel - i; return r; } - return fuelRemaining; + return getFuelRemaining(stack); } public boolean setFuelRemainingExplicitly(int i){ @@ -155,8 +167,11 @@ public class FuelRod_Base extends Item{ return false; } - public float getHeat(){ - return heat; + public float getHeat(ItemStack value){ + if (value.stackTagCompound != null){ + return value.stackTagCompound.getFloat("heat"); + } + return 0f; } public boolean addHeat(float i){ @@ -183,22 +198,23 @@ public class FuelRod_Base extends Item{ @Override public void onCreated(ItemStack itemStack, World world, EntityPlayer player) { itemStack.stackTagCompound = new NBTTagCompound(); - itemStack.stackTagCompound.setInteger("fuelRemaining", fuelRemaining); + itemStack.stackTagCompound.setInteger("fuelRemaining", getFuelRemaining(itemStack)); itemStack.stackTagCompound.setInteger("maximumFuel", maximumFuel); - itemStack.stackTagCompound.setFloat("heat", heat); - itemStack.stackTagCompound.setFloat("maxHeat", maxHeat); - itemStack.stackTagCompound.setString("fuelType", fuelType); + itemStack.stackTagCompound.setFloat("heat", getHeat(itemStack)); + itemStack.stackTagCompound.setFloat("maxHeat", getMaxHeat()); + itemStack.stackTagCompound.setString("fuelType", getType(itemStack)); + updateVars(itemStack); } @Override public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) { itemStack.stackTagCompound = new NBTTagCompound(); - itemStack.stackTagCompound.setInteger("fuelRemaining", getFuelRemaining()); + itemStack.stackTagCompound.setInteger("fuelRemaining", getFuelRemaining(itemStack)); itemStack.stackTagCompound.setInteger("maximumFuel", maximumFuel); - itemStack.stackTagCompound.setFloat("heat", getHeat()); + itemStack.stackTagCompound.setFloat("heat", getHeat(itemStack)); itemStack.stackTagCompound.setFloat("maxHeat", getMaxHeat()); - itemStack.stackTagCompound.setString("fuelType", fuelType); - + itemStack.stackTagCompound.setString("fuelType", getType(itemStack)); + updateVars(itemStack); } diff --git a/src/Java/miscutil/core/lib/CORE.java b/src/Java/miscutil/core/lib/CORE.java index f2be1776bd..1e9f9b90dc 100644 --- a/src/Java/miscutil/core/lib/CORE.java +++ b/src/Java/miscutil/core/lib/CORE.java @@ -15,7 +15,7 @@ public class CORE { public static final String name = "Misc. Utils"; public static final String MODID = "miscutils"; public static final String VERSION = "1.0.4"; - public static final boolean DEBUG = true; + public static final boolean DEBUG = false; public static final boolean LOAD_ALL_CONTENT = false; public static final int GREG_FIRST_ID = 760; public static Map PlayerCache; @@ -42,15 +42,17 @@ public class CORE { TEX_DIR = "textures/", TEX_DIR_GUI = TEX_DIR + "gui/", TEX_DIR_ITEM = TEX_DIR + "items/", - TEX_DIR_BLOCK = TEX_DIR/* + "blocks/"*/, + TEX_DIR_BLOCK = TEX_DIR + "blocks/", TEX_DIR_ENTITY = TEX_DIR + "entity/", TEX_DIR_ASPECTS = TEX_DIR + "aspects/", + TEX_DIR_FLUIDS = TEX_DIR_BLOCK + "fluids/", RES_PATH = MODID + ":" + TEX_DIR, RES_PATH_GUI = MODID + ":" + TEX_DIR_GUI, RES_PATH_ITEM = MODID + ":" + TEX_DIR_ITEM, RES_PATH_BLOCK = MODID + ":" + TEX_DIR_BLOCK, RES_PATH_ENTITY = MODID + ":" + TEX_DIR_ENTITY, - RES_PATH_ASPECTS = MODID + ":" + TEX_DIR_ASPECTS; + RES_PATH_ASPECTS = MODID + ":" + TEX_DIR_ASPECTS, + RES_PATH_FLUIDS = MODID + ":" + TEX_DIR_FLUIDS; //public static final Materials2[] MiscGeneratedMaterials = new Materials2[1000]; diff --git a/src/Java/miscutil/core/recipe/RECIPES_GREGTECH.java b/src/Java/miscutil/core/recipe/RECIPES_GREGTECH.java index 3f3338b1d1..d35e304815 100644 --- a/src/Java/miscutil/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/miscutil/core/recipe/RECIPES_GREGTECH.java @@ -2,6 +2,7 @@ package miscutil.core.recipe; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import miscutil.core.lib.CORE; import miscutil.core.util.Utils; @@ -82,4 +83,8 @@ public class RECIPES_GREGTECH { //GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 6L), ItemList.Casing_Turbine.get(1L, new Object[0]), ItemList.Casing_Turbine3.get(1L, new Object[0]), 50, 16); } + + private static void addFuels(){ + CORE.RA.addFuel(GT_ModHandler.getModItem("ForbiddenMagic", "NetherShard", 1L, 1), null, 2800, 5); + } } \ No newline at end of file diff --git a/src/Java/miscutil/core/tileentities/ModTileEntities.java b/src/Java/miscutil/core/tileentities/ModTileEntities.java index a27e7be6ad..0f5ba5ed56 100644 --- a/src/Java/miscutil/core/tileentities/ModTileEntities.java +++ b/src/Java/miscutil/core/tileentities/ModTileEntities.java @@ -1,8 +1,6 @@ package miscutil.core.tileentities; -import miscutil.core.block.heliumgen.tileentity.TileEntityHeliumGenerator; import miscutil.core.util.Utils; -import cpw.mods.fml.common.registry.GameRegistry; public class ModTileEntities { @@ -10,9 +8,10 @@ public class ModTileEntities { public static void init(){ Utils.LOG_INFO("Registering Tile Entities."); //GameRegistry.registerTileEntity(TileEntityReverter.class, "TE_blockGriefSaver"); - GameRegistry.registerTileEntity(TileEntityReverter.class, "Tower Reverter"); - GameRegistry.registerTileEntity(TileEntityNHG.class, "NuclearFueledHeliumGenerator"); - GameRegistry.registerTileEntity(TileEntityHeliumGenerator.class, "Helium"); + //GameRegistry.registerTileEntity(TileEntityReverter.class, "Tower Reverter"); + //GameRegistry.registerTileEntity(TileEntityNHG.class, "NuclearFueledHeliumGenerator"); + //GameRegistry.registerTileEntity(TileEntityCharger.class, "TE_Charger"); + // GameRegistry.registerTileEntity(TileEntityHeliumGenerator.class, "Helium"); } } diff --git a/src/Java/miscutil/core/tileentities/TileEntityNHG.java b/src/Java/miscutil/core/tileentities/TileEntityNHG.java deleted file mode 100644 index 17dd8d4216..0000000000 --- a/src/Java/miscutil/core/tileentities/TileEntityNHG.java +++ /dev/null @@ -1,487 +0,0 @@ -package miscutil.core.tileentities; - -import miscutil.core.item.ModItems; -import miscutil.core.item.general.fuelrods.FuelRod_Base; -import miscutil.core.util.Utils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.Constants; - -public class TileEntityNHG extends TileEntity implements IInventory -{ - private ItemStack[] items = new ItemStack[19]; //18 - private int progress = 1; - private int maxProgress = 180; - private int heatCycleProgress = 12; - public float coreTemp; - public float maxTemp = 10000; - private boolean fuelrod_1 = false; - private boolean fuelrod_2 = false; - private boolean fuelrod_3 = false; - private boolean fuelrod_4 = false; - private boolean fuelrod_5 = false; - private boolean fuelrod_6 = false; - private boolean fuelrod_7 = false; - private boolean fuelrod_8 = false; - private boolean fuelrod_9 = false; - private boolean fuelrod_10 = false; - private boolean fuelrod_11 = false; - private boolean fuelrod_12 = false; - private boolean fuelrod_13 = false; - private boolean fuelrod_14 = false; - private boolean fuelrod_15 = false; - private boolean fuelrod_16 = false; - private boolean fuelrod_17 = false; - private boolean fuelrod_18 = false; - - public float getCoreTemp(){ - return coreTemp; - } - - public int getProgress(){ - return progress; - } - - public boolean isValidFuelRod(ItemStack input){ - if(!this.worldObj.isRemote){ - if (input != null){ - if (input.copy().getItem() instanceof FuelRod_Base){ - int fuelRodFuelLevel = getRodFuelValue(input); - float fuelRodHeatLevel = getRodHeatValue(input); - Utils.LOG_WARNING("Fuel Left: "+fuelRodFuelLevel+" Current Temp: "+fuelRodHeatLevel); - return true; - //return input.stackTagCompound.getInteger("code"); - } - } - - } - return false; - } - - public ItemStack doFuelRodHeatDamage(ItemStack input){ - if(!this.worldObj.isRemote){ - if (input.copy() != null){ - if (isValidFuelRod(input.copy())){ - int fuelRodFuelLevel = getRodFuelValue(input.copy()); - float fuelRodHeatLevel = getRodHeatValue(input.copy()); - if((fuelRodHeatLevel <= 0 || fuelRodHeatLevel == 0) && fuelRodFuelLevel > 0){ - - if(fuelRodFuelLevel <= 0 || fuelRodFuelLevel == 0){ - return null; - } - else if(fuelRodFuelLevel >= 5){ - int tempInt=fuelRodFuelLevel; - float tempFloat=fuelRodHeatLevel; - ItemStack output = input.copy(); - output.stackTagCompound.setInteger("fuelRemaining", tempInt-5); - output.stackTagCompound.setFloat("heat", tempFloat+5); - - return output; - } - else { - return null; - } - } - else if(fuelRodHeatLevel >= 5 && fuelRodFuelLevel == 0){ - input.stackTagCompound.setInteger("heat", -5); - return input; - } - else { - return null; - } - } - } - } - return null; - } - - public float getRodHeatValue(ItemStack value){ - if (value.copy() != null){ - if (value.copy().stackTagCompound != null){ - return value.copy().stackTagCompound.getFloat("heat"); - } - } - return 0f; - } - - public int getRodFuelValue(ItemStack value){ - if (value.copy() != null){ - if (value.copy().stackTagCompound != null){ - int tempInt = value.copy().stackTagCompound.getInteger("fuelRemaining"); - return tempInt; - } - } - return 0; - } - - public void checkFuelRods(){ - - if(!this.worldObj.isRemote){ - for (int i = 0; i < getSizeInventory(); i++){ - if (items[i] != null){ - if (items[i].copy().getItem() instanceof FuelRod_Base){ - ItemStack fuelRodStack = getStackInSlot(i).copy(); - //setInventorySlotContents(i, doFuelRodHeatDamage(fuelRodStack)); - if (i == 0){ - fuelrod_1 = true; - FuelRod_Base x = (FuelRod_Base) fuelRodStack.getItem(); - x.addHeat(5); - x.addFuel(-5); - ItemStack r = doFuelRodHeatDamage(fuelRodStack); - setInventorySlotContents(i, r); - } - else if (i == 1){ - fuelrod_2 = true; - ItemStack r = doFuelRodHeatDamage(fuelRodStack); - setInventorySlotContents(i, r); - } - else if (i == 2){ - fuelrod_3 = true; - ItemStack r = doFuelRodHeatDamage(fuelRodStack); - setInventorySlotContents(i, r); - } - else if (i == 3){ - fuelrod_4 = true; - ItemStack r = doFuelRodHeatDamage(fuelRodStack); - setInventorySlotContents(i, r); - } - else if (i == 4){ - fuelrod_5 = true; - ItemStack r = doFuelRodHeatDamage(fuelRodStack); - setInventorySlotContents(i, r); - } - else if (i == 5){ - fuelrod_6 = true; - ItemStack r = doFuelRodHeatDamage(fuelRodStack); - setInventorySlotContents(i, r); - } - else if (i == 6){ - fuelrod_7 = true; - ItemStack r = doFuelRodHeatDamage(fuelRodStack); - setInventorySlotContents(i, r); - } - else if (i == 7){ - fuelrod_8 = true; - ItemStack r = doFuelRodHeatDamage(fuelRodStack); - setInventorySlotContents(i, r); - } - else if (i == 8){ - fuelrod_9 = true; - ItemStack r = doFuelRodHeatDamage(fuelRodStack); - setInventorySlotContents(i, r); - } - else if (i == 9){ - fuelrod_10 = true; - ItemStack r = doFuelRodHeatDamage(fuelRodStack); - setInventorySlotContents(i, r); - } - else if (i == 10){ - fuelrod_11 = true; - ItemStack r = doFuelRodHeatDamage(fuelRodStack); - setInventorySlotContents(i, r); - } - else if (i == 11){ - fuelrod_12 = true; - ItemStack r = doFuelRodHeatDamage(fuelRodStack); - setInventorySlotContents(i, r); - } - else if (i == 12){ - fuelrod_13 = true; - ItemStack r = doFuelRodHeatDamage(fuelRodStack); - setInventorySlotContents(i, r); - } - else if (i == 13){ - fuelrod_14 = true; - ItemStack r = doFuelRodHeatDamage(fuelRodStack); - setInventorySlotContents(i, r); - } - else if (i == 14){ - fuelrod_15 = true; - ItemStack r = doFuelRodHeatDamage(fuelRodStack); - setInventorySlotContents(i, r); - } - else if (i == 15){ - fuelrod_16 = true; - ItemStack r = doFuelRodHeatDamage(fuelRodStack); - setInventorySlotContents(i, r); - } - else if (i == 16){ - fuelrod_17 = true; - ItemStack r = doFuelRodHeatDamage(fuelRodStack); - setInventorySlotContents(i, r); - } - else if (i == 17){ - fuelrod_18 = true; - ItemStack r = doFuelRodHeatDamage(fuelRodStack); - setInventorySlotContents(i, r); - } - - - } - } - } - - } - - } - - public boolean calculateHeat(){ - /*if (!fuelrod_1 || !fuelrod_2 || !fuelrod_3 || !fuelrod_4 || !fuelrod_5 || !fuelrod_6 || !fuelrod_7 || !fuelrod_8 || !fuelrod_9 || !fuelrod_10 || !fuelrod_11 || !fuelrod_12 || !fuelrod_13 || !fuelrod_14 || !fuelrod_15 || !fuelrod_16 || !fuelrod_17 || !fuelrod_18){ - coreTemp = 0; - } - else {*/ - if(!this.worldObj.isRemote){ - for (int i = 0; i < getSizeInventory(); i++){ - if (items[i] != null){ - if (items[i].copy().getItem() instanceof FuelRod_Base){ - ItemStack fuelRodStack = getStackInSlot(i).copy(); - //if (fuelRodStack.stackTagCompound.getFloat("heat") != 0){ - doFuelRodHeatDamage(fuelRodStack); - coreTemp = coreTemp+fuelRodStack.stackTagCompound.getFloat("heat"); - return true; - //} - } - } - } - } - //} - - - - return false; - } - - @Override - public int getSizeInventory() - { - return items.length; - } - - @Override - public ItemStack getStackInSlot(int slot) - { - - return items[slot]; - - } - - @Override - public ItemStack decrStackSize(int slot, int amount) - { - if (items[slot] != null) - { - ItemStack itemstack; - - if (items[slot].stackSize == amount) - { - itemstack = items[slot]; - items[slot] = null; - markDirty(); - return itemstack; - } - itemstack = items[slot].splitStack(amount); - if (items[slot].stackSize == 0) items[slot] = null; - markDirty(); - return itemstack; - } - return null; - } - - @Override - public ItemStack getStackInSlotOnClosing(int slot) - { - if (items[slot] != null) - { - ItemStack itemstack = items[slot]; - items[slot] = null; - return itemstack; - } - return null; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack stack) - { - if (stack != null){ - items[slot] = stack; - if (stack != null && stack.stackSize > getInventoryStackLimit()) - { - stack.stackSize = getInventoryStackLimit(); - } - - - markDirty(); - } - } - - @Override - public String getInventoryName() - { - return "container.NHG"; - } - - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - NBTTagList list = nbt.getTagList("Items", Constants.NBT.TAG_COMPOUND); - items = new ItemStack[getSizeInventory()]; - - for (int i = 0; i < list.tagCount(); ++i) { NBTTagCompound comp = list.getCompoundTagAt(i); int j = comp.getByte("Slot") & 255; if (j >= 0 && j < items.length) - { - items[j] = ItemStack.loadItemStackFromNBT(comp); - } - } - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - NBTTagList list = new NBTTagList(); - - for (int i = 0; i < items.length; ++i) - { - if (items[i] != null) - { - NBTTagCompound comp = new NBTTagCompound(); - comp.setByte("Slot", (byte)i); - items[i].writeToNBT(comp); - list.appendTag(comp); - } - } - - nbt.setTag("Items", list); - } - - @Override - public int getInventoryStackLimit() - { - return 64; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer player) - { - return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : player.getDistanceSq((double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D) <= 64.0D; - } - - @Override - public void openInventory() {} - - @Override - public void closeInventory() {} - - @Override - public boolean isItemValidForSlot(int slot, ItemStack stack) - { - return true; - } - - //Machine Code - TODO - private ItemStack neutrons; - - @Override - public void updateEntity() { - - if(!this.worldObj.isRemote){ - - if(progress >= heatCycleProgress){ - //Utils.LOG_SPECIFIC_WARNING("NFHG", "Updating Entity "+this.getBlockType().getUnlocalizedName(), 376); - if (Utils.divideXintoY(heatCycleProgress, maxProgress)){ - Utils.LOG_SPECIFIC_WARNING("NFHG", "Updating Entity "+this.getBlockType().getUnlocalizedName(), 378); - calculateHeat(); - heatCycleProgress=0; - } - } - - if(++progress >= maxProgress){ - - - Utils.LOG_SPECIFIC_WARNING("NFHG", "Updating Entity "+this.getBlockType().getUnlocalizedName(), 338); - if (items[18] != null){ - ItemStack checkOutput = getStackInSlot(18); - if(neutrons == null){ - neutrons = new ItemStack(ModItems.itemHeliumBlob, 1); - if (checkOutput == null){ - Utils.LOG_WARNING("ItemStack in Output slot is definitely null, making a new ItemStack."); - setInventorySlotContents(18, neutrons); - progress = 0; - markDirty(); - } - else { - checkOutput.stackSize++; - Utils.LOG_WARNING("Found an ItemStack to increase the size of. Current size is "+neutrons.stackSize); - - progress = 0; - markDirty(); - } - } - else if(checkOutput.getItem() == ModItems.itemHeliumBlob && checkOutput.stackSize < 64){ - checkOutput.stackSize++; - Utils.LOG_WARNING("Found an ItemStack to increase size of. Current size is "+checkOutput.stackSize); - progress = 0; - markDirty(); - } - else if(checkOutput.getItem() == ModItems.itemHeliumBlob && checkOutput.stackSize == 64){ - Utils.LOG_WARNING("Output stack is full."); - progress = 0; - markDirty(); - } - } - else if (items[18] == null){ - Utils.LOG_WARNING("ItemStack in Output slot is null"); - neutrons = new ItemStack(ModItems.itemHeliumBlob, 1); - ItemStack checkOutput = getStackInSlot(18); - if (checkOutput == null){ - Utils.LOG_WARNING("ItemStack in Output slot is definitely null, making a new ItemStack."); - setInventorySlotContents(18, neutrons); - progress = 0; - markDirty(); - } - else { - Utils.LOG_WARNING("Found an ItemStack to increase the size of."); - checkOutput.stackSize++; - progress = 0; - markDirty(); - } - } - checkFuelRods(); - } - progress++; - } - } - - public void readCustomNBT(NBTTagCompound tag) - { - this.neutrons = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Neutrons")); - this.progress = tag.getInteger("Progress"); - this.coreTemp = tag.getFloat("coreTemp"); - } - - public void writeCustomNBT(NBTTagCompound tag) - { - tag.setInteger("Progress", this.progress); - tag.setFloat("coreTemp", this.coreTemp); - if(neutrons != null) { - NBTTagCompound produce = new NBTTagCompound(); - neutrons.writeToNBT(produce); - tag.setTag("Neutrons", produce); - } - else - tag.removeTag("Neutrons"); - } - - - -} \ No newline at end of file diff --git a/src/Java/miscutil/core/tileentities/TileEntityReverter.java b/src/Java/miscutil/core/tileentities/TileEntityReverter.java deleted file mode 100644 index 4ee8eeed4b..0000000000 --- a/src/Java/miscutil/core/tileentities/TileEntityReverter.java +++ /dev/null @@ -1,309 +0,0 @@ -package miscutil.core.tileentities; - -import java.util.Random; - -import miscutil.core.block.ModBlocks; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.tileentity.TileEntity; - - - -public class TileEntityReverter extends TileEntity -{ - private static final int REVERT_CHANCE = 10; - public int radius = 16; - public int diameter = 8 * this.radius + 4; - public double requiredPlayerRange = 64.0D; - public Random rand = new Random(); - private int tickCount; - private boolean slowScan; - private int ticksSinceChange; - private Block[] blockData; - private byte[] metaData; - - public boolean canUpdate(){ - return true; - } - - public void updateEntity() - { - if (anyPlayerInRange()) - { - this.tickCount += 1; - if (this.worldObj.isRemote) - { - double var1 = this.xCoord + this.worldObj.rand.nextFloat(); - double var3 = this.yCoord + this.worldObj.rand.nextFloat(); - double var5 = this.zCoord + this.worldObj.rand.nextFloat(); - - this.worldObj.spawnParticle("enchantmenttable", var1, var3, var5, 0.0D, 0.0D, 0.0D); - if (this.rand.nextInt(5) == 0) - { - makeRandomOutline(); - makeRandomOutline(); - makeRandomOutline(); - } - } - else - { - if ((this.blockData == null) || (this.metaData == null)) - { - captureBlockData(); - this.slowScan = true; - } - if ((!this.slowScan) || (this.tickCount % 20 == 0)) { - if (scanAndRevertChanges()) - { - this.slowScan = false; - this.ticksSinceChange = 0; - } - else - { - this.ticksSinceChange += 1; - if (this.ticksSinceChange > 20) { - this.slowScan = true; - } - } - } - } - } - else - { - this.blockData = null; - this.metaData = null; - - this.tickCount = 0; - } - } - - private void makeRandomOutline() - { - makeOutline(this.rand.nextInt(12)); - } - - private void makeOutline(int outline) - { - double sx = this.xCoord; - double sy = this.yCoord; - double sz = this.zCoord; - - double dx = this.xCoord; - double dy = this.yCoord; - double dz = this.zCoord; - switch (outline) - { - case 0: - sx -= this.radius; - dx -= this.radius; - sz -= this.radius; - dz += this.radius + 1; - case 8: - sx -= this.radius; - dx += this.radius + 1; - sz -= this.radius; - dz -= this.radius; - break; - case 1: - case 9: - sx -= this.radius; - dx -= this.radius; - sz -= this.radius; - dz += this.radius + 1; - break; - case 2: - case 10: - sx -= this.radius; - dx += this.radius + 1; - sz += this.radius + 1; - dz += this.radius + 1; - break; - case 3: - case 11: - sx += this.radius + 1; - dx += this.radius + 1; - sz -= this.radius; - dz += this.radius + 1; - break; - case 4: - sx -= this.radius; - dx -= this.radius; - sz -= this.radius; - dz -= this.radius; - break; - case 5: - sx += this.radius + 1; - dx += this.radius + 1; - sz -= this.radius; - dz -= this.radius; - break; - case 6: - sx += this.radius + 1; - dx += this.radius + 1; - sz += this.radius + 1; - dz += this.radius + 1; - break; - case 7: - sx -= this.radius; - dx -= this.radius; - sz += this.radius + 1; - dz += this.radius + 1; - } - switch (outline) - { - case 0: - case 1: - case 2: - case 3: - sy += this.radius + 1; - dy += this.radius + 1; - break; - case 4: - case 5: - case 6: - case 7: - sy -= this.radius; - dy += this.radius + 1; - break; - case 8: - case 9: - case 10: - case 11: - sy -= this.radius; - dy -= this.radius; - } - if (this.rand.nextBoolean()) { - drawParticleLine(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, dx, dy, dz); - } else { - drawParticleLine(sx, sy, sz, this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D); - } - drawParticleLine(sx, sy, sz, dx, dy, dz); - } - - protected void drawParticleLine(double srcX, double srcY, double srcZ, double destX, double destY, double destZ) - { - int particles = 16; - for (int i = 0; i < particles; i++) - { - double trailFactor = i / (particles - 1.0D); - - double tx = srcX + (destX - srcX) * trailFactor + this.rand.nextFloat() * 0.005D; - double ty = srcY + (destY - srcY) * trailFactor + this.rand.nextFloat() * 0.005D; - double tz = srcZ + (destZ - srcZ) * trailFactor + this.rand.nextFloat() * 0.005D; - this.worldObj.spawnParticle("portal", tx, ty, tz, 0.0D, 0.0D, 0.0D); - } - } - - private boolean scanAndRevertChanges() - { - int index = 0; - boolean reverted = false; - for (int x = -this.radius; x <= this.radius; x++) { - for (int y = -this.radius; y <= this.radius; y++) { - for (int z = -this.radius; z <= this.radius; z++) - { - Block blockID = this.worldObj.getBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z); - byte meta = (byte)this.worldObj.getBlockMetadata(this.xCoord + x, this.yCoord + y, this.zCoord + z); - if (this.blockData[index] != blockID) { - if (revertBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z, blockID, meta, this.blockData[index], this.metaData[index])) - { - reverted = true; - } - else - { - this.blockData[index] = blockID; - this.metaData[index] = meta; - } - } - index++; - } - } - } - return reverted; - } - - private boolean revertBlock(int x, int y, int z, Block thereBlockID, byte thereMeta, Block replaceBlockID, byte replaceMeta) - { - /*if ((thereBlockID == Blocks.air) && (!replaceBlockID.getMaterial().blocksMovement())) - { - System.out.println("Not replacing block " + replaceBlockID + " because it doesn't block movement"); - - return false; - }*/ - if (isUnrevertable(thereBlockID, thereMeta, replaceBlockID, replaceMeta)) { - return false; - } - if (this.rand.nextInt(5) == 0) - { - if (replaceBlockID != Blocks.air) - { - //replaceBlockID = null; - replaceMeta = 4; - } - this.worldObj.setBlock(x, y, z, replaceBlockID, replaceMeta, 2); - if (thereBlockID == Blocks.air) - { - this.worldObj.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(replaceBlockID) + (replaceMeta << 12)); - } - else if (replaceBlockID == Blocks.air) - { - this.worldObj.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(thereBlockID) + (thereMeta << 12)); - thereBlockID.dropBlockAsItem(this.worldObj, x, y, z, thereMeta, 0); - } - } - return true; - } - - private boolean isUnrevertable(Block thereBlockID, byte thereMeta, Block replaceBlockID, byte replaceMeta) - { - if ((thereBlockID == ModBlocks.blockGriefSaver) || (replaceBlockID == ModBlocks.blockGriefSaver)) { - return true; - } - /*if (((thereBlockID == towerTranslucent) && (thereMeta != 4)) || ((replaceBlockID == towerTranslucent) && (replaceMeta != 4))) { - return true; - }*/ - if ((thereBlockID == Blocks.redstone_lamp) && (replaceBlockID == Blocks.lit_redstone_lamp)) { - return true; - } - if ((thereBlockID == Blocks.lit_redstone_lamp) && (replaceBlockID == Blocks.redstone_lamp)) { - return true; - } - /*if ((thereBlockID == Blocks.water) || (replaceBlockID == Blocks.flowing_water)) { - return true; - } - if ((thereBlockID == Blocks.flowing_water) || (replaceBlockID == Blocks.water)) { - return true; - }*/ - if (replaceBlockID == Blocks.tnt) { - return true; - } - return false; - } - - private void captureBlockData() - { - this.blockData = new Block[this.diameter * this.diameter * this.diameter]; - this.metaData = new byte[this.diameter * this.diameter * this.diameter]; - - int index = 0; - for (int x = -this.radius; x <= this.radius; x++) { - for (int y = -this.radius; y <= this.radius; y++) { - for (int z = -this.radius; z <= this.radius; z++) - { - Block blockID = this.worldObj.getBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z); - int meta = this.worldObj.getBlockMetadata(this.xCoord + x, this.yCoord + y, this.zCoord + z); - - this.blockData[index] = blockID; - this.metaData[index] = ((byte)meta); - - index++; - } - } - } - } - - public boolean anyPlayerInRange() - { - return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, this.requiredPlayerRange) != null; - } -} diff --git a/src/Java/miscutil/core/tileentities/general/TileEntityReverter.java b/src/Java/miscutil/core/tileentities/general/TileEntityReverter.java new file mode 100644 index 0000000000..8793271985 --- /dev/null +++ b/src/Java/miscutil/core/tileentities/general/TileEntityReverter.java @@ -0,0 +1,309 @@ +package miscutil.core.tileentities.general; + +import java.util.Random; + +import miscutil.core.block.ModBlocks; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; + + + +public class TileEntityReverter extends TileEntity +{ + private static final int REVERT_CHANCE = 10; + public int radius = 16; + public int diameter = 8 * this.radius + 4; + public double requiredPlayerRange = 64.0D; + public Random rand = new Random(); + private int tickCount; + private boolean slowScan; + private int ticksSinceChange; + private Block[] blockData; + private byte[] metaData; + + public boolean canUpdate(){ + return true; + } + + public void updateEntity() + { + if (anyPlayerInRange()) + { + this.tickCount += 1; + if (this.worldObj.isRemote) + { + double var1 = this.xCoord + this.worldObj.rand.nextFloat(); + double var3 = this.yCoord + this.worldObj.rand.nextFloat(); + double var5 = this.zCoord + this.worldObj.rand.nextFloat(); + + this.worldObj.spawnParticle("enchantmenttable", var1, var3, var5, 0.0D, 0.0D, 0.0D); + if (this.rand.nextInt(5) == 0) + { + makeRandomOutline(); + makeRandomOutline(); + makeRandomOutline(); + } + } + else + { + if ((this.blockData == null) || (this.metaData == null)) + { + captureBlockData(); + this.slowScan = true; + } + if ((!this.slowScan) || (this.tickCount % 20 == 0)) { + if (scanAndRevertChanges()) + { + this.slowScan = false; + this.ticksSinceChange = 0; + } + else + { + this.ticksSinceChange += 1; + if (this.ticksSinceChange > 20) { + this.slowScan = true; + } + } + } + } + } + else + { + this.blockData = null; + this.metaData = null; + + this.tickCount = 0; + } + } + + private void makeRandomOutline() + { + makeOutline(this.rand.nextInt(12)); + } + + private void makeOutline(int outline) + { + double sx = this.xCoord; + double sy = this.yCoord; + double sz = this.zCoord; + + double dx = this.xCoord; + double dy = this.yCoord; + double dz = this.zCoord; + switch (outline) + { + case 0: + sx -= this.radius; + dx -= this.radius; + sz -= this.radius; + dz += this.radius + 1; + case 8: + sx -= this.radius; + dx += this.radius + 1; + sz -= this.radius; + dz -= this.radius; + break; + case 1: + case 9: + sx -= this.radius; + dx -= this.radius; + sz -= this.radius; + dz += this.radius + 1; + break; + case 2: + case 10: + sx -= this.radius; + dx += this.radius + 1; + sz += this.radius + 1; + dz += this.radius + 1; + break; + case 3: + case 11: + sx += this.radius + 1; + dx += this.radius + 1; + sz -= this.radius; + dz += this.radius + 1; + break; + case 4: + sx -= this.radius; + dx -= this.radius; + sz -= this.radius; + dz -= this.radius; + break; + case 5: + sx += this.radius + 1; + dx += this.radius + 1; + sz -= this.radius; + dz -= this.radius; + break; + case 6: + sx += this.radius + 1; + dx += this.radius + 1; + sz += this.radius + 1; + dz += this.radius + 1; + break; + case 7: + sx -= this.radius; + dx -= this.radius; + sz += this.radius + 1; + dz += this.radius + 1; + } + switch (outline) + { + case 0: + case 1: + case 2: + case 3: + sy += this.radius + 1; + dy += this.radius + 1; + break; + case 4: + case 5: + case 6: + case 7: + sy -= this.radius; + dy += this.radius + 1; + break; + case 8: + case 9: + case 10: + case 11: + sy -= this.radius; + dy -= this.radius; + } + if (this.rand.nextBoolean()) { + drawParticleLine(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, dx, dy, dz); + } else { + drawParticleLine(sx, sy, sz, this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D); + } + drawParticleLine(sx, sy, sz, dx, dy, dz); + } + + protected void drawParticleLine(double srcX, double srcY, double srcZ, double destX, double destY, double destZ) + { + int particles = 16; + for (int i = 0; i < particles; i++) + { + double trailFactor = i / (particles - 1.0D); + + double tx = srcX + (destX - srcX) * trailFactor + this.rand.nextFloat() * 0.005D; + double ty = srcY + (destY - srcY) * trailFactor + this.rand.nextFloat() * 0.005D; + double tz = srcZ + (destZ - srcZ) * trailFactor + this.rand.nextFloat() * 0.005D; + this.worldObj.spawnParticle("portal", tx, ty, tz, 0.0D, 0.0D, 0.0D); + } + } + + private boolean scanAndRevertChanges() + { + int index = 0; + boolean reverted = false; + for (int x = -this.radius; x <= this.radius; x++) { + for (int y = -this.radius; y <= this.radius; y++) { + for (int z = -this.radius; z <= this.radius; z++) + { + Block blockID = this.worldObj.getBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z); + byte meta = (byte)this.worldObj.getBlockMetadata(this.xCoord + x, this.yCoord + y, this.zCoord + z); + if (this.blockData[index] != blockID) { + if (revertBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z, blockID, meta, this.blockData[index], this.metaData[index])) + { + reverted = true; + } + else + { + this.blockData[index] = blockID; + this.metaData[index] = meta; + } + } + index++; + } + } + } + return reverted; + } + + private boolean revertBlock(int x, int y, int z, Block thereBlockID, byte thereMeta, Block replaceBlockID, byte replaceMeta) + { + /*if ((thereBlockID == Blocks.air) && (!replaceBlockID.getMaterial().blocksMovement())) + { + System.out.println("Not replacing block " + replaceBlockID + " because it doesn't block movement"); + + return false; + }*/ + if (isUnrevertable(thereBlockID, thereMeta, replaceBlockID, replaceMeta)) { + return false; + } + if (this.rand.nextInt(5) == 0) + { + if (replaceBlockID != Blocks.air) + { + //replaceBlockID = null; + replaceMeta = 4; + } + this.worldObj.setBlock(x, y, z, replaceBlockID, replaceMeta, 2); + if (thereBlockID == Blocks.air) + { + this.worldObj.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(replaceBlockID) + (replaceMeta << 12)); + } + else if (replaceBlockID == Blocks.air) + { + this.worldObj.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(thereBlockID) + (thereMeta << 12)); + thereBlockID.dropBlockAsItem(this.worldObj, x, y, z, thereMeta, 0); + } + } + return true; + } + + private boolean isUnrevertable(Block thereBlockID, byte thereMeta, Block replaceBlockID, byte replaceMeta) + { + if ((thereBlockID == ModBlocks.blockGriefSaver) || (replaceBlockID == ModBlocks.blockGriefSaver)) { + return true; + } + /*if (((thereBlockID == towerTranslucent) && (thereMeta != 4)) || ((replaceBlockID == towerTranslucent) && (replaceMeta != 4))) { + return true; + }*/ + if ((thereBlockID == Blocks.redstone_lamp) && (replaceBlockID == Blocks.lit_redstone_lamp)) { + return true; + } + if ((thereBlockID == Blocks.lit_redstone_lamp) && (replaceBlockID == Blocks.redstone_lamp)) { + return true; + } + /*if ((thereBlockID == Blocks.water) || (replaceBlockID == Blocks.flowing_water)) { + return true; + } + if ((thereBlockID == Blocks.flowing_water) || (replaceBlockID == Blocks.water)) { + return true; + }*/ + if (replaceBlockID == Blocks.tnt) { + return true; + } + return false; + } + + private void captureBlockData() + { + this.blockData = new Block[this.diameter * this.diameter * this.diameter]; + this.metaData = new byte[this.diameter * this.diameter * this.diameter]; + + int index = 0; + for (int x = -this.radius; x <= this.radius; x++) { + for (int y = -this.radius; y <= this.radius; y++) { + for (int z = -this.radius; z <= this.radius; z++) + { + Block blockID = this.worldObj.getBlock(this.xCoord + x, this.yCoord + y, this.zCoord + z); + int meta = this.worldObj.getBlockMetadata(this.xCoord + x, this.yCoord + y, this.zCoord + z); + + this.blockData[index] = blockID; + this.metaData[index] = ((byte)meta); + + index++; + } + } + } + } + + public boolean anyPlayerInRange() + { + return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, this.requiredPlayerRange) != null; + } +} diff --git a/src/Java/miscutil/core/tileentities/machines/TileEntityCharger.java b/src/Java/miscutil/core/tileentities/machines/TileEntityCharger.java new file mode 100644 index 0000000000..6d78cb829e --- /dev/null +++ b/src/Java/miscutil/core/tileentities/machines/TileEntityCharger.java @@ -0,0 +1,186 @@ +package miscutil.core.tileentities.machines; + +import miscutil.core.item.base.BaseItemWithCharge; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.Constants; + +public class TileEntityCharger extends TileEntity implements IInventory +{ + private ItemStack[] items = new ItemStack[1]; //18 + private int progress_Current = 1; + private int progress_Max = 1000; + public float charge_Current; + public float charge_Max = 10000; + private float tempItemChargeValue; + + public float getCharge(){ + return charge_Current; + } + + public int getProgress(){ + return progress_Current; + } + + @Override + public int getSizeInventory() + { + return items.length; + } + + @Override + public ItemStack getStackInSlot(int slot) + { + return items[slot]; + } + + @Override + public ItemStack decrStackSize(int slot, int amount) + { + if (items[slot] != null) + { + ItemStack itemstack; + + if (items[slot].stackSize == amount) + { + itemstack = items[slot]; + items[slot] = null; + markDirty(); + return itemstack; + } + itemstack = items[slot].splitStack(amount); + if (items[slot].stackSize == 0) items[slot] = null; + markDirty(); + return itemstack; + } + return null; + } + + @Override + public ItemStack getStackInSlotOnClosing(int slot) + { + if (items[slot] != null) + { + ItemStack itemstack = items[slot]; + items[slot] = null; + return itemstack; + } + return null; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack stack) + { + if (stack != null){ + items[slot] = stack; + if (stack != null && stack.stackSize > getInventoryStackLimit()) + { + stack.stackSize = getInventoryStackLimit(); + } + + + markDirty(); + } + } + + @Override + public String getInventoryName() + { + return "container.Charger"; + } + + @Override + public boolean hasCustomInventoryName() + { + return false; + } + + @Override + public void readFromNBT(NBTTagCompound nbt) + { + super.readFromNBT(nbt); + NBTTagList list = nbt.getTagList("Items", Constants.NBT.TAG_COMPOUND); + items = new ItemStack[getSizeInventory()]; + + for (int i = 0; i < list.tagCount(); ++i) { NBTTagCompound comp = list.getCompoundTagAt(i); int j = comp.getByte("Slot") & 255; if (j >= 0 && j < items.length) + { + items[j] = ItemStack.loadItemStackFromNBT(comp); + } + } + } + + @Override + public void writeToNBT(NBTTagCompound nbt) + { + super.writeToNBT(nbt); + NBTTagList list = new NBTTagList(); + + for (int i = 0; i < items.length; ++i) + { + if (items[i] != null) + { + NBTTagCompound comp = new NBTTagCompound(); + comp.setByte("Slot", (byte)i); + items[i].writeToNBT(comp); + list.appendTag(comp); + } + } + + nbt.setTag("Items", list); + } + + @Override + public int getInventoryStackLimit() + { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer player) + { + return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : player.getDistanceSq((double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D) <= 64.0D; + } + + @Override + public void openInventory() {} + + @Override + public void closeInventory() {} + + @Override + public boolean isItemValidForSlot(int slot, ItemStack stack) + { + return true; + } + + @Override + public void updateEntity() { + if(!this.worldObj.isRemote){ + if (progress_Current < progress_Max){ + progress_Current++; + } + else if (progress_Current >= progress_Max){ + if (charge_Current < charge_Max){ + charge_Current = charge_Current+500; + } + if (getStackInSlot(0).getItem() instanceof BaseItemWithCharge){ + float tempCharge; + ItemStack output = getStackInSlot(0).copy(); + if (output.stackTagCompound != null){ + tempCharge = output.stackTagCompound.getFloat("charge_Current"); + output.stackTagCompound = new NBTTagCompound(); + output.stackTagCompound.setFloat("charge_Current", tempCharge+40); + this.charge_Current = charge_Current-40; + tempCharge = 0; + } + } + progress_Current = 0; + } + } + } + +} \ No newline at end of file diff --git a/src/Java/miscutil/core/tileentities/machines/TileEntityNHG.java b/src/Java/miscutil/core/tileentities/machines/TileEntityNHG.java new file mode 100644 index 0000000000..3581592c02 --- /dev/null +++ b/src/Java/miscutil/core/tileentities/machines/TileEntityNHG.java @@ -0,0 +1,501 @@ +package miscutil.core.tileentities.machines; + +import miscutil.core.item.ModItems; +import miscutil.core.item.general.fuelrods.FuelRod_Base; +import miscutil.core.util.Utils; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.Constants; + +public class TileEntityNHG extends TileEntity implements IInventory +{ + private ItemStack[] items = new ItemStack[19]; //18 + private int progress = 1; + private int maxProgress = 180; + private int heatCycleProgress = 12; + public float coreTemp; + public float maxTemp = 10000; + private boolean fuelrod_1 = false; + private boolean fuelrod_2 = false; + private boolean fuelrod_3 = false; + private boolean fuelrod_4 = false; + private boolean fuelrod_5 = false; + private boolean fuelrod_6 = false; + private boolean fuelrod_7 = false; + private boolean fuelrod_8 = false; + private boolean fuelrod_9 = false; + private boolean fuelrod_10 = false; + private boolean fuelrod_11 = false; + private boolean fuelrod_12 = false; + private boolean fuelrod_13 = false; + private boolean fuelrod_14 = false; + private boolean fuelrod_15 = false; + private boolean fuelrod_16 = false; + private boolean fuelrod_17 = false; + private boolean fuelrod_18 = false; + + public float getCoreTemp(){ + return coreTemp; + } + + public int getProgress(){ + return progress; + } + + public boolean isValidFuelRod(ItemStack input){ + if(!this.worldObj.isRemote){ + if (input != null){ + if (input.getItem() instanceof FuelRod_Base){ + int fuelRodFuelLevel = getRodFuelValue(input); + float fuelRodHeatLevel = getRodHeatValue(input); + Utils.LOG_WARNING("Fuel Left: "+fuelRodFuelLevel+" Current Temp: "+fuelRodHeatLevel); + return true; + //return input.stackTagCompound.getInteger("code"); + } + } + + } + return false; + } + + public ItemStack doFuelRodHeatDamage(ItemStack input){ + if(!this.worldObj.isRemote){ + if (input != null){ + if (isValidFuelRod(input)){ + int fuelRodFuelLevel = getRodFuelValue(input); + float fuelRodHeatLevel = getRodHeatValue(input); + if(fuelRodFuelLevel <= 0 || fuelRodFuelLevel == 0){ + return null; + } + if(fuelRodHeatLevel == 0 && fuelRodFuelLevel > 0){ + if(fuelRodFuelLevel >= 5){ + int tempInt=fuelRodFuelLevel; + float tempFloat=fuelRodHeatLevel; + ItemStack output = input.copy(); + if (input.stackTagCompound != null){ + output.stackTagCompound = new NBTTagCompound(); + output.stackTagCompound.setInteger("fuelRemaining", tempInt-40); + output.stackTagCompound.setFloat("heat", tempFloat+20); + } + return output; + } + return null; + } + else if(fuelRodHeatLevel >= 5 && fuelRodFuelLevel > 0){ + int tempInt=fuelRodFuelLevel; + float tempFloat=fuelRodHeatLevel; + ItemStack output = input.copy(); + if (input.stackTagCompound != null){ + output.stackTagCompound = new NBTTagCompound(); + output.stackTagCompound.setInteger("fuelRemaining", tempInt-5); + output.stackTagCompound.setFloat("heat", tempFloat+5); + } + return output; + } + + else if(fuelRodHeatLevel >= 5 && fuelRodFuelLevel == 0){ + ItemStack output = input.copy(); + if (input.stackTagCompound != null){ + output.stackTagCompound = new NBTTagCompound(); + output.stackTagCompound.setInteger("heat", -5); + } + return output; + } + else { + return null; + } + } + } + } + return null; + } + + public float getRodHeatValue(ItemStack value){ + if (value != null){ + if (value.stackTagCompound != null){ + return value.stackTagCompound.getFloat("heat"); + } + } + return 0f; + } + + public int getRodFuelValue(ItemStack value){ + if (value != null){ + if (value.stackTagCompound != null){ + int tempInt = value.stackTagCompound.getInteger("fuelRemaining"); + return tempInt; + } + } + return 0; + } + + public void checkFuelRods(){ + + if(!this.worldObj.isRemote){ + for (int i = 0; i < getSizeInventory(); i++){ + if (items[i] != null){ + if (items[i].getItem() instanceof FuelRod_Base){ + ItemStack fuelRodStack = getStackInSlot(i).copy(); + //setInventorySlotContents(i, doFuelRodHeatDamage(fuelRodStack)); + if (i == 0){ + fuelrod_1 = true; + ItemStack r = doFuelRodHeatDamage(fuelRodStack); + setInventorySlotContents(i, r); + } + else if (i == 1){ + fuelrod_2 = true; + ItemStack r = doFuelRodHeatDamage(fuelRodStack); + setInventorySlotContents(i, r); + } + else if (i == 2){ + fuelrod_3 = true; + ItemStack r = doFuelRodHeatDamage(fuelRodStack); + setInventorySlotContents(i, r); + } + else if (i == 3){ + fuelrod_4 = true; + ItemStack r = doFuelRodHeatDamage(fuelRodStack); + setInventorySlotContents(i, r); + } + else if (i == 4){ + fuelrod_5 = true; + ItemStack r = doFuelRodHeatDamage(fuelRodStack); + setInventorySlotContents(i, r); + } + else if (i == 5){ + fuelrod_6 = true; + ItemStack r = doFuelRodHeatDamage(fuelRodStack); + setInventorySlotContents(i, r); + } + else if (i == 6){ + fuelrod_7 = true; + ItemStack r = doFuelRodHeatDamage(fuelRodStack); + setInventorySlotContents(i, r); + } + else if (i == 7){ + fuelrod_8 = true; + ItemStack r = doFuelRodHeatDamage(fuelRodStack); + setInventorySlotContents(i, r); + } + else if (i == 8){ + fuelrod_9 = true; + ItemStack r = doFuelRodHeatDamage(fuelRodStack); + setInventorySlotContents(i, r); + } + else if (i == 9){ + fuelrod_10 = true; + ItemStack r = doFuelRodHeatDamage(fuelRodStack); + setInventorySlotContents(i, r); + } + else if (i == 10){ + fuelrod_11 = true; + ItemStack r = doFuelRodHeatDamage(fuelRodStack); + setInventorySlotContents(i, r); + } + else if (i == 11){ + fuelrod_12 = true; + ItemStack r = doFuelRodHeatDamage(fuelRodStack); + setInventorySlotContents(i, r); + } + else if (i == 12){ + fuelrod_13 = true; + ItemStack r = doFuelRodHeatDamage(fuelRodStack); + setInventorySlotContents(i, r); + } + else if (i == 13){ + fuelrod_14 = true; + ItemStack r = doFuelRodHeatDamage(fuelRodStack); + setInventorySlotContents(i, r); + } + else if (i == 14){ + fuelrod_15 = true; + ItemStack r = doFuelRodHeatDamage(fuelRodStack); + setInventorySlotContents(i, r); + } + else if (i == 15){ + fuelrod_16 = true; + ItemStack r = doFuelRodHeatDamage(fuelRodStack); + setInventorySlotContents(i, r); + } + else if (i == 16){ + fuelrod_17 = true; + ItemStack r = doFuelRodHeatDamage(fuelRodStack); + setInventorySlotContents(i, r); + } + else if (i == 17){ + fuelrod_18 = true; + ItemStack r = doFuelRodHeatDamage(fuelRodStack); + setInventorySlotContents(i, r); + } + + + } + } + } + Utils.LOG_WARNING("|"+fuelrod_1+"|"+fuelrod_2+"|"+fuelrod_3+"| "+"|"+fuelrod_10+"|"+fuelrod_11+"|"+fuelrod_12+"|"); + Utils.LOG_WARNING("|"+fuelrod_4+"|"+fuelrod_5+"|"+fuelrod_6+"| "+"|"+fuelrod_13+"|"+fuelrod_14+"|"+fuelrod_15+"|"); + Utils.LOG_WARNING("|"+fuelrod_7+"|"+fuelrod_8+"|"+fuelrod_9+"| "+"|"+fuelrod_16+"|"+fuelrod_17+"|"+fuelrod_18+"|"); + } + + } + + public boolean calculateHeat(){ + /*if (!fuelrod_1 || !fuelrod_2 || !fuelrod_3 || !fuelrod_4 || !fuelrod_5 || !fuelrod_6 || !fuelrod_7 || !fuelrod_8 || !fuelrod_9 || !fuelrod_10 || !fuelrod_11 || !fuelrod_12 || !fuelrod_13 || !fuelrod_14 || !fuelrod_15 || !fuelrod_16 || !fuelrod_17 || !fuelrod_18){ + coreTemp = 0; + } + else {*/ + if(!this.worldObj.isRemote){ + for (int i = 0; i < getSizeInventory(); i++){ + if (items[i] != null){ + if (items[i].getItem() instanceof FuelRod_Base){ + ItemStack fuelRodStack = getStackInSlot(i).copy(); + //if (fuelRodStack.stackTagCompound.getFloat("heat") != 0){ + doFuelRodHeatDamage(fuelRodStack); + coreTemp = coreTemp+fuelRodStack.stackTagCompound.getFloat("heat"); + return true; + //} + } + } + } + } + //} + + + + return false; + } + + @Override + public int getSizeInventory() + { + return items.length; + } + + @Override + public ItemStack getStackInSlot(int slot) + { + + return items[slot]; + + } + + @Override + public ItemStack decrStackSize(int slot, int amount) + { + if (items[slot] != null) + { + ItemStack itemstack; + + if (items[slot].stackSize == amount) + { + itemstack = items[slot]; + items[slot] = null; + markDirty(); + return itemstack; + } + itemstack = items[slot].splitStack(amount); + if (items[slot].stackSize == 0) items[slot] = null; + markDirty(); + return itemstack; + } + return null; + } + + @Override + public ItemStack getStackInSlotOnClosing(int slot) + { + if (items[slot] != null) + { + ItemStack itemstack = items[slot]; + items[slot] = null; + return itemstack; + } + return null; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack stack) + { + if (stack != null){ + items[slot] = stack; + if (stack != null && stack.stackSize > getInventoryStackLimit()) + { + stack.stackSize = getInventoryStackLimit(); + } + + + markDirty(); + } + } + + @Override + public String getInventoryName() + { + return "container.NHG"; + } + + @Override + public boolean hasCustomInventoryName() + { + return false; + } + + @Override + public void readFromNBT(NBTTagCompound nbt) + { + super.readFromNBT(nbt); + NBTTagList list = nbt.getTagList("Items", Constants.NBT.TAG_COMPOUND); + items = new ItemStack[getSizeInventory()]; + + for (int i = 0; i < list.tagCount(); ++i) { NBTTagCompound comp = list.getCompoundTagAt(i); int j = comp.getByte("Slot") & 255; if (j >= 0 && j < items.length) + { + items[j] = ItemStack.loadItemStackFromNBT(comp); + } + } + } + + @Override + public void writeToNBT(NBTTagCompound nbt) + { + super.writeToNBT(nbt); + NBTTagList list = new NBTTagList(); + + for (int i = 0; i < items.length; ++i) + { + if (items[i] != null) + { + NBTTagCompound comp = new NBTTagCompound(); + comp.setByte("Slot", (byte)i); + items[i].writeToNBT(comp); + list.appendTag(comp); + } + } + + nbt.setTag("Items", list); + } + + @Override + public int getInventoryStackLimit() + { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer player) + { + return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : player.getDistanceSq((double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D) <= 64.0D; + } + + @Override + public void openInventory() {} + + @Override + public void closeInventory() {} + + @Override + public boolean isItemValidForSlot(int slot, ItemStack stack) + { + return true; + } + + //Machine Code - TODO + private ItemStack neutrons; + + @Override + public void updateEntity() { + + if(!this.worldObj.isRemote){ + + if(progress >= heatCycleProgress){ + //Utils.LOG_SPECIFIC_WARNING("NFHG", "Updating Entity "+this.getBlockType().getUnlocalizedName(), 376); + if (Utils.divideXintoY(heatCycleProgress, maxProgress)){ + Utils.LOG_SPECIFIC_WARNING("NFHG", "Updating Entity "+this.getBlockType().getUnlocalizedName(), 378); + calculateHeat(); + heatCycleProgress=0; + } + } + + if(++progress >= maxProgress){ + + + Utils.LOG_SPECIFIC_WARNING("NFHG", "Updating Entity "+this.getBlockType().getUnlocalizedName(), 338); + if (items[18] != null){ + ItemStack checkOutput = getStackInSlot(18); + if(neutrons == null){ + neutrons = new ItemStack(ModItems.itemHeliumBlob, 1); + if (checkOutput == null){ + Utils.LOG_WARNING("ItemStack in Output slot is definitely null, making a new ItemStack."); + setInventorySlotContents(18, neutrons); + progress = 0; + markDirty(); + } + else { + checkOutput.stackSize++; + Utils.LOG_WARNING("Found an ItemStack to increase the size of. Current size is "+neutrons.stackSize); + + progress = 0; + markDirty(); + } + } + else if(checkOutput.getItem() == ModItems.itemHeliumBlob && checkOutput.stackSize < 64){ + checkOutput.stackSize++; + Utils.LOG_WARNING("Found an ItemStack to increase size of. Current size is "+checkOutput.stackSize); + progress = 0; + markDirty(); + } + else if(checkOutput.getItem() == ModItems.itemHeliumBlob && checkOutput.stackSize == 64){ + Utils.LOG_WARNING("Output stack is full."); + progress = 0; + markDirty(); + } + } + else if (items[18] == null){ + Utils.LOG_WARNING("ItemStack in Output slot is null"); + neutrons = new ItemStack(ModItems.itemHeliumBlob, 1); + ItemStack checkOutput = getStackInSlot(18); + if (checkOutput == null){ + Utils.LOG_WARNING("ItemStack in Output slot is definitely null, making a new ItemStack."); + setInventorySlotContents(18, neutrons); + progress = 0; + markDirty(); + } + else { + Utils.LOG_WARNING("Found an ItemStack to increase the size of."); + checkOutput.stackSize++; + progress = 0; + markDirty(); + } + } + checkFuelRods(); + } + progress++; + } + } + + public void readCustomNBT(NBTTagCompound tag) + { + this.neutrons = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Neutrons")); + this.progress = tag.getInteger("Progress"); + this.coreTemp = tag.getFloat("coreTemp"); + } + + public void writeCustomNBT(NBTTagCompound tag) + { + tag.setInteger("Progress", this.progress); + tag.setFloat("coreTemp", this.coreTemp); + if(neutrons != null) { + NBTTagCompound produce = new NBTTagCompound(); + neutrons.writeToNBT(produce); + tag.setTag("Neutrons", produce); + } + else + tag.removeTag("Neutrons"); + } + + + +} \ No newline at end of file diff --git a/src/Java/miscutil/gregtech/api/enums/GregtechItemList.java b/src/Java/miscutil/gregtech/api/enums/GregtechItemList.java index 9a2d8c23df..784f521765 100644 --- a/src/Java/miscutil/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/miscutil/gregtech/api/enums/GregtechItemList.java @@ -42,6 +42,9 @@ public enum GregtechItemList implements GregtechItemContainer { //Player owned Safes GT_Safe_ULV, GT_Safe_LV, GT_Safe_MV, GT_Safe_HV, GT_Safe_EV, GT_Safe_IV, GT_Safe_LuV, GT_Safe_ZPM, GT_Safe_UV, GT_Safe_MAX, + //Rocket Engines + Rocket_Engine_EV, Rocket_Engine_IV, Rocket_Engine_LuV, + //IronBlastFurnace Machine_Bronze_BlastFurnace Machine_Iron_BlastFurnace, Casing_IronPlatedBricks, @@ -55,7 +58,19 @@ public enum GregtechItemList implements GregtechItemContainer { Industrial_CokeOven, Casing_CokeOven, Casing_CokeOven_Coil1, Casing_CokeOven_Coil2, //Bending Maching // Plate Press // Press - Industrial_PlatePress; + Industrial_PlatePress, + + //Gregtech Machine Parts + Electric_Motor_LuV, Electric_Motor_ZPM, Electric_Motor_UV, Electric_Motor_MAX, + Electric_Pump_LuV, Electric_Pump_ZPM, Electric_Pump_UV, Electric_Pump_MAX, + Conveyor_Module_LuV, Conveyor_Module_ZPM, Conveyor_Module_UV, Conveyor_Module_MAX, + Electric_Piston_LuV, Electric_Piston_ZPM, Electric_Piston_UV, Electric_Piston_MAX, + Robot_Arm_LuV, Robot_Arm_ZPM, Robot_Arm_UV, Robot_Arm_MAX, + Field_Generator_LuV, Field_Generator_ZPM, Field_Generator_UV, Field_Generator_MAX, + Emitter_LuV, Emitter_ZPM, Emitter_UV, Emitter_MAX, + Sensor_LuV, Sensor_ZPM, Sensor_UV, Sensor_MAX, + Circuit_Primitive, Circuit_Basic, Circuit_Good, Circuit_Advanced, + Circuit_Data, Circuit_Elite, Circuit_Master; public static final GregtechItemList[] DYE_ONLY_ITEMS = { diff --git a/src/Java/miscutil/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/Java/miscutil/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java index aad32dd093..efd3b12506 100644 --- a/src/Java/miscutil/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java +++ b/src/Java/miscutil/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java @@ -19,4 +19,6 @@ public interface IGregtech_RecipeAdder { //public boolean addCokeOvenRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue); public boolean addCokeOvenRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt); + public boolean addFuel(ItemStack aInput1, ItemStack aOutput1, int aEU, int aType); + } diff --git a/src/Java/miscutil/gregtech/api/interfaces/internal/Interface_ItemBehaviour.java b/src/Java/miscutil/gregtech/api/interfaces/internal/Interface_ItemBehaviour.java new file mode 100644 index 0000000000..74980e5d3c --- /dev/null +++ b/src/Java/miscutil/gregtech/api/interfaces/internal/Interface_ItemBehaviour.java @@ -0,0 +1,41 @@ +package miscutil.gregtech.api.interfaces.internal; + +import gregtech.api.enums.SubTag; + +import java.util.List; + +import miscutil.gregtech.api.items.Gregtech_MetaItem_Base; +import net.minecraft.dispenser.IBlockSource; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public interface Interface_ItemBehaviour { + public boolean onLeftClickEntity(E aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity); + + public boolean onItemUse(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ); + + public boolean onItemUseFirst(E aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ); + + public ItemStack onItemRightClick(E aItem, ItemStack aStack, World aWorld, EntityPlayer aPlayer); + + public List getAdditionalToolTips(E aItem, List aList, ItemStack aStack); + + public void onUpdate(E aItem, ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand); + + public boolean isItemStackUsable(E aItem, ItemStack aStack); + + public boolean canDispense(E aItem, IBlockSource aSource, ItemStack aStack); + + public ItemStack onDispense(E aItem, IBlockSource aSource, ItemStack aStack); + + public boolean hasProjectile(Gregtech_MetaItem_Base aItem, SubTag aProjectileType, ItemStack aStack); + + public EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ); + + public EntityArrow getProjectile(E aItem, SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed); +} \ No newline at end of file diff --git a/src/Java/miscutil/gregtech/api/items/Gregtech_Generic_Item.java b/src/Java/miscutil/gregtech/api/items/Gregtech_Generic_Item.java new file mode 100644 index 0000000000..987267ae64 --- /dev/null +++ b/src/Java/miscutil/gregtech/api/items/Gregtech_Generic_Item.java @@ -0,0 +1,176 @@ +package miscutil.gregtech.api.items; + +import gregtech.api.enums.SubTag; +import gregtech.api.interfaces.IProjectileItem; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; + +import java.util.List; + +import miscutil.core.creative.AddToCreativeTab; +import miscutil.core.lib.CORE; +import net.minecraft.block.BlockDispenser; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.dispenser.BehaviorDefaultDispenseItem; +import net.minecraft.dispenser.BehaviorProjectileDispense; +import net.minecraft.dispenser.IBlockSource; +import net.minecraft.dispenser.IPosition; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IProjectile; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/** + * Extended by most Items, also used as a fallback Item, to prevent the accidental deletion when Errors occur. + */ +public class Gregtech_Generic_Item extends Item implements IProjectileItem { + private final String mName, mTooltip; + protected IIcon mIcon; + + public Gregtech_Generic_Item(String aUnlocalized, String aEnglish, String aEnglishTooltip) { + this(aUnlocalized, aEnglish, aEnglishTooltip, true); + } + + public Gregtech_Generic_Item(String aUnlocalized, String aEnglish, String aEnglishTooltip, boolean aWriteToolTipIntoLangFile) { + super(); + mName = aUnlocalized; + GT_LanguageManager.addStringLocalization(mName + ".name", aEnglish); + if (GT_Utility.isStringValid(aEnglishTooltip)) + GT_LanguageManager.addStringLocalization(mTooltip = mName + ".tooltip_main", aEnglishTooltip, aWriteToolTipIntoLangFile); + else mTooltip = null; + setCreativeTab(AddToCreativeTab.tabMachines); + GameRegistry.registerItem(this, mName, CORE.MODID); + BlockDispenser.dispenseBehaviorRegistry.putObject(this, new GT_Item_Dispense()); + } + + @Override + public final Item setUnlocalizedName(String aName) { + return this; + } + + @Override + public final String getUnlocalizedName() { + return mName; + } + + @Override + public String getUnlocalizedName(ItemStack aStack) { + return getHasSubtypes() ? mName + "." + getDamage(aStack) : mName; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aIconRegister) { + mIcon = aIconRegister.registerIcon(CORE.MODID+":"+mName); + } + + @Override + public boolean doesSneakBypassUse(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) { + return true; + } + + @Override + public IIcon getIconFromDamage(int par1) { + return mIcon; + } + + public int getTier(ItemStack aStack) { + return 0; + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { + if (getMaxDamage() > 0 && !getHasSubtypes()) + aList.add((aStack.getMaxDamage() - getDamage(aStack)) + " / " + aStack.getMaxDamage()); + if (mTooltip != null) aList.add(GT_LanguageManager.getTranslation(mTooltip)); + if (GT_ModHandler.isElectricItem(aStack)) aList.add("Tier: " + getTier(aStack)); + addAdditionalToolTips(aList, aStack); + } + + protected void addAdditionalToolTips(List aList, ItemStack aStack) { + // + } + + @Override + public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { + isItemStackUsable(aStack); + } + + public boolean isItemStackUsable(ItemStack aStack) { + return true; + } + + public ItemStack onDispense(IBlockSource aSource, ItemStack aStack) { + EnumFacing enumfacing = BlockDispenser.func_149937_b(aSource.getBlockMetadata()); + IPosition iposition = BlockDispenser.func_149939_a(aSource); + ItemStack itemstack1 = aStack.splitStack(1); + BehaviorDefaultDispenseItem.doDispense(aSource.getWorld(), itemstack1, 6, enumfacing, iposition); + return aStack; + } + + @Override + public EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ) { + return null; + } + + @Override + public EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed) { + return null; + } + + @Override + public boolean hasProjectile(SubTag aProjectileType, ItemStack aStack) { + return false; + } + + @Override + public ItemStack getContainerItem(ItemStack aStack) { + return null; + } + + @Override + public boolean hasContainerItem(ItemStack aStack) { + return getContainerItem(aStack) != null; + } + + public static class GT_Item_Dispense extends BehaviorProjectileDispense { + @Override + public ItemStack dispenseStack(IBlockSource aSource, ItemStack aStack) { + return ((Gregtech_Generic_Item) aStack.getItem()).onDispense(aSource, aStack); + } + + @Override + protected IProjectile getProjectileEntity(World aWorld, IPosition aPosition) { + return null; + } + } + + @Override + public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + if (stack.getDisplayName().contains("LuV")){ + HEX_OxFFFFFF = 0xffffcc; + } + else if (stack.getDisplayName().contains("ZPM")){ + HEX_OxFFFFFF = 0xace600; + } + else if (stack.getDisplayName().contains("UV")){ + HEX_OxFFFFFF = 0xffff00; + } + else if (stack.getDisplayName().contains("MAX")){ + HEX_OxFFFFFF = 0xff0000; + } + else { + HEX_OxFFFFFF = 0xffffff; + } + return HEX_OxFFFFFF; + } +} \ No newline at end of file diff --git a/src/Java/miscutil/gregtech/api/items/Gregtech_MetaItem.java b/src/Java/miscutil/gregtech/api/items/Gregtech_MetaItem.java new file mode 100644 index 0000000000..d7a3f3bbf3 --- /dev/null +++ b/src/Java/miscutil/gregtech/api/items/Gregtech_MetaItem.java @@ -0,0 +1,323 @@ +package miscutil.gregtech.api.items; + +import static gregtech.api.enums.GT_Values.D1; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.SubTag; +import gregtech.api.enums.TC_Aspects.TC_AspectStack; +import gregtech.api.interfaces.IFoodStat; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.IItemContainer; +import gregtech.api.objects.ItemData; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.BitSet; +import java.util.HashMap; +import java.util.List; + +import miscutil.core.creative.AddToCreativeTab; +import miscutil.core.lib.CORE; +import miscutil.gregtech.api.interfaces.internal.Interface_ItemBehaviour; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public abstract class Gregtech_MetaItem extends Gregtech_MetaItem_Base { + /** + * All instances of this Item Class are listed here. + * This gets used to register the Renderer to all Items of this Type, if useStandardMetaItemRenderer() returns true. + *

+ * You can also use the unlocalized Name gotten from getUnlocalizedName() as Key if you want to get a specific Item. + */ + public static final HashMap sInstances = new HashMap(); + + /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ + + public final short mOffset, mItemAmount; + public final BitSet mEnabledItems; + public final BitSet mVisibleItems; + public final IIcon[][] mIconList; + + public final HashMap mFoodStats = new HashMap(); + public final HashMap mElectricStats = new HashMap(); + public final HashMap mFluidContainerStats = new HashMap(); + public final HashMap mBurnValues = new HashMap(); + + /** + * Creates the Item using these Parameters. + * + * @param aUnlocalized The Unlocalized Name of this Item. + */ + public Gregtech_MetaItem(String aUnlocalized, short aOffset, short aItemAmount) { + super(aUnlocalized); + setCreativeTab(AddToCreativeTab.tabMachines); + setHasSubtypes(true); + setMaxDamage(0); + mEnabledItems = new BitSet(aItemAmount); + mVisibleItems = new BitSet(aItemAmount); + + mOffset = (short) Math.min(32766, aOffset); + mItemAmount = (short) Math.min(aItemAmount, 32766 - mOffset); + mIconList = new IIcon[aItemAmount][1]; + + sInstances.put(getUnlocalizedName(), this); + } + + /** + * This adds a Custom Item to the ending Range. + * + * @param aID The Id of the assigned Item [0 - mItemAmount] (The MetaData gets auto-shifted by +mOffset) + * @param aEnglish The Default Localized Name of the created Item + * @param aToolTip The Default ToolTip of the created Item, you can also insert null for having no ToolTip + * @param aFoodBehavior The Food Value of this Item. Can be null aswell. Just a convenience thing. + * @param aRandomData The OreDict Names you want to give the Item. Also used for TC Aspects and some other things. + * @return An ItemStack containing the newly created Item. + */ + public final ItemStack addItem(int aID, String aEnglish, String aToolTip, Object... aRandomData) { + if (aToolTip == null) aToolTip = ""; + if (aID >= 0 && aID < mItemAmount) { + ItemStack rStack = new ItemStack(this, 1, mOffset + aID); + mEnabledItems.set(aID); + mVisibleItems.set(aID); + GT_LanguageManager.addStringLocalization(getUnlocalizedName(rStack) + ".name", aEnglish); + GT_LanguageManager.addStringLocalization(getUnlocalizedName(rStack) + ".tooltip", aToolTip); + List tAspects = new ArrayList(); + // Important Stuff to do first + for (Object tRandomData : aRandomData) + if (tRandomData instanceof SubTag) { + if (tRandomData == SubTag.INVISIBLE) { + mVisibleItems.set(aID, false); + continue; + } + if (tRandomData == SubTag.NO_UNIFICATION) { + GT_OreDictUnificator.addToBlacklist(rStack); + continue; + } + } + // now check for the rest + for (Object tRandomData : aRandomData) + if (tRandomData != null) { + boolean tUseOreDict = true; + + if (tRandomData instanceof Interface_ItemBehaviour) { + addItemBehavior(mOffset + aID, (Interface_ItemBehaviour) tRandomData); + tUseOreDict = false; + } + if (tRandomData instanceof IItemContainer) { + ((IItemContainer) tRandomData).set(rStack); + tUseOreDict = false; + } + if (tRandomData instanceof SubTag) { + continue; + } + if (tRandomData instanceof TC_AspectStack) { + ((TC_AspectStack) tRandomData).addToAspectList(tAspects); + continue; + } + if (tRandomData instanceof ItemData) { + if (GT_Utility.isStringValid(tRandomData)) + GT_OreDictUnificator.registerOre(tRandomData, rStack); + else GT_OreDictUnificator.addItemData(rStack, (ItemData) tRandomData); + continue; + } + if (tUseOreDict) { + GT_OreDictUnificator.registerOre(tRandomData, rStack); + continue; + } + } + if (GregTech_API.sThaumcraftCompat != null) + GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false); + return rStack; + } + return null; + } + + /** + * Sets the Furnace Burn Value for the Item. + * + * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] + * @param aValue 200 = 1 Burn Process = 500 EU, max = 32767 (that is 81917.5 EU) + * @return the Item itself for convenience in constructing. + */ + public final Gregtech_MetaItem setBurnValue(int aMetaValue, int aValue) { + if (aMetaValue < 0 || aMetaValue >= mOffset + mEnabledItems.length() || aValue < 0) return this; + if (aValue == 0) mBurnValues.remove((short) aMetaValue); + else mBurnValues.put((short) aMetaValue, aValue > Short.MAX_VALUE ? Short.MAX_VALUE : (short) aValue); + return this; + } + + /** + * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] + * @param aMaxCharge Maximum Charge. (if this is == 0 it will remove the Electric Behavior) + * @param aTransferLimit Transfer Limit. + * @param aTier The electric Tier. + * @param aSpecialData If this Item has a Fixed Charge, like a SingleUse Battery (if > 0). + * Use -1 if you want to make this Battery chargeable (the use and canUse Functions will still discharge if you just use this) + * Use -2 if you want to make this Battery dischargeable. + * Use -3 if you want to make this Battery charge/discharge-able. + * @return the Item itself for convenience in constructing. + */ + public final Gregtech_MetaItem setElectricStats(int aMetaValue, long aMaxCharge, long aTransferLimit, long aTier, long aSpecialData, boolean aUseAnimations) { + if (aMetaValue < 0 || aMetaValue >= mOffset + mEnabledItems.length()) return this; + if (aMaxCharge == 0) mElectricStats.remove((short) aMetaValue); + else { + mElectricStats.put((short) aMetaValue, new Long[]{aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData}); + if (aMetaValue >= mOffset && aUseAnimations) + mIconList[aMetaValue - mOffset] = Arrays.copyOf(mIconList[aMetaValue - mOffset], Math.max(9, mIconList[aMetaValue - mOffset].length)); + } + return this; + } + + /** + * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] + * @param aMaxCharge Maximum Charge. (if this is == 0 it will remove the Electric Behavior) + * @param aTransferLimit Transfer Limit. + * @param aTier The electric Tier. + * @param aSpecialData If this Item has a Fixed Charge, like a SingleUse Battery (if > 0). + * Use -1 if you want to make this Battery chargeable (the use and canUse Functions will still discharge if you just use this) + * Use -2 if you want to make this Battery dischargeable. + * Use -3 if you want to make this Battery charge/discharge-able. + * @return the Item itself for convenience in constructing. + */ + public final Gregtech_MetaItem setFluidContainerStats(int aMetaValue, long aCapacity, long aStacksize) { + if (aMetaValue < 0 || aMetaValue >= mOffset + mEnabledItems.length()) return this; + if (aCapacity < 0) mElectricStats.remove((short) aMetaValue); + else mFluidContainerStats.put((short) aMetaValue, new Long[]{aCapacity, Math.max(1, aStacksize)}); + return this; + } + + /** + * @return if this MetaGenerated Item should use my Default Renderer System. + */ + public boolean useStandardMetaItemRenderer() { + return true; + } + + /** + * @return the Color Modulation the Material is going to be rendered with. + */ + public short[] getRGBa(ItemStack aStack) { + return Materials._NULL.getRGBA(); + } + + /** + * @return the Icon the Material is going to be rendered with. + */ + public IIconContainer getIconContainer(int aMetaData) { + return null; + } + + /* ---------- INTERNAL OVERRIDES ---------- */ + + @Override + public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { + return super.onItemRightClick(aStack, aWorld, aPlayer); + } + + @Override + public int getMaxItemUseDuration(ItemStack aStack) { + return mFoodStats.get((short) getDamage(aStack)) == null ? 0 : 32; + } + + @Override + public EnumAction getItemUseAction(ItemStack aStack) { + return EnumAction.none; + } + + @Override + public final ItemStack onEaten(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { + IFoodStat tStat = mFoodStats.get((short) getDamage(aStack)); + if (tStat != null) { + + } + return aStack; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) { + for (int i = 0, j = mEnabledItems.length(); i < j; i++) + if (mVisibleItems.get(i) || (D1 && mEnabledItems.get(i))) { + Long[] tStats = mElectricStats.get((short) (mOffset + i)); + if (tStats != null && tStats[3] < 0) { + ItemStack tStack = new ItemStack(this, 1, mOffset + i); + setCharge(tStack, Math.abs(tStats[0])); + isItemStackUsable(tStack); + aList.add(tStack); + } + if (tStats == null || tStats[3] != -2) { + ItemStack tStack = new ItemStack(this, 1, mOffset + i); + isItemStackUsable(tStack); + aList.add(tStack); + } + } + } + + @Override + @SideOnly(Side.CLIENT) + public final void registerIcons(IIconRegister aIconRegister) { + for (short i = 0, j = (short) mEnabledItems.length(); i < j; i++) + if (mEnabledItems.get(i)) { + for (byte k = 1; k < mIconList[i].length; k++) { + mIconList[i][k] = aIconRegister.registerIcon(CORE.MODID+":"+getUnlocalizedName() + "/" + i + "/" + k); + } + mIconList[i][0] = aIconRegister.registerIcon(CORE.MODID+":"+getUnlocalizedName() + "/" + i); + } + } + + @Override + public final Long[] getElectricStats(ItemStack aStack) { + return mElectricStats.get((short) aStack.getItemDamage()); + } + + @Override + public final Long[] getFluidContainerStats(ItemStack aStack) { + return mFluidContainerStats.get((short) aStack.getItemDamage()); + } + + @Override + public int getItemEnchantability() { + return 0; + } + + @Override + public boolean isBookEnchantable(ItemStack aStack, ItemStack aBook) { + return false; + } + + @Override + public boolean getIsRepairable(ItemStack aStack, ItemStack aMaterial) { + return false; + } + + @Override + public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + if (stack.getDisplayName().contains("LuV")){ + HEX_OxFFFFFF = 0xffffcc; + } + else if (stack.getDisplayName().contains("ZPM")){ + HEX_OxFFFFFF = 0xace600; + } + else if (stack.getDisplayName().contains("UV")){ + HEX_OxFFFFFF = 0xffff00; + } + else if (stack.getDisplayName().contains("MAX")){ + HEX_OxFFFFFF = 0xff0000; + } + else { + HEX_OxFFFFFF = 0xffffff; + } + return HEX_OxFFFFFF; + } +} \ No newline at end of file diff --git a/src/Java/miscutil/gregtech/api/items/Gregtech_MetaItem_Base.java b/src/Java/miscutil/gregtech/api/items/Gregtech_MetaItem_Base.java new file mode 100644 index 0000000000..288d90a577 --- /dev/null +++ b/src/Java/miscutil/gregtech/api/items/Gregtech_MetaItem_Base.java @@ -0,0 +1,634 @@ +package miscutil.gregtech.api.items; + +import static gregtech.api.enums.GT_Values.D1; +import static gregtech.api.enums.GT_Values.V; +import gregtech.api.enums.SubTag; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import ic2.api.item.IElectricItemManager; +import ic2.api.item.ISpecialElectricItem; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import miscutil.gregtech.api.interfaces.internal.Interface_ItemBehaviour; +import net.minecraft.dispenser.IBlockSource; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.inventory.Container; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidContainerItem; + +public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item implements ISpecialElectricItem, IElectricItemManager, IFluidContainerItem { + /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ + private final HashMap>> mItemBehaviors = new HashMap>>(); + + /** + * Creates the Item using these Parameters. + * + * @param aUnlocalized The Unlocalized Name of this Item. + * @param aGeneratedPrefixList The OreDict Prefixes you want to have generated. + */ + public Gregtech_MetaItem_Base(String aUnlocalized) { + super(aUnlocalized, "Generated Item", null, false); + setHasSubtypes(true); + setMaxDamage(0); + } + + /** + * Adds a special Item Behaviour to the Item. + *

+ * Note: the boolean Behaviours sometimes won't be executed if another boolean Behaviour returned true before. + * + * @param aMetaValue the Meta Value of the Item you want to add it to. [0 - 32765] + * @param aBehavior the Click Behavior you want to add. + * @return the Item itself for convenience in constructing. + */ + public final Gregtech_MetaItem_Base addItemBehavior(int aMetaValue, Interface_ItemBehaviour aBehavior) { + if (aMetaValue < 0 || aMetaValue >= 32766 || aBehavior == null) return this; + ArrayList> tList = mItemBehaviors.get((short) aMetaValue); + if (tList == null) { + tList = new ArrayList>(1); + mItemBehaviors.put((short) aMetaValue, tList); + } + tList.add(aBehavior); + return this; + } + + public abstract Long[] getElectricStats(ItemStack aStack); + + public abstract Long[] getFluidContainerStats(ItemStack aStack); + + @Override + public boolean hasProjectile(SubTag aProjectileType, ItemStack aStack) { + ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); + if (tList != null) for (Interface_ItemBehaviour tBehavior : tList) + if (tBehavior.hasProjectile(this, aProjectileType, aStack)) return true; + return super.hasProjectile(aProjectileType, aStack); + } + + @Override + public EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, double aX, double aY, double aZ) { + ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); + if (tList != null) for (Interface_ItemBehaviour tBehavior : tList) { + EntityArrow rArrow = tBehavior.getProjectile(this, aProjectileType, aStack, aWorld, aX, aY, aZ); + if (rArrow != null) return rArrow; + } + return super.getProjectile(aProjectileType, aStack, aWorld, aX, aY, aZ); + } + + @Override + public EntityArrow getProjectile(SubTag aProjectileType, ItemStack aStack, World aWorld, EntityLivingBase aEntity, float aSpeed) { + ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); + if (tList != null) for (Interface_ItemBehaviour tBehavior : tList) { + EntityArrow rArrow = tBehavior.getProjectile(this, aProjectileType, aStack, aWorld, aEntity, aSpeed); + if (rArrow != null) return rArrow; + } + return super.getProjectile(aProjectileType, aStack, aWorld, aEntity, aSpeed); + } + + @Override + public ItemStack onDispense(IBlockSource aSource, ItemStack aStack) { + ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); + if (tList != null) for (Interface_ItemBehaviour tBehavior : tList) + if (tBehavior.canDispense(this, aSource, aStack)) return tBehavior.onDispense(this, aSource, aStack); + return super.onDispense(aSource, aStack); + } + + @Override + public boolean isItemStackUsable(ItemStack aStack) { + ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); + if (tList != null) for (Interface_ItemBehaviour tBehavior : tList) + if (!tBehavior.isItemStackUsable(this, aStack)) return false; + return super.isItemStackUsable(aStack); + } + + @Override + public boolean onLeftClickEntity(ItemStack aStack, EntityPlayer aPlayer, Entity aEntity) { + use(aStack, 0, aPlayer); + isItemStackUsable(aStack); + ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); + if (tList != null) for (Interface_ItemBehaviour tBehavior : tList) + try { + if (tBehavior.onLeftClickEntity(this, aStack, aPlayer, aEntity)) { + if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); + return true; + } + if (aStack.stackSize <= 0) { + aPlayer.destroyCurrentEquippedItem(); + return false; + } + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + return false; + } + + @Override + public boolean onItemUse(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + use(aStack, 0, aPlayer); + isItemStackUsable(aStack); + ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); + if (tList != null) for (Interface_ItemBehaviour tBehavior : tList) + try { + if (tBehavior.onItemUse(this, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ)) { + if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); + return true; + } + if (aStack.stackSize <= 0) { + aPlayer.destroyCurrentEquippedItem(); + return false; + } + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + return false; + } + + @Override + public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + use(aStack, 0, aPlayer); + isItemStackUsable(aStack); + ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); + if (tList != null) for (Interface_ItemBehaviour tBehavior : tList) + try { + if (tBehavior.onItemUseFirst(this, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ)) { + if (aStack.stackSize <= 0) aPlayer.destroyCurrentEquippedItem(); + return true; + } + if (aStack.stackSize <= 0) { + aPlayer.destroyCurrentEquippedItem(); + return false; + } + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + return false; + } + + @Override + public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { + use(aStack, 0, aPlayer); + isItemStackUsable(aStack); + ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); + if (tList != null) for (Interface_ItemBehaviour tBehavior : tList) + try { + aStack = tBehavior.onItemRightClick(this, aStack, aWorld, aPlayer); + } catch (Throwable e) { + if (D1) e.printStackTrace(GT_Log.err); + } + return aStack; + } + + @Override + public final void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { + String tKey = getUnlocalizedName(aStack) + ".tooltip", tString = GT_LanguageManager.getTranslation(tKey); + if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) aList.add(tString); + + Long[] + tStats = getElectricStats(aStack); + if (tStats != null) { + if (tStats[3] > 0) { + aList.add(EnumChatFormatting.AQUA + "Contains " + GT_Utility.formatNumbers(tStats[3]) + " EU Tier: " + (tStats[2] >= 0 ? tStats[2] : 0) + EnumChatFormatting.GRAY); + } else { + long tCharge = getRealCharge(aStack); + if (tStats[3] == -2 && tCharge <= 0) { + aList.add(EnumChatFormatting.AQUA + "Empty. You should recycle it properly." + EnumChatFormatting.GRAY); + } else { + aList.add(EnumChatFormatting.AQUA + "" + GT_Utility.formatNumbers(tCharge) + " / " + GT_Utility.formatNumbers(Math.abs(tStats[0])) + " EU - Voltage: " + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)] + EnumChatFormatting.GRAY); + } + } + } + + tStats = getFluidContainerStats(aStack); + if (tStats != null && tStats[0] > 0) { + FluidStack tFluid = getFluidContent(aStack); + aList.add(EnumChatFormatting.BLUE + ((tFluid == null ? "No Fluids Contained" : GT_Utility.getFluidName(tFluid, true))) + EnumChatFormatting.GRAY); + aList.add(EnumChatFormatting.BLUE + ((tFluid == null ? 0 : tFluid.amount) + "L / " + tStats[0] + "L") + EnumChatFormatting.GRAY); + } + + ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); + if (tList != null) for (Interface_ItemBehaviour tBehavior : tList) + aList = tBehavior.getAdditionalToolTips(this, aList, aStack); + + addAdditionalToolTips(aList, aStack); + } + + @Override + public void onUpdate(ItemStack aStack, World aWorld, Entity aPlayer, int aTimer, boolean aIsInHand) { + ArrayList> tList = mItemBehaviors.get((short) getDamage(aStack)); + if (tList != null) for (Interface_ItemBehaviour tBehavior : tList) + tBehavior.onUpdate(this, aStack, aWorld, aPlayer, aTimer, aIsInHand); + } + + @Override + public final boolean canProvideEnergy(ItemStack aStack) { + Long[] tStats = getElectricStats(aStack); + if (tStats == null) return false; + return tStats[3] > 0 || (aStack.stackSize == 1 && (tStats[3] == -2 || tStats[3] == -3)); + } + + @Override + public final double getMaxCharge(ItemStack aStack) { + Long[] tStats = getElectricStats(aStack); + if (tStats == null) return 0; + return Math.abs(tStats[0]); + } + + @Override + public final double getTransferLimit(ItemStack aStack) { + Long[] tStats = getElectricStats(aStack); + if (tStats == null) return 0; + return Math.max(tStats[1], tStats[3]); + } + + @Override + public final double charge(ItemStack aStack, double aCharge, int aTier, boolean aIgnoreTransferLimit, boolean aSimulate) { + Long[] tStats = getElectricStats(aStack); + if (tStats == null || tStats[2] > aTier || !(tStats[3] == -1 || tStats[3] == -3 || (tStats[3] < 0 && aCharge == Integer.MAX_VALUE)) || aStack.stackSize != 1) + return 0; + long tChargeBefore = getRealCharge(aStack), tNewCharge = aCharge == Integer.MAX_VALUE ? Long.MAX_VALUE : Math.min(Math.abs(tStats[0]), tChargeBefore + (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); + if (!aSimulate) setCharge(aStack, tNewCharge); + return tNewCharge - tChargeBefore; + } + + @Override + public final double discharge(ItemStack aStack, double aCharge, int aTier, boolean aIgnoreTransferLimit, boolean aBatteryAlike, boolean aSimulate) { + Long[] tStats = getElectricStats(aStack); + if (tStats == null || tStats[2] > aTier) return 0; + if (aBatteryAlike && !canProvideEnergy(aStack)) return 0; + if (tStats[3] > 0) { + if (aCharge < tStats[3] || aStack.stackSize < 1) return 0; + if (!aSimulate) aStack.stackSize--; + return tStats[3]; + } + long tChargeBefore = getRealCharge(aStack), tNewCharge = Math.max(0, tChargeBefore - (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); + if (!aSimulate) setCharge(aStack, tNewCharge); + return tChargeBefore - tNewCharge; + } + + @Override + public final double getCharge(ItemStack aStack) { + return getRealCharge(aStack); + } + + @Override + public final boolean canUse(ItemStack aStack, double aAmount) { + return getRealCharge(aStack) >= aAmount; + } + + @Override + public final boolean use(ItemStack aStack, double aAmount, EntityLivingBase aPlayer) { + chargeFromArmor(aStack, aPlayer); + if (aPlayer instanceof EntityPlayer && ((EntityPlayer) aPlayer).capabilities.isCreativeMode) return true; + double tTransfer = discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, true); + if (tTransfer == aAmount) { + discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); + chargeFromArmor(aStack, aPlayer); + return true; + } + discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); + chargeFromArmor(aStack, aPlayer); + return false; + } + + @Override + public final void chargeFromArmor(ItemStack aStack, EntityLivingBase aPlayer) { + if (aPlayer == null || aPlayer.worldObj.isRemote) return; + for (int i = 1; i < 5; i++) { + ItemStack tArmor = aPlayer.getEquipmentInSlot(i); + if (GT_ModHandler.isElectricItem(tArmor)) { + IElectricItem tArmorItem = (IElectricItem) tArmor.getItem(); + if (tArmorItem.canProvideEnergy(tArmor) && tArmorItem.getTier(tArmor) >= getTier(aStack)) { + double tCharge = ElectricItem.manager.discharge(tArmor, charge(aStack, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, true, true), Integer.MAX_VALUE, true, true, false); + if (tCharge > 0) { + charge(aStack, tCharge, Integer.MAX_VALUE, true, false); + if (aPlayer instanceof EntityPlayer) { + Container tContainer = ((EntityPlayer) aPlayer).openContainer; + if (tContainer != null) tContainer.detectAndSendChanges(); + } + } + } + } + } + } + + /* + + @Override + public final int getMaxCharge(ItemStack aStack) { + Long[] tStats = getElectricStats(aStack); + if (tStats == null) return 0; + return (int)Math.abs(tStats[0]); + } + + @Override + public final int getTransferLimit(ItemStack aStack) { + Long[] tStats = getElectricStats(aStack); + if (tStats == null) return 0; + return (int)Math.max(tStats[1], tStats[3]); + } + + @Override + public final int charge(ItemStack aStack, int aCharge, int aTier, boolean aIgnoreTransferLimit, boolean aSimulate) { + Long[] tStats = getElectricStats(aStack); + if (tStats == null || tStats[2] > aTier || !(tStats[3] == -1 || tStats[3] == -3 || (tStats[3] < 0 && aCharge == Integer.MAX_VALUE)) || aStack.stackSize != 1) return 0; + long tChargeBefore = getRealCharge(aStack), tNewCharge = aCharge==Integer.MAX_VALUE?Long.MAX_VALUE:Math.min(Math.abs(tStats[0]), tChargeBefore + (aIgnoreTransferLimit?aCharge:Math.min(tStats[1], aCharge))); + if (!aSimulate) setCharge(aStack, tNewCharge); + return (int)(tNewCharge-tChargeBefore); + } + + @Override + public final int discharge(ItemStack aStack, int aCharge, int aTier, boolean aIgnoreTransferLimit, boolean aSimulate) { + Long[] tStats = getElectricStats(aStack); + if (tStats == null || tStats[2] > aTier) return 0; + if (tStats[3] > 0) { + if (aCharge < tStats[3] || aStack.stackSize < 1) return 0; + if (!aSimulate) aStack.stackSize--; + return (int)(long)tStats[3]; + } + long tChargeBefore = getRealCharge(aStack), tNewCharge = Math.max(0, tChargeBefore - (aIgnoreTransferLimit?aCharge:Math.min(tStats[1], aCharge))); + if (!aSimulate) setCharge(aStack, tNewCharge); + return (int)(tChargeBefore-tNewCharge); + } + + @Override + public final int getCharge(ItemStack aStack) { + return (int)Math.min(Integer.MAX_VALUE, getRealCharge(aStack)); + } + + @Override + public final boolean canUse(ItemStack aStack, int aAmount) { + return getRealCharge(aStack) >= aAmount; + } + + @Override + public final boolean use(ItemStack aStack, int aAmount, EntityLivingBase aPlayer) { + chargeFromArmor(aStack, aPlayer); + if (aPlayer instanceof EntityPlayer && ((EntityPlayer)aPlayer).capabilities.isCreativeMode) return true; + int tTransfer = discharge(aStack, aAmount, Integer.MAX_VALUE, true, true); + if (tTransfer == aAmount) { + discharge(aStack, aAmount, Integer.MAX_VALUE, true, false); + chargeFromArmor(aStack, aPlayer); + return true; + } + discharge(aStack, aAmount, Integer.MAX_VALUE, true, false); + chargeFromArmor(aStack, aPlayer); + return false; + } + + @Override + public final void chargeFromArmor(ItemStack aStack, EntityLivingBase aPlayer) { + if (aPlayer == null || aPlayer.worldObj.isRemote) return; + for (int i = 1; i < 5; i++) { + ItemStack tArmor = aPlayer.getEquipmentInSlot(i); + if (GT_ModHandler.isElectricItem(tArmor)) { + IElectricItem tArmorItem = (IElectricItem)tArmor.getItem(); + if (tArmorItem.canProvideEnergy(tArmor) && tArmorItem.getTier(tArmor) >= getTier(aStack)) { + int tCharge = ElectricItem.manager.discharge(tArmor, charge(aStack, Integer.MAX_VALUE-1, Integer.MAX_VALUE, true, true), Integer.MAX_VALUE, true, false); + if (tCharge > 0) { + charge(aStack, tCharge, Integer.MAX_VALUE, true, false); + if (aPlayer instanceof EntityPlayer) { + Container tContainer = ((EntityPlayer)aPlayer).openContainer; + if (tContainer != null) tContainer.detectAndSendChanges(); + } + } + } + } + } + } + */ + public final long getRealCharge(ItemStack aStack) { + Long[] tStats = getElectricStats(aStack); + if (tStats == null) return 0; + if (tStats[3] > 0) return (int) (long) tStats[3]; + NBTTagCompound tNBT = aStack.getTagCompound(); + return tNBT == null ? 0 : tNBT.getLong("GT.ItemCharge"); + } + + public final boolean setCharge(ItemStack aStack, long aCharge) { + Long[] tStats = getElectricStats(aStack); + if (tStats == null || tStats[3] > 0) return false; + NBTTagCompound tNBT = aStack.getTagCompound(); + if (tNBT == null) tNBT = new NBTTagCompound(); + tNBT.removeTag("GT.ItemCharge"); + aCharge = Math.min(tStats[0] < 0 ? Math.abs(tStats[0] / 2) : aCharge, Math.abs(tStats[0])); + if (aCharge > 0) { + aStack.setItemDamage(getChargedMetaData(aStack)); + tNBT.setLong("GT.ItemCharge", aCharge); + } else { + aStack.setItemDamage(getEmptyMetaData(aStack)); + } + if (tNBT.hasNoTags()) aStack.setTagCompound(null); + else aStack.setTagCompound(tNBT); + isItemStackUsable(aStack); + return true; + } + + public short getChargedMetaData(ItemStack aStack) { + return (short) aStack.getItemDamage(); + } + + public short getEmptyMetaData(ItemStack aStack) { + return (short) aStack.getItemDamage(); + } + + @Override + public FluidStack getFluid(ItemStack aStack) { + return getFluidContent(aStack); + } + + @Override + public int getCapacity(ItemStack aStack) { + Long[] tStats = getFluidContainerStats(aStack); + return tStats == null ? 0 : (int) Math.max(0, tStats[0]); + } + + @Override + public int fill(ItemStack aStack, FluidStack aFluid, boolean doFill) { + if (aStack == null || aStack.stackSize != 1) return 0; + + ItemStack tStack = GT_Utility.fillFluidContainer(aFluid, aStack, false, false); + if (tStack != null) { + aStack.setItemDamage(tStack.getItemDamage()); + aStack.func_150996_a(tStack.getItem()); + return GT_Utility.getFluidForFilledItem(tStack, false).amount; + } + + Long[] tStats = getFluidContainerStats(aStack); + if (tStats == null || tStats[0] <= 0 || aFluid == null || aFluid.getFluid().getID() <= 0 || aFluid.amount <= 0) + return 0; + + FluidStack tFluid = getFluidContent(aStack); + + if (tFluid == null || tFluid.getFluid().getID() <= 0) { + if (aFluid.amount <= tStats[0]) { + if (doFill) { + setFluidContent(aStack, aFluid); + } + return aFluid.amount; + } + if (doFill) { + tFluid = aFluid.copy(); + tFluid.amount = (int) (long) tStats[0]; + setFluidContent(aStack, tFluid); + } + return (int) (long) tStats[0]; + } + + if (!tFluid.isFluidEqual(aFluid)) return 0; + + int space = (int) (long) tStats[0] - tFluid.amount; + if (aFluid.amount <= space) { + if (doFill) { + tFluid.amount += aFluid.amount; + setFluidContent(aStack, tFluid); + } + return aFluid.amount; + } + if (doFill) { + tFluid.amount = (int) (long) tStats[0]; + setFluidContent(aStack, tFluid); + } + return space; + } + + @Override + public FluidStack drain(ItemStack aStack, int maxDrain, boolean doDrain) { + if (aStack == null || aStack.stackSize != 1) return null; + + FluidStack tFluid = GT_Utility.getFluidForFilledItem(aStack, false); + if (tFluid != null && maxDrain >= tFluid.amount) { + ItemStack tStack = GT_Utility.getContainerItem(aStack, false); + if (tStack == null) { + aStack.stackSize = 0; + return tFluid; + } + aStack.setItemDamage(tStack.getItemDamage()); + aStack.func_150996_a(tStack.getItem()); + return tFluid; + } + + Long[] tStats = getFluidContainerStats(aStack); + if (tStats == null || tStats[0] <= 0) return null; + + tFluid = getFluidContent(aStack); + if (tFluid == null) return null; + + int used = maxDrain; + if (tFluid.amount < used) used = tFluid.amount; + if (doDrain) { + tFluid.amount -= used; + setFluidContent(aStack, tFluid); + } + + FluidStack drained = tFluid.copy(); + drained.amount = used; + return drained; + } + + public FluidStack getFluidContent(ItemStack aStack) { + Long[] tStats = getFluidContainerStats(aStack); + if (tStats == null || tStats[0] <= 0) return GT_Utility.getFluidForFilledItem(aStack, false); + NBTTagCompound tNBT = aStack.getTagCompound(); + return tNBT == null ? null : FluidStack.loadFluidStackFromNBT(tNBT.getCompoundTag("GT.FluidContent")); + } + + public void setFluidContent(ItemStack aStack, FluidStack aFluid) { + NBTTagCompound tNBT = aStack.getTagCompound(); + if (tNBT == null) tNBT = new NBTTagCompound(); + else tNBT.removeTag("GT.FluidContent"); + if (aFluid != null && aFluid.amount > 0) + tNBT.setTag("GT.FluidContent", aFluid.writeToNBT(new NBTTagCompound())); + if (tNBT.hasNoTags()) aStack.setTagCompound(null); + else aStack.setTagCompound(tNBT); + isItemStackUsable(aStack); + } + + @Override + public int getItemStackLimit(ItemStack aStack) { + Long[] tStats = getElectricStats(aStack); + if (tStats != null && (tStats[3] == -1 || tStats[3] == -3) && getRealCharge(aStack) > 0) return 1; + tStats = getFluidContainerStats(aStack); + if (tStats != null) return (int) (long) tStats[1]; + return 64; + } + + @Override + public final Item getChargedItem(ItemStack itemStack) { + return this; + } + + @Override + public final Item getEmptyItem(ItemStack itemStack) { + return this; + } + + @Override + public final int getTier(ItemStack aStack) { + Long[] tStats = getElectricStats(aStack); + return (int) (tStats == null ? Integer.MAX_VALUE : tStats[2]); + } + + @Override + public final String getToolTip(ItemStack aStack) { + return null; + } // This has its own ToolTip Handler, no need to let the IC2 Handler screw us up at this Point + + @Override + public final IElectricItemManager getManager(ItemStack aStack) { + return this; + } // We are our own Manager + + @Override + public final boolean getShareTag() { + return true; + } // just to be sure. + + @Override + public int getItemEnchantability() { + return 0; + } + + @Override + public boolean isBookEnchantable(ItemStack aStack, ItemStack aBook) { + return false; + } + + @Override + public boolean getIsRepairable(ItemStack aStack, ItemStack aMaterial) { + return false; + } + + @Override + public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + if (stack.getDisplayName().contains("LuV")){ + HEX_OxFFFFFF = 0xffffcc; + } + else if (stack.getDisplayName().contains("ZPM")){ + HEX_OxFFFFFF = 0xace600; + } + else if (stack.getDisplayName().contains("UV")){ + HEX_OxFFFFFF = 0xffff00; + } + else if (stack.getDisplayName().contains("MAX")){ + HEX_OxFFFFFF = 0xff0000; + } + else { + HEX_OxFFFFFF = 0xffffff; + } + return HEX_OxFFFFFF; + } +} \ No newline at end of file diff --git a/src/Java/miscutil/gregtech/api/items/Gregtech_MetaItem_X32.java b/src/Java/miscutil/gregtech/api/items/Gregtech_MetaItem_X32.java new file mode 100644 index 0000000000..815eb04239 --- /dev/null +++ b/src/Java/miscutil/gregtech/api/items/Gregtech_MetaItem_X32.java @@ -0,0 +1,194 @@ +package miscutil.gregtech.api.items; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; + +import java.util.Arrays; +import java.util.List; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/** + * @author Gregorius Techneticies + *

+ * One Item for everything! + *

+ * This brilliant Item Class is used for automatically generating all possible variations of Material Items, like Dusts, Ingots, Gems, Plates and similar. + * It saves me a ton of work, when adding Items, because I always have to make a new Item SubType for each OreDict Prefix, when adding a new Material. + *

+ * As you can see, up to 32766 Items can be generated using this Class. And the last 766 Items can be custom defined, just to save space and MetaData. + *

+ * These Items can also have special RightClick abilities, electric Charge or even be set to become a Food alike Item. + */ +public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem { + + protected final OrePrefixes[] mGeneratedPrefixList; + + /** + * Creates the Item using these Parameters. + * + * @param aUnlocalized The Unlocalized Name of this Item. + * @param aGeneratedPrefixList The OreDict Prefixes you want to have generated. + */ + public Gregtech_MetaItem_X32(String aUnlocalized, OrePrefixes... aGeneratedPrefixList) { + super(aUnlocalized, (short) 32000, (short) 766); + mGeneratedPrefixList = Arrays.copyOf(aGeneratedPrefixList, 32); + + for (int i = 0; i < 32000; i++) { + OrePrefixes tPrefix = mGeneratedPrefixList[i / 1000]; + if (tPrefix == null) continue; + Materials tMaterial = GregTech_API.sGeneratedMaterials[i % 1000]; + if (tMaterial == null) continue; + if (doesMaterialAllowGeneration(tPrefix, tMaterial)) { + ItemStack tStack = new ItemStack(this, 1, i); + GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".name", getDefaultLocalization(tPrefix, tMaterial, i)); + GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(tPrefix.mMaterialAmount / GT_Values.M)); + if (tPrefix.mIsUnificatable) { + GT_OreDictUnificator.set(tPrefix, tMaterial, tStack); + } else { + GT_OreDictUnificator.registerOre(tPrefix.get(tMaterial), tStack); + } + if ((tPrefix == OrePrefixes.stick || tPrefix == OrePrefixes.wireFine) && (tMaterial == Materials.Lead || tMaterial == Materials.Tin || tMaterial == Materials.SolderingAlloy)) { + GregTech_API.sSolderingMetalList.add(tStack); + } + } + } + } + + /* ---------- OVERRIDEABLE FUNCTIONS ---------- */ + + /** + * @return the Color Modulation the Material is going to be rendered with. + */ + @Override + public short[] getRGBa(ItemStack aStack) { + Materials tMaterial = GregTech_API.sGeneratedMaterials[getDamage(aStack) % 1000]; + return tMaterial == null ? Materials._NULL.mRGBa : tMaterial.mRGBa; + } + + /** + * @param aPrefix this can be null, you have to return false in that case + * @param aMaterial this can be null, you have to return false in that case + * @return if this Item should be generated and visible. + */ + public boolean doesMaterialAllowGeneration(OrePrefixes aPrefix, Materials aMaterial) { + // You have to check for at least these Conditions in every Case! So add a super Call like the following for this before executing your Code: + // if (!super.doesMaterialAllowGeneration(aPrefix, aMaterial)) return false; + return aPrefix != null && aMaterial != null && aPrefix.doGenerateItem(aMaterial); + } + + /* ---------- OVERRIDEABLE FUNCTIONS ---------- */ + + /** + * @param aPrefix the OreDict Prefix + * @param aMaterial the Material + * @param aMetaData a Index from [0 - 31999] + * @return the Localized Name when default LangFiles are used. + */ + public String getDefaultLocalization(OrePrefixes aPrefix, Materials aMaterial, int aMetaData) { + return aPrefix.getDefaultLocalNameForItem(aMaterial); + } + + /** + * @param aMetaData a Index from [0 - 31999] + * @param aMaterial the Material + * @return an Icon Container for the Item Display. + */ + public final IIconContainer getIconContainer(int aMetaData, Materials aMaterial) { + return mGeneratedPrefixList[aMetaData / 1000] != null && mGeneratedPrefixList[aMetaData / 1000].mTextureIndex >= 0 ? aMaterial.mIconSet.mTextures[mGeneratedPrefixList[aMetaData / 1000].mTextureIndex] : null; + } + + /** + * @param aPrefix always != null + * @param aMaterial always != null + * @param aDoShowAllItems this is the Configuration Setting of the User, if he wants to see all the Stuff like Tiny Dusts or Crushed Ores as well. + * @return if this Item should be visible in NEI or Creative + */ + public boolean doesShowInCreative(OrePrefixes aPrefix, Materials aMaterial, boolean aDoShowAllItems) { + return true; + } + + /* ---------- INTERNAL OVERRIDES ---------- */ + + @Override + public ItemStack getContainerItem(ItemStack aStack) { + int aDamage = aStack.getItemDamage(); + if (aDamage < 32000 && aDamage >= 0) { + Materials aMaterial = GregTech_API.sGeneratedMaterials[aDamage % 1000]; + if (aMaterial != null && aMaterial != Materials.Empty && aMaterial != Materials._NULL) { + OrePrefixes aPrefix = mGeneratedPrefixList[aDamage / 1000]; + if (aPrefix != null) return GT_Utility.copyAmount(1, aPrefix.mContainerItem); + } + } + return null; + } + + @Override + public final IIconContainer getIconContainer(int aMetaData) { + return GregTech_API.sGeneratedMaterials[aMetaData % 1000] == null ? null : getIconContainer(aMetaData, GregTech_API.sGeneratedMaterials[aMetaData % 1000]); + } + + @Override + @SideOnly(Side.CLIENT) + public final void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) { + for (int i = 0; i < 32000; i++) + if (doesMaterialAllowGeneration(mGeneratedPrefixList[i / 1000], GregTech_API.sGeneratedMaterials[i % 1000]) && doesShowInCreative(mGeneratedPrefixList[i / 1000], GregTech_API.sGeneratedMaterials[i % 1000], GregTech_API.sDoShowAllItemsInCreative)) { + ItemStack tStack = new ItemStack(this, 1, i); + isItemStackUsable(tStack); + aList.add(tStack); + } + super.getSubItems(var1, aCreativeTab, aList); + } + + @Override + public final IIcon getIconFromDamage(int aMetaData) { + if (aMetaData < 0) return null; + if (aMetaData < 32000) { + Materials tMaterial = GregTech_API.sGeneratedMaterials[aMetaData % 1000]; + if (tMaterial == null) return null; + IIconContainer tIcon = getIconContainer(aMetaData, tMaterial); + if (tIcon != null) return tIcon.getIcon(); + return null; + } + return aMetaData - 32000 < mIconList.length ? mIconList[aMetaData - 32000][0] : null; + } + + @Override + public int getItemStackLimit(ItemStack aStack) { + int tDamage = getDamage(aStack); + if (tDamage < 32000 && mGeneratedPrefixList[tDamage / 1000] != null) + return Math.min(super.getItemStackLimit(aStack), mGeneratedPrefixList[tDamage / 1000].mDefaultStackSize); + return super.getItemStackLimit(aStack); + } + + @Override + public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + if (stack.getDisplayName().contains("LuV")){ + HEX_OxFFFFFF = 0xffffcc; + } + else if (stack.getDisplayName().contains("ZPM")){ + HEX_OxFFFFFF = 0xffe600; + } + else if (stack.getDisplayName().contains("UV")){ + HEX_OxFFFFFF = 0xffb300; + } + else if (stack.getDisplayName().contains("MAX")){ + HEX_OxFFFFFF = 0xff6500; + } + else { + HEX_OxFFFFFF = 0xffffff; + } + return HEX_OxFFFFFF; + } +} \ No newline at end of file diff --git a/src/Java/miscutil/gregtech/api/metatileentity/implementations/base/GregtechRocketFuelGeneratorBase.java b/src/Java/miscutil/gregtech/api/metatileentity/implementations/base/GregtechRocketFuelGeneratorBase.java new file mode 100644 index 0000000000..cd5dbfbafe --- /dev/null +++ b/src/Java/miscutil/gregtech/api/metatileentity/implementations/base/GregtechRocketFuelGeneratorBase.java @@ -0,0 +1,263 @@ +package miscutil.gregtech.api.metatileentity.implementations.base; + +import static gregtech.api.enums.GT_Values.V; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Utility; + +import java.util.Collection; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fluids.FluidStack; + +public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_BasicTank { + public GregtechRocketFuelGeneratorBase(int aID, String aName, String aNameRegional, int aTier, String aDescription, ITexture... aTextures) { + super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); + } + + public GregtechRocketFuelGeneratorBase(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 3, aDescription, aTextures); + } + + @Override + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + ITexture[][][] rTextures = new ITexture[10][17][]; + for (byte i = -1; i < 16; i++) { + rTextures[0][i + 1] = getFront(i); + rTextures[1][i + 1] = getBack(i); + rTextures[2][i + 1] = getBottom(i); + rTextures[3][i + 1] = getTop(i); + rTextures[4][i + 1] = getSides(i); + rTextures[5][i + 1] = getFrontActive(i); + rTextures[6][i + 1] = getBackActive(i); + rTextures[7][i + 1] = getBottomActive(i); + rTextures[8][i + 1] = getTopActive(i); + rTextures[9][i + 1] = getSidesActive(i); + } + return rTextures; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + return mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1]; + } + + String formattedName = "Added by: " + EnumChatFormatting.DARK_GREEN+"Alkalus"; + @Override + public String[] getDescription() { + return new String[]{mDescription, "Fuel Efficiency: " + getEfficiency() + "%", formattedName}; + } + + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) return true; + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + public ITexture[] getFront(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + } + + public ITexture[] getBack(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + } + + public ITexture[] getBottom(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + } + + public ITexture[] getTop(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + } + + public ITexture[] getSides(byte aColor) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + } + + public ITexture[] getFrontActive(byte aColor) { + return getFront(aColor); + } + + public ITexture[] getBackActive(byte aColor) { + return getBack(aColor); + } + + public ITexture[] getBottomActive(byte aColor) { + return getBottom(aColor); + } + + public ITexture[] getTopActive(byte aColor) { + return getTop(aColor); + } + + public ITexture[] getSidesActive(byte aColor) { + return getSides(aColor); + } + + @Override + public boolean isFacingValid(byte aSide) { + return aSide > 1; + } + + @Override + public boolean isSimpleMachine() { + return false; + } + + @Override + public boolean isValidSlot(int aIndex) { + return aIndex < 2; + } + + @Override + public boolean isEnetOutput() { + return true; + } + + @Override + public boolean isOutputFacing(byte aSide) { + return true; + } + + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + @Override + public long maxEUOutput() { + return getBaseMetaTileEntity().isAllowedToWork() ? V[mTier] : 0; + } + + @Override + public long maxEUStore() { + return Math.max(getEUVar(), V[mTier] * 80 + getMinimumStoredEU()); + } + + @Override + public boolean doesFillContainers() { + return getBaseMetaTileEntity().isAllowedToWork(); + } + + @Override + public boolean doesEmptyContainers() { + return getBaseMetaTileEntity().isAllowedToWork(); + } + + @Override + public boolean canTankBeFilled() { + return getBaseMetaTileEntity().isAllowedToWork(); + } + + @Override + public boolean canTankBeEmptied() { + return getBaseMetaTileEntity().isAllowedToWork(); + } + + @Override + public boolean displaysItemStack() { + return true; + } + + @Override + public boolean displaysStackSize() { + return false; + } + + @Override + public boolean isFluidInputAllowed(FluidStack aFluid) { + return getFuelValue(aFluid) > 0; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && aTick % 10 == 0) { + if (mFluid == null) { + if (aBaseMetaTileEntity.getUniversalEnergyStored() < maxEUOutput() + getMinimumStoredEU()) { + mInventory[getStackDisplaySlot()] = null; + } else { + if (mInventory[getStackDisplaySlot()] == null) + mInventory[getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1); + mInventory[getStackDisplaySlot()].setStackDisplayName("Generating: " + (aBaseMetaTileEntity.getUniversalEnergyStored() - getMinimumStoredEU()) + " EU"); + } + } else { + int tFuelValue = getFuelValue(mFluid), tConsumed = consumedFluidPerOperation(mFluid); + if (tFuelValue > 0 && tConsumed > 0 && mFluid.amount > tConsumed) { + long tFluidAmountToUse = Math.min(mFluid.amount / tConsumed, (maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); + if (tFluidAmountToUse > 0 && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)) + mFluid.amount -= tFluidAmountToUse * tConsumed; + } + } + if (mInventory[getInputSlot()] != null && aBaseMetaTileEntity.getUniversalEnergyStored() < (maxEUOutput() * 20 + getMinimumStoredEU()) && GT_Utility.getFluidForFilledItem(mInventory[getInputSlot()], true) == null) { + int tFuelValue = getFuelValue(mInventory[getInputSlot()]); + if (tFuelValue > 0) { + ItemStack tEmptyContainer = getEmptyContainer(mInventory[getInputSlot()]); + if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tEmptyContainer)) { + aBaseMetaTileEntity.increaseStoredEnergyUnits(tFuelValue, true); + aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); + } + } + } + } + + if (aBaseMetaTileEntity.isServerSide()) + aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()); + } + + public abstract GT_Recipe_Map getRecipes(); + + public abstract int getEfficiency(); + + public int consumedFluidPerOperation(FluidStack aLiquid) { + return 1; + } + + public int getFuelValue(FluidStack aLiquid) { + if (aLiquid == null || getRecipes() == null) return 0; + FluidStack tLiquid; + Collection tRecipeList = getRecipes().mRecipeList; + if (tRecipeList != null) for (GT_Recipe tFuel : tRecipeList) + if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null) + if (aLiquid.isFluidEqual(tLiquid)) + return (int) (((long) tFuel.mSpecialValue * getEfficiency() * consumedFluidPerOperation(tLiquid)) / 100); + return 0; + } + + public int getFuelValue(ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack) || getRecipes() == null) return 0; + GT_Recipe tFuel = getRecipes().findRecipe(getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); + if (tFuel != null) return (int) ((tFuel.mSpecialValue * 1000L * getEfficiency()) / 100); + return 0; + } + + public ItemStack getEmptyContainer(ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack) || getRecipes() == null) return null; + GT_Recipe tFuel = getRecipes().findRecipe(getBaseMetaTileEntity(), false, Long.MAX_VALUE, null, aStack); + if (tFuel != null) return GT_Utility.copy(tFuel.getOutput(0)); + return GT_Utility.getContainerItem(aStack, true); + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && (getFuelValue(aStack) > 0 || getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0); + } + + @Override + public int getCapacity() { + return 32000; + } + + @Override + public int getTankPressure() { + return -100; + } +} diff --git a/src/Java/miscutil/gregtech/api/util/GregtechRecipe.java b/src/Java/miscutil/gregtech/api/util/GregtechRecipe.java index 56b573f5ae..0a199cd1c5 100644 --- a/src/Java/miscutil/gregtech/api/util/GregtechRecipe.java +++ b/src/Java/miscutil/gregtech/api/util/GregtechRecipe.java @@ -36,6 +36,7 @@ import net.minecraftforge.fluids.FluidStack; * I know this File causes some Errors, because of missing Main Functions, but if you just need to compile Stuff, then remove said erroreous Functions. */ public class GregtechRecipe { + public static volatile int VERSION = 508; /** * If you want to change the Output, feel free to modify or even replace the whole ItemStack Array, for Inputs, please add a new Recipe, because of the HashMaps. @@ -162,28 +163,40 @@ public class GregtechRecipe { // checkCellBalance(); } - /*public GregtechRecipe(FluidStack aInput1, FluidStack aInput2, FluidStack aOutput1, int aDuration, int aEUt, int aSpecialValue) { - this(true, null, null, null, null, new FluidStack[]{aInput1, aInput2}, new FluidStack[]{aOutput1}, Math.max(aDuration, 1), aEUt, Math.max(Math.min(aSpecialValue, 160000000), 0)); - if (mInputs.length > 1) { - Gregtech_Recipe_Map.sFusionRecipes.addRecipe(this); - } - } - - - public GregtechRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { - - - this(true, new ItemStack[]{aInputs}, new ItemStack[]{aOutputs}, null, new FluidStack[]{aFluidInputs}, new FluidStack[]{}, Math.max(aDuration, 1), Math.max(aEUt, 1), 0); - - - //aOptimize, aInput1, aOutput1, bInput1,bOutput1, aDuration, aEUt - //boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue - //this(true, new FluidStack(aInput1, 300), new FluidStack(aOutput1, 300), bInput1 == null ? new ItemStack[]{bInput1} : new ItemStack[]{bInput1}, new ItemStack[]{bOutput1}, Math.max(aDuration, 1), Math.max(aEUt, 1), 0); - // this(true, new FluidStack(aInput1, 300), new FluidStack(aOutput1, 300), new ItemStack(bInput1), new ItemStack(bOutput1), Math.max(aDuration, 1), aEUt, Math.max(Math.min(aSpecialValue, 160000000), 0)); - if (mInputs.length > 1) { - Gregtech_Recipe_Map.sCokeOvenRecipes.addRecipe(this); - } - }*/ + // aSpecialValue = EU per Liter! If there is no Liquid for this Object, then it gets multiplied with 1000! + public GregtechRecipe(ItemStack aInput1, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3, ItemStack aOutput4, int aSpecialValue, int aType) { + this(true, new ItemStack[]{aInput1}, new ItemStack[]{aOutput1, aOutput2, aOutput3, aOutput4}, null, null, null, null, 0, 0, Math.max(1, aSpecialValue)); + + if (mInputs.length > 0 && aSpecialValue > 0) { + switch (aType) { + // Diesel Generator + case 0: + Gregtech_Recipe_Map.sRocketFuels.addRecipe(this); + break; + // Gas Turbine + case 1: + //Gregtech_Recipe_Map.sTurbineFuels.addRecipe(this); + break; + // Thermal Generator + case 2: + //Gregtech_Recipe_Map.sHotFuels.addRecipe(this); + break; + // Plasma Generator + case 4: + //Gregtech_Recipe_Map.sPlasmaFuels.addRecipe(this); + break; + // Magic Generator + case 5: + //Gregtech_Recipe_Map.sMagicFuels.addRecipe(this); + break; + // Fluid Generator. Usually 3. Every wrong Type ends up in the Semifluid Generator + default: + //Gregtech_Recipe_Map.sDenseLiquidFuels.addRecipe(this); + break; + } + } + } + public static void reInit() { GT_Log.out.println("GT_Mod: Re-Unificating Recipes."); for (Gregtech_Recipe_Map tMapEntry : Gregtech_Recipe_Map.sMappings) tMapEntry.reInit(); @@ -257,8 +270,8 @@ public class GregtechRecipe { public static final Collection sMappings = new ArrayList(); //public static final GT_Recipe_Map sChemicalBathRecipes = new GT_Recipe_Map(new HashSet(200), "gt.recipe.chemicalbath", "Chemical Bath", null, RES_PATH_GUI + "basicmachines/ChemicalBath", 1, 3, 1, 1, 1, E, 1, E, true, true); public static final GT_Recipe_Map sCokeOvenRecipes = new GT_Recipe_Map(new HashSet(200), "gt.recipe.cokeoven", "Coke Oven", null, RES_PATH_GUI + "basicmachines/ChemicalBath", 1, 3, 1, 1, 1, E, 1, E, true, true); - //public static final Gregtech_Recipe_Map sCokeOvenRecipes = new Gregtech_Recipe_Map(new HashSet(200), "mu.recipe.cokeoven", "Coke Oven", null, RES_PATH_GUI + "basicmachines/E_Furnace", 1, 1, 1, 1, 1, E, 1, E, true, true); - + public static final Gregtech_Recipe_Map_Fuel sRocketFuels = new Gregtech_Recipe_Map_Fuel(new HashSet(10), "gt.recipe.rocketenginefuel", "Rocket Engine Fuel", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 3000, " EU", true, true); + /** * HashMap of Recipes based on their Items @@ -600,6 +613,36 @@ public class GregtechRecipe { @Override protected GregtechRecipe addToItemMap(GregtechRecipe aRecipe) { return null; - } + } } + + /** + * Just a Recipe Map with Utility specifically for Fuels. + */ + public static class Gregtech_Recipe_Map_Fuel extends Gregtech_Recipe_Map { + public Gregtech_Recipe_Map_Fuel(Collection aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { + super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + } + + public GregtechRecipe addFuel(ItemStack aInput, ItemStack aOutput, int aFuelValueInEU) { + return addFuel(aInput, aOutput, null, null, 10000, aFuelValueInEU); + } + + public GregtechRecipe addFuel(ItemStack aInput, ItemStack aOutput, int aChance, int aFuelValueInEU) { + return addFuel(aInput, aOutput, null, null, aChance, aFuelValueInEU); + } + + public GregtechRecipe addFuel(FluidStack aFluidInput, FluidStack aFluidOutput, int aFuelValueInEU) { + return addFuel(null, null, aFluidInput, aFluidOutput, 10000, aFuelValueInEU); + } + + public GregtechRecipe addFuel(ItemStack aInput, ItemStack aOutput, FluidStack aFluidInput, FluidStack aFluidOutput, int aFuelValueInEU) { + return addFuel(aInput, aOutput, aFluidInput, aFluidOutput, 10000, aFuelValueInEU); + } + + public GregtechRecipe addFuel(ItemStack aInput, ItemStack aOutput, FluidStack aFluidInput, FluidStack aFluidOutput, int aChance, int aFuelValueInEU) { + return addRecipe(true, new ItemStack[]{aInput}, new ItemStack[]{aOutput}, null, new int[]{aChance}, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, 0, 0, aFuelValueInEU); + } + } + } \ No newline at end of file diff --git a/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java b/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java index 4cc07aafcb..e3cf25c6ca 100644 --- a/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java +++ b/src/Java/miscutil/gregtech/common/GregtechRecipeAdder.java @@ -1,6 +1,7 @@ package miscutil.gregtech.common; import gregtech.api.GregTech_API; +import gregtech.api.util.GT_Recipe; import miscutil.core.util.Utils; import miscutil.gregtech.api.interfaces.internal.IGregtech_RecipeAdder; import miscutil.gregtech.api.util.GregtechRecipe; @@ -11,44 +12,44 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { @SuppressWarnings("static-method") private void debug1(){ - Utils.LOG_INFO("=================================================================================="); - Utils.LOG_INFO("=================================================================================="); - Utils.LOG_INFO("=================================================================================="); - Utils.LOG_INFO("Walking Through CokeOven Recipe Creation."); - Utils.LOG_INFO("My name is Ralph and I will be your humble host."); + Utils.LOG_WARNING("=================================================================================="); + Utils.LOG_WARNING("=================================================================================="); + Utils.LOG_WARNING("=================================================================================="); + Utils.LOG_WARNING("Walking Through CokeOven Recipe Creation."); + Utils.LOG_WARNING("My name is Ralph and I will be your humble host."); } @SuppressWarnings("static-method") private void debug2(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ - Utils.LOG_INFO("=================================================================================="); - Utils.LOG_INFO("Taking a step forward."); - Utils.LOG_INFO("aInput1 == null && aFluidInput == null || aOutput == null && aFluidOutput == null"); - Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - Utils.LOG_INFO("Passed."); + Utils.LOG_WARNING("=================================================================================="); + Utils.LOG_WARNING("Taking a step forward."); + Utils.LOG_WARNING("aInput1 == null && aFluidInput == null || aOutput == null && aFluidOutput == null"); + Utils.LOG_WARNING("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_WARNING("Passed."); } @SuppressWarnings("static-method") private void debug3(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ - Utils.LOG_INFO("=================================================================================="); - Utils.LOG_INFO("Taking a step forward."); - Utils.LOG_INFO("(aOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get(cokeoven, aOutput, aDuration)) <= 0)"); - Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - Utils.LOG_INFO("Passed."); + Utils.LOG_WARNING("=================================================================================="); + Utils.LOG_WARNING("Taking a step forward."); + Utils.LOG_WARNING("(aOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get(cokeoven, aOutput, aDuration)) <= 0)"); + Utils.LOG_WARNING("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_WARNING("Passed."); } @SuppressWarnings("static-method") private void debug4(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ - Utils.LOG_INFO("=================================================================================="); - Utils.LOG_INFO("Taking a step forward."); - Utils.LOG_INFO("(aFluidOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get(cokeoven, aFluidOutput.getFluid().getName(), aDuration)) <= 0)"); - Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - Utils.LOG_INFO("Passed."); - Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_WARNING("=================================================================================="); + Utils.LOG_WARNING("Taking a step forward."); + Utils.LOG_WARNING("(aFluidOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get(cokeoven, aFluidOutput.getFluid().getName(), aDuration)) <= 0)"); + Utils.LOG_WARNING("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_WARNING("Passed."); + Utils.LOG_WARNING("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); } @SuppressWarnings("static-method") private void debug5(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt){ - Utils.LOG_INFO("Successfully added a Coke Oven recipe for: "+aOutput.getDisplayName()+" & "+aFluidOutput.getFluid().getName()+", Using "+aInput1.getDisplayName()+" & "+aInput2.getDisplayName()+" & liquid "+aFluidInput.getFluid().getName()+". This took "+(aDuration/20)+" seconds for "+aEUt+"eu/t."); - Utils.LOG_INFO("=================================================================================="); - Utils.LOG_INFO("=================================================================================="); - Utils.LOG_INFO("=================================================================================="); + Utils.LOG_INFO("Successfully added a Coke Oven recipe for: "+aOutput.getDisplayName()+" & "+aFluidOutput.getFluid().getName()+", Using "+aInput1.getDisplayName()+" & "+aInput2.getDisplayName()+" & liquid "+aFluidInput.getFluid().getName()+". This takes "+(aDuration/20)+" seconds for "+aEUt+"eu/t."); + Utils.LOG_WARNING("=================================================================================="); + Utils.LOG_WARNING("=================================================================================="); + Utils.LOG_WARNING("=================================================================================="); } @Override @@ -57,8 +58,8 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { try { debug1(); if (((aInput1 == null) /*&& (aFluidInput == null)*/) || ((aOutput == null) || (aFluidOutput == null))) { - Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - Utils.LOG_INFO("Something was null, returning false"); + Utils.LOG_WARNING("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_WARNING("Something was null, returning false"); return false; } @@ -66,8 +67,8 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { try { debug2(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); if ((aOutput != null) && ((aDuration = GregTech_API.sRecipeFile.get("cokeoven", aOutput, aDuration)) <= 0)) { - Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - Utils.LOG_INFO("Something was null, returning false"); + Utils.LOG_WARNING("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_WARNING("Something was null, returning false"); return false; } @@ -76,8 +77,8 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { debug3(aInput1, aInput2, aFluidInput, aFluidOutput, aOutput, aDuration, aEUt); if ((aFluidOutput == null) && ((aDuration = GregTech_API.sRecipeFile.get("cokeoven", aFluidOutput.getFluid().getName(), aDuration)) <= 0)) { - Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - Utils.LOG_INFO("Something was null, returning false"); + Utils.LOG_WARNING("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_WARNING("Something was null, returning false"); return false; } @@ -98,13 +99,20 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { return false; } } catch (Throwable e){ - Utils.LOG_INFO("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); - Utils.LOG_INFO("Failed."); + Utils.LOG_WARNING("aInput1:"+aInput1.toString()+" aInput2:"+aInput2.toString()+" aFluidInput:"+aFluidInput.toString()+" aFluidOutput:"+aFluidOutput.toString()+" aOutput:"+aOutput.toString()+" aDuration:"+aDuration+" aEU/t:"+aEUt); + Utils.LOG_WARNING("Failed."); e.getStackTrace(); return false; } } + public boolean addFuel(ItemStack aInput1, ItemStack aOutput1, int aEU, int aType) { + if (aInput1 == null) { + return false; + } + new GT_Recipe(aInput1, aOutput1, GregTech_API.sRecipeFile.get("fuel_" + aType, aInput1, aEU), aType); + return true; + } } diff --git a/src/Java/miscutil/gregtech/common/blocks/GregtechMetaCasingBlocks.java b/src/Java/miscutil/gregtech/common/blocks/GregtechMetaCasingBlocks.java index c1b98560ee..4080fc8dbb 100644 --- a/src/Java/miscutil/gregtech/common/blocks/GregtechMetaCasingBlocks.java +++ b/src/Java/miscutil/gregtech/common/blocks/GregtechMetaCasingBlocks.java @@ -7,7 +7,7 @@ import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.util.GT_LanguageManager; import gregtech.common.blocks.GT_Material_Casings; import miscutil.gregtech.api.enums.GregtechItemList; -import miscutil.gregtech.common.machines.multi.GregtechMetaTileEntityIndustrialCentrifuge; +import miscutil.gregtech.common.tileentities.machines.multi.GregtechMetaTileEntityIndustrialCentrifuge; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; diff --git a/src/Java/miscutil/gregtech/common/items/MetaGeneratedGregtechItems.java b/src/Java/miscutil/gregtech/common/items/MetaGeneratedGregtechItems.java new file mode 100644 index 0000000000..77e3b7b015 --- /dev/null +++ b/src/Java/miscutil/gregtech/common/items/MetaGeneratedGregtechItems.java @@ -0,0 +1,125 @@ +package miscutil.gregtech.common.items; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.TC_Aspects; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.objects.GT_MultiTexture; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.common.covers.GT_Cover_Arm; +import gregtech.common.covers.GT_Cover_Conveyor; +import gregtech.common.covers.GT_Cover_Pump; +import miscutil.gregtech.api.enums.GregtechItemList; +import miscutil.gregtech.api.items.Gregtech_MetaItem_X32; + +public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { + public MetaGeneratedGregtechItems INSTANCE; + + public MetaGeneratedGregtechItems() { + super("MU-metaitem.01", new OrePrefixes[]{null}); + INSTANCE = this; + int tLastID = 0; + GregtechItemList.Electric_Pump_LuV.set(addItem(tLastID = 0, "Electric Pump (LuV)", "163920 L/sec (as Cover)", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1L)})); + GregtechItemList.Electric_Pump_ZPM.set(addItem(tLastID = 1, "Electric Pump (ZPM)", "655680 L/sec (as Cover)", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 2L)})); + GregtechItemList.Electric_Pump_UV.set(addItem(tLastID = 2, "Electric Pump (UV)", "2622720 L/sec (as Cover)", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 4L)})); + GregtechItemList.Electric_Pump_MAX.set(addItem(tLastID = 3, "Electric Pump (MAX)", "10490880 L/sec (as Cover)", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 8L)})); + GregTech_API.registerCover(GregtechItemList.Electric_Pump_LuV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(8196)); + GregTech_API.registerCover(GregtechItemList.Electric_Pump_ZPM.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[6][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(32768)); + GregTech_API.registerCover(GregtechItemList.Electric_Pump_UV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[7][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(131072)); + GregTech_API.registerCover(GregtechItemList.Electric_Pump_MAX.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)}), new GT_Cover_Pump(524288)); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Pump_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SXO", "dPw", "OMW", Character.valueOf('M'), GregtechItemList.Electric_Motor_LuV, Character.valueOf('O'), OrePrefixes.ring.get(Materials.Rubber), Character.valueOf('X'), OrePrefixes.rotor.get(Materials.Tin), Character.valueOf('S'), OrePrefixes.screw.get(Materials.Tin), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Tin), Character.valueOf('P'), OrePrefixes.pipeMedium.get(Materials.Bronze)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Pump_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SXO", "dPw", "OMW", Character.valueOf('M'), GregtechItemList.Electric_Motor_ZPM, Character.valueOf('O'), OrePrefixes.ring.get(Materials.Rubber), Character.valueOf('X'), OrePrefixes.rotor.get(Materials.Bronze), Character.valueOf('S'), OrePrefixes.screw.get(Materials.Bronze), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.AnyCopper), Character.valueOf('P'), OrePrefixes.pipeMedium.get(Materials.Steel)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Pump_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SXO", "dPw", "OMW", Character.valueOf('M'), GregtechItemList.Electric_Motor_UV, Character.valueOf('O'), OrePrefixes.ring.get(Materials.Rubber), Character.valueOf('X'), OrePrefixes.rotor.get(Materials.Steel), Character.valueOf('S'), OrePrefixes.screw.get(Materials.Steel), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Gold), Character.valueOf('P'), OrePrefixes.pipeMedium.get(Materials.StainlessSteel)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Pump_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SXO", "dPw", "OMW", Character.valueOf('M'), GregtechItemList.Electric_Motor_MAX, Character.valueOf('O'), OrePrefixes.ring.get(Materials.Rubber), Character.valueOf('X'), OrePrefixes.rotor.get(Materials.StainlessSteel), Character.valueOf('S'), OrePrefixes.screw.get(Materials.StainlessSteel), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Aluminium), Character.valueOf('P'), OrePrefixes.pipeMedium.get(Materials.Titanium)}); + tLastID = 4; + GregtechItemList.Electric_Motor_LuV.set(addItem(tLastID = 4, "Electric Motor (LuV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 1L)})); + GregtechItemList.Electric_Motor_ZPM.set(addItem(tLastID = 5, "Electric Motor (ZPM)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 2L)})); + GregtechItemList.Electric_Motor_UV.set(addItem(tLastID = 6, "Electric Motor (UV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 4L)})); + GregtechItemList.Electric_Motor_MAX.set(addItem(tLastID = 7, "Electric Motor (MAX)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 8L)})); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Motor_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CWR", "WIW", "RWC", Character.valueOf('I'), OrePrefixes.stick.get(Materials.IronMagnetic), Character.valueOf('R'), OrePrefixes.stick.get(Materials.AnyIron), Character.valueOf('W'), OrePrefixes.wireGt01.get(Materials.AnyCopper), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Tin)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Motor_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CWR", "WIW", "RWC", Character.valueOf('I'), OrePrefixes.stick.get(Materials.SteelMagnetic), Character.valueOf('R'), OrePrefixes.stick.get(Materials.Aluminium), Character.valueOf('W'), OrePrefixes.wireGt01.get(Materials.Electrum), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Silver)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Motor_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CWR", "WIW", "RWC", Character.valueOf('I'), OrePrefixes.stick.get(Materials.SteelMagnetic), Character.valueOf('R'), OrePrefixes.stick.get(Materials.StainlessSteel), Character.valueOf('W'), OrePrefixes.wireGt02.get(Materials.Cupronickel), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Gold)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Motor_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CWR", "WIW", "RWC", Character.valueOf('I'), OrePrefixes.stick.get(Materials.NeodymiumMagnetic), Character.valueOf('R'), OrePrefixes.stick.get(Materials.Titanium), Character.valueOf('W'), OrePrefixes.wireGt02.get(Materials.TungstenSteel), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Nichrome)}); + + tLastID = 8; + GregtechItemList.Conveyor_Module_LuV.set(addItem(tLastID = 8, "Conveyor Module (LuV)", "1 Stack every 20 secs (as Cover)", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 1L)})); + GregtechItemList.Conveyor_Module_ZPM.set(addItem(tLastID = 9, "Conveyor Module (ZPM)", "1 Stack every 5 secs (as Cover)", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 2L)})); + GregtechItemList.Conveyor_Module_UV.set(addItem(tLastID = 10, "Conveyor Module (UV)", "1 Stack every 1 sec (as Cover)", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 4L)})); + GregtechItemList.Conveyor_Module_MAX.set(addItem(tLastID = 11, "Conveyor Module (MAX)", "1 Stack every 1/5 sec (as Cover)", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 8L)})); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Conveyor_Module_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "MCM", "RRR", Character.valueOf('M'), GregtechItemList.Electric_Motor_LuV, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Tin), Character.valueOf('R'), OrePrefixes.plate.get(Materials.Rubber)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Conveyor_Module_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "MCM", "RRR", Character.valueOf('M'), GregtechItemList.Electric_Motor_ZPM, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.AnyCopper), Character.valueOf('R'), OrePrefixes.plate.get(Materials.Rubber)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Conveyor_Module_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "MCM", "RRR", Character.valueOf('M'), GregtechItemList.Electric_Motor_UV, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Gold), Character.valueOf('R'), OrePrefixes.plate.get(Materials.Rubber)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Conveyor_Module_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "MCM", "RRR", Character.valueOf('M'), GregtechItemList.Electric_Motor_MAX, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Aluminium), Character.valueOf('R'), OrePrefixes.plate.get(Materials.Rubber)}); + GregTech_API.registerCover(GregtechItemList.Conveyor_Module_LuV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)}), new GT_Cover_Conveyor(400)); + GregTech_API.registerCover(GregtechItemList.Conveyor_Module_ZPM.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)}), new GT_Cover_Conveyor(100)); + GregTech_API.registerCover(GregtechItemList.Conveyor_Module_UV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[3][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)}), new GT_Cover_Conveyor(20)); + GregTech_API.registerCover(GregtechItemList.Conveyor_Module_MAX.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)}), new GT_Cover_Conveyor(4)); + tLastID = 12; + GregtechItemList.Electric_Piston_LuV.set(addItem(tLastID = 12, "Electric Piston (LuV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 1L)})); + GregtechItemList.Electric_Piston_ZPM.set(addItem(tLastID = 13, "Electric Piston (ZPM)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 2L)})); + GregtechItemList.Electric_Piston_UV.set(addItem(tLastID = 14, "Electric Piston (UV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 4L)})); + GregtechItemList.Electric_Piston_MAX.set(addItem(tLastID = 15, "Electric Piston (MAX)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 8L)})); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Piston_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "CSS", "CMG", Character.valueOf('P'), OrePrefixes.plate.get(Materials.Steel), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Steel), Character.valueOf('G'), OrePrefixes.gearGtSmall.get(Materials.Steel), Character.valueOf('M'), GregtechItemList.Electric_Motor_LuV, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Tin)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Piston_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "CSS", "CMG", Character.valueOf('P'), OrePrefixes.plate.get(Materials.Aluminium), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Aluminium), Character.valueOf('G'), OrePrefixes.gearGtSmall.get(Materials.Aluminium), Character.valueOf('M'), GregtechItemList.Electric_Motor_ZPM, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.AnyCopper)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Piston_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "CSS", "CMG", Character.valueOf('P'), OrePrefixes.plate.get(Materials.StainlessSteel), Character.valueOf('S'), OrePrefixes.stick.get(Materials.StainlessSteel), Character.valueOf('G'), OrePrefixes.gearGtSmall.get(Materials.StainlessSteel), Character.valueOf('M'), GregtechItemList.Electric_Motor_UV, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Gold)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Electric_Piston_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"PPP", "CSS", "CMG", Character.valueOf('P'), OrePrefixes.plate.get(Materials.Titanium), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Titanium), Character.valueOf('G'), OrePrefixes.gearGtSmall.get(Materials.Titanium), Character.valueOf('M'), GregtechItemList.Electric_Motor_MAX, Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Aluminium)}); + tLastID = 16; + GregtechItemList.Robot_Arm_LuV.set(addItem(tLastID = 16, "Robot Arm (LuV)", "Inserts into specific Slots (as Cover)", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.COGNITIO, 1L)})); + GregtechItemList.Robot_Arm_ZPM.set(addItem(tLastID = 17, "Robot Arm (ZPM)", "Inserts into specific Slots (as Cover)", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.COGNITIO, 2L)})); + GregtechItemList.Robot_Arm_UV.set(addItem(tLastID = 18, "Robot Arm (UV)", "Inserts into specific Slots (as Cover)", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.COGNITIO, 4L)})); + GregtechItemList.Robot_Arm_MAX.set(addItem(tLastID = 19, "Robot Arm (MAX)", "Inserts into specific Slots (as Cover)", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.COGNITIO, 8L)})); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Robot_Arm_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CCC", "MSM", "PES", Character.valueOf('S'), OrePrefixes.stick.get(Materials.Steel), Character.valueOf('M'), GregtechItemList.Electric_Motor_LuV, Character.valueOf('P'), GregtechItemList.Electric_Piston_LuV, Character.valueOf('E'), OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Tin)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Robot_Arm_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CCC", "MSM", "PES", Character.valueOf('S'), OrePrefixes.stick.get(Materials.Aluminium), Character.valueOf('M'), GregtechItemList.Electric_Motor_ZPM, Character.valueOf('P'), GregtechItemList.Electric_Piston_ZPM, Character.valueOf('E'), OrePrefixes.circuit.get(Materials.Good), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.AnyCopper)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Robot_Arm_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CCC", "MSM", "PES", Character.valueOf('S'), OrePrefixes.stick.get(Materials.StainlessSteel), Character.valueOf('M'), GregtechItemList.Electric_Motor_UV, Character.valueOf('P'), GregtechItemList.Electric_Piston_UV, Character.valueOf('E'), OrePrefixes.circuit.get(Materials.Advanced), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Gold)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Robot_Arm_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CCC", "MSM", "PES", Character.valueOf('S'), OrePrefixes.stick.get(Materials.Titanium), Character.valueOf('M'), GregtechItemList.Electric_Motor_MAX, Character.valueOf('P'), GregtechItemList.Electric_Piston_MAX, Character.valueOf('E'), OrePrefixes.circuit.get(Materials.Elite), Character.valueOf('C'), OrePrefixes.cableGt01.get(Materials.Aluminium)}); + GregTech_API.registerCover(GregtechItemList.Robot_Arm_LuV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)}), new GT_Cover_Arm(400)); + GregTech_API.registerCover(GregtechItemList.Robot_Arm_ZPM.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)}), new GT_Cover_Arm(100)); + GregTech_API.registerCover(GregtechItemList.Robot_Arm_UV.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[3][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)}), new GT_Cover_Arm(20)); + GregTech_API.registerCover(GregtechItemList.Robot_Arm_MAX.get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)}), new GT_Cover_Arm(4)); + tLastID = 20; + GregtechItemList.Field_Generator_LuV.set(addItem(tLastID = 20, "Field Generator (LuV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 1L)})); + GregtechItemList.Field_Generator_ZPM.set(addItem(tLastID = 21, "Field Generator (ZPM)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 2L)})); + GregtechItemList.Field_Generator_UV.set(addItem(tLastID = 22, "Field Generator (UV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 4L)})); + GregtechItemList.Field_Generator_MAX.set(addItem(tLastID = 23, "Field Generator (MAX)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 8L)})); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Field_Generator_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WCW", "CGC", "WCW", Character.valueOf('G'), OrePrefixes.gem.get(Materials.EnderPearl), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('W'), OrePrefixes.wireGt01.get(Materials.Osmium)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Field_Generator_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WCW", "CGC", "WCW", Character.valueOf('G'), OrePrefixes.gem.get(Materials.EnderEye), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Good), Character.valueOf('W'), OrePrefixes.wireGt02.get(Materials.Osmium)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Field_Generator_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WCW", "CGC", "WCW", Character.valueOf('G'), OrePrefixes.gem.get(Materials.NetherStar), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Advanced), Character.valueOf('W'), OrePrefixes.wireGt04.get(Materials.Osmium)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Field_Generator_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WCW", "CGC", "WCW", Character.valueOf('G'), OrePrefixes.gem.get(Materials.NetherStar), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Elite), Character.valueOf('W'), OrePrefixes.wireGt08.get(Materials.Osmium)}); + tLastID = 24; + GregtechItemList.Emitter_LuV.set(addItem(tLastID = 24, "Emitter (LuV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.LUX, 1L)})); + GregtechItemList.Emitter_ZPM.set(addItem(tLastID = 25, "Emitter (ZPM)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.LUX, 2L)})); + GregtechItemList.Emitter_UV.set(addItem(tLastID = 26, "Emitter (UV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.LUX, 4L)})); + GregtechItemList.Emitter_MAX.set(addItem(tLastID = 27, "Emitter (MAX)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.LUX, 8L)})); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Emitter_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SSC", "WQS", "CWS", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.Quartzite), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Brass), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Tin)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Emitter_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SSC", "WQS", "CWS", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.NetherQuartz), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Electrum), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Good), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.AnyCopper)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Emitter_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SSC", "WQS", "CWS", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.Emerald), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Chrome), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Advanced), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Gold)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Emitter_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"SSC", "WQS", "CWS", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.EnderPearl), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Platinum), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Elite), Character.valueOf('W'), OrePrefixes.cableGt01.get(Materials.Aluminium)}); + tLastID = 28; + GregtechItemList.Sensor_LuV.set(addItem(tLastID = 28, "Sensor (LuV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.SENSUS, 1L)})); + GregtechItemList.Sensor_ZPM.set(addItem(tLastID = 29, "Sensor (ZPM)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.SENSUS, 2L)})); + GregtechItemList.Sensor_UV.set(addItem(tLastID = 30, "Sensor (UV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.SENSUS, 4L)})); + GregtechItemList.Sensor_MAX.set(addItem(tLastID = 31, "Sensor (MAX)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.SENSUS, 8L)})); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Sensor_LuV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"P Q", "PS ", "CPP", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.Quartzite), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Brass), Character.valueOf('P'), OrePrefixes.plate.get(Materials.Steel), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Basic)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Sensor_ZPM.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"P Q", "PS ", "CPP", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.NetherQuartz), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Electrum), Character.valueOf('P'), OrePrefixes.plate.get(Materials.Aluminium), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Good)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Sensor_UV.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"P Q", "PS ", "CPP", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.Emerald), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Chrome), Character.valueOf('P'), OrePrefixes.plate.get(Materials.StainlessSteel), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Advanced)}); + //GT_ModHandler.addCraftingRecipe(GregtechItemList.Sensor_MAX.get(1L, new Object[0]), //GT_ModHandler.RecipeBits.DISMANTLEABLE | //GT_ModHandler.RecipeBits.NOT_REMOVABLE | //GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"P Q", "PS ", "CPP", Character.valueOf('Q'), OrePrefixes.gem.get(Materials.EnderPearl), Character.valueOf('S'), OrePrefixes.stick.get(Materials.Platinum), Character.valueOf('P'), OrePrefixes.plate.get(Materials.Titanium), Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Elite)}); + + + //GregtechItemList.Circuit_Primitive.set(addItem(tLastID = 700, "NAND Chip", "A very simple Circuit", new Object[]{OrePrefixes.circuit.get(Materials.Primitive)})); + //GregtechItemList.Circuit_Basic.set(addItem(tLastID = 701, "Basic Electronic Circuit", "A basic Circuit", new Object[]{OrePrefixes.circuit.get(Materials.Basic)})); + //GregtechItemList.Circuit_Good.set(addItem(tLastID = 702, "Good Electronic Circuit", "A good Circuit", new Object[]{OrePrefixes.circuit.get(Materials.Good)})); + //GregtechItemList.Circuit_Advanced.set(addItem(tLastID = 703, "Advanced Circuit", "An advanced Circuit", new Object[]{OrePrefixes.circuit.get(Materials.Advanced)})); + GregtechItemList.Circuit_Data.set(addItem(tLastID = 704, "Circuit I", "A Data Chip", new Object[]{OrePrefixes.circuit.get(Materials.Data)})); + GregtechItemList.Circuit_Elite.set(addItem(tLastID = 705, "Circuit II", "A Processor", new Object[]{OrePrefixes.circuit.get(Materials.Elite)})); + GregtechItemList.Circuit_Master.set(addItem(tLastID = 706, "Circuit III", "A High Voltage Processor", new Object[]{OrePrefixes.circuit.get(Materials.Master)})); + + + + + + + + } +} diff --git a/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCentrifuge.java b/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCentrifuge.java deleted file mode 100644 index 8bef3fa1d3..0000000000 --- a/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCentrifuge.java +++ /dev/null @@ -1,391 +0,0 @@ -package miscutil.gregtech.common.machines.multi; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import miscutil.core.block.ModBlocks; -import miscutil.core.util.Utils; -import miscutil.gregtech.api.gui.GUI_MultiMachine; -import miscutil.gregtech.api.objects.GregtechRenderedTexture; -import net.minecraft.block.Block; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import org.apache.commons.lang3.ArrayUtils; - -public class GregtechMetaTileEntityIndustrialCentrifuge -extends GT_MetaTileEntity_MultiBlockBase { - private static boolean controller; - - public GregtechMetaTileEntityIndustrialCentrifuge(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntityIndustrialCentrifuge(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntityIndustrialCentrifuge(this.mName); - } - - @Override - public String[] getDescription() { - return new String[]{ - "Controller Block for the Industrial Centrifuge", - "Size: 3x3x3 (Hollow)", - "Controller (Front Center)", - "1x Maintenance Hatch (Rear Center)", - "The rest can be placed anywhere except the Front", - "1x Input Hatch", - "1x Output Hatch", - "1x Input Bus", - "1x Output Bus", - "1x [EV] Energy Hatch (Can be higher Tier)", - "Needs a Turbine Item (inside controller GUI)", - "Centrifuge Casings for the rest (16 at least)",}; - } - - /*@Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{GregtechTextures.BlockIcons.GT_CASING_BLOCKS[0], new GT_RenderedTexture(aActive ? Textures.BlockIcons.LARGETURBINE_ACTIVE5 : Textures.BlockIcons.LARGETURBINE5)}; - } - return new ITexture[]{GregtechTextures.BlockIcons.GT_CASING_BLOCKS[0]}; - }*/ - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? new GregtechRenderedTexture(Textures.BlockIcons.LARGETURBINE_ACTIVE5) : new GregtechRenderedTexture(Textures.BlockIcons.LARGETURBINE5) : Textures.BlockIcons.CASING_BLOCKS[57]}; - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "CokeOven.png"); - } - - @Override - public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes; - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; - } - - ArrayList tInputList = getStoredInputs(); - GT_Recipe mLastRecipe; - - @Override - public boolean checkRecipe(ItemStack aStack) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - - GT_Recipe.GT_Recipe_Map map = getRecipeMap(); - for (int i = 0; i < tInputList.size() - 1; i++) { - for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { - tInputList.remove(j--); - } else { - tInputList.remove(i--); - break; - } - } - } - } - ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); - - ArrayList tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { - for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { - if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { - tFluidList.remove(j--); - } else { - tFluidList.remove(i--); - break; - } - } - } - } - FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); - if (tInputList.size() > 0 || tFluids.length > 0) { - GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - if (tRecipe != null) { - if (tRecipe.mFluidInputs != null) { - - } - mLastRecipe = tRecipe; - this.mEUt = 0; - this.mOutputItems = null; - this.mOutputFluids = null; - int machines = Math.min(16, mInventory[1].stackSize); - int i = 0; - for (; i < machines; i++) { - if (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) { - if (i == 0) { - return false; - } - break; - } - } - this.mMaxProgresstime = tRecipe.mDuration; - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); - } else { - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = tRecipe.mDuration; - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 4; - } - } - this.mEUt *= i; - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length]; - for (int h = 0; h < tRecipe.mOutputs.length; h++) { - tOut[h] = tRecipe.getOutput(h).copy(); - tOut[h].stackSize = 0; - } - FluidStack tFOut = null; - if (tRecipe.getFluidOutput(0) != null) tFOut = tRecipe.getFluidOutput(0).copy(); - for (int f = 0; f < tOut.length; f++) { - if (tRecipe.mOutputs[f] != null && tOut[f] != null) { - for (int g = 0; g < i; g++) { - if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) - tOut[f].stackSize += tRecipe.mOutputs[f].stackSize; - } - } - } - if (tFOut != null) { - int tSize = tFOut.amount; - tFOut.amount = tSize * i; - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - List overStacks = new ArrayList(); - for (int f = 0; f < tOut.length; f++) { - if (tOut[f].getMaxStackSize() < tOut[f].stackSize) { - while (tOut[f].getMaxStackSize() < tOut[f].stackSize) { - ItemStack tmp = tOut[f].copy(); - tmp.stackSize = tmp.getMaxStackSize(); - tOut[f].stackSize = tOut[f].stackSize - tOut[f].getMaxStackSize(); - overStacks.add(tmp); - } - } - } - if (overStacks.size() > 0) { - ItemStack[] tmp = new ItemStack[overStacks.size()]; - tmp = overStacks.toArray(tmp); - tOut = ArrayUtils.addAll(tOut, tmp); - } - List tSList = new ArrayList(); - for (ItemStack tS : tOut) { - if (tS.stackSize > 0) tSList.add(tS); - } - tOut = tSList.toArray(new ItemStack[tSList.size()]); - this.mOutputItems = tOut; - this.mOutputFluids = new FluidStack[]{tFOut}; - updateSlots(); - return true; - } - } - return false; - } - - @SuppressWarnings("static-method") - public Block getCasingBlock() { - return ModBlocks.blockCasingsMisc; - } - - @SuppressWarnings("static-method") - public byte getCasingMeta() { - return 0; - } - - @SuppressWarnings("static-method") - public byte getCasingTextureIndex() { - return 0; - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int yDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - //Utils.LOG_WARNING("X:"+xDir+" Y:"+yDir+" Z:"+zDir); - if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { - return false; - } - int tAmount = 0; - for (int i = -1; i < 2; i++) { //X-Dir - for (int j = -1; j < 2; j++) { //Z-Dir - for (int h = -1; h < 2; h++) { //Y-Dir - if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { - - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - //Utils.LOG_INFO("X:"+tTileEntity.getXCoord()+" Y:"+tTileEntity.getYCoord()+" Z:"+tTileEntity.getZCoord()); - if ((!addMaintenanceToMachineList(tTileEntity, 57)) && (!addInputToMachineList(tTileEntity, 57)) && (!addOutputToMachineList(tTileEntity, 57)) && (!addEnergyInputToMachineList(tTileEntity, 57))) { - - //Maintenance Hatch - if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) { - if (tTileEntity.getXCoord() == aBaseMetaTileEntity.getXCoord() && tTileEntity.getYCoord() == aBaseMetaTileEntity.getYCoord() && tTileEntity.getZCoord() == (aBaseMetaTileEntity.getZCoord()+2)) { - if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) { - Utils.LOG_INFO("MAINT HATCH IN CORRECT PLACE"); - this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntity.getMetaTileEntity()); - ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); - } else { - return false; - } - } - else { - Utils.LOG_INFO("MAINT HATCH IN WRONG PLACE"); - } - } - - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 0) { - return false; - } - tAmount++; - - } - } - } - } - } - return tAmount >= 16; - } - - @SuppressWarnings("static-method") - public boolean ignoreController(Block tTileEntity) { - if (!controller && tTileEntity == GregTech_API.sBlockMachines) { - return true; - } - return false; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override - public int getAmountOfOutputs() { - return 1; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } - - private boolean checkStructure(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack){ - - Utils.LOG_INFO("structure checking"); - int x = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int y = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY; - int z = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - Utils.LOG_INFO("X:"+x+" Y:"+y+" Z:"+z); - - //North case - int hatchMaintainence[] = {x, y, z+2}; - int hatchInputBus[] = {x+1, y, z+1}; - int hatchOutputBus[] = {x-1, y, z+1}; - int hatchInput[] = {x+1, y+1, z+1}; - int hatchOutput[] = {x-1, y+1, z+1}; - int hatchEnergy[] = {x, y+1, z+2}; - - //South case - int hatchMaintainence0[] = {x, y, z-2}; - int hatchInputBus0[] = {x-1, y, z-1}; - int hatchOutputBus0[] = {x+1, y, z-1}; - int hatchInput0[] = {x-1, y+1, z-1}; - int hatchOutput0[] = {x+1, y+1, z-1}; - int hatchEnergy0[] = {x, y+1, z-2}; - - - //East case - int hatchMaintainence1[] = {x+2, y, z}; - int hatchInputBus1[] = {x+1, y, z+1}; - int hatchOutputBus1[] = {x+1, y, z-1}; - int hatchInput1[] = {x+1, y+1, z+1}; - int hatchOutput1[] = {x+1, y+1, z-1}; - int hatchEnergy1[] = {x+2, y+1, z}; - - //West case - int hatchMaintainence2[] = {x-2, y, z}; - int hatchInputBus2[] = {x-1, y, z-1}; - int hatchOutputBus2[] = {x-1, y, z+1}; - int hatchInput2[] = {x-1, y+1, z-1}; - int hatchOutput2[] = {x-1, y+1, z+1}; - int hatchEnergy2[] = {x-2, y+1, z}; - - - - /*//Maintenance Hatch - IGregTechTileEntity tTileEntityMaintenanceHatch = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2); - if ((tTileEntityMaintenanceHatch != null) && (tTileEntityMaintenanceHatch.getMetaTileEntity() != null)) { - if ((tTileEntityMaintenanceHatch.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) { - this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntityMaintenanceHatch.getMetaTileEntity()); - ((GT_MetaTileEntity_Hatch) tTileEntityMaintenanceHatch.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); - } else { - return false; - } - }*/ - - /*//Energy Hatch - IGregTechTileEntity tTileEntityEnergyHatch = getBaseMetaTileEntity().getIGregTechTileEntity(i, h+1, j+2); - if ((tTileEntityEnergyHatch != null) && (tTileEntityEnergyHatch.getMetaTileEntity() != null)) { - if ((tTileEntityEnergyHatch.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Energy)) { - this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntityEnergyHatch.getMetaTileEntity()); - ((GT_MetaTileEntity_Hatch) tTileEntityEnergyHatch.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); - } else { - return false; - } - }*/ - - - - - return false; - } -} \ No newline at end of file diff --git a/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCokeOven.java b/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCokeOven.java deleted file mode 100644 index 7c96c7e913..0000000000 --- a/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialCokeOven.java +++ /dev/null @@ -1,268 +0,0 @@ -package miscutil.gregtech.common.machines.multi; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; - -import java.util.ArrayList; -import java.util.Arrays; - -import miscutil.core.block.ModBlocks; -import miscutil.core.util.Utils; -import miscutil.gregtech.api.gui.GUI_MultiMachine; -import miscutil.gregtech.api.util.GregtechRecipe; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -public class GregtechMetaTileEntityIndustrialCokeOven - extends GT_MetaTileEntity_MultiBlockBase { - private int mLevel = 0; - - public GregtechMetaTileEntityIndustrialCokeOven(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntityIndustrialCokeOven(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntityIndustrialCokeOven(this.mName); - } - - @Override - public String[] getDescription() { - return new String[]{"Smelts up to 6-18 Items at once", - "Controller Block for the Multi Smelter", - "Size: 3x3x3 (Hollow)", - "Controller (front middle at bottom)", - "8x Heating Coils (middle Layer, hollow)", - "1x Input (one of bottom)", - "1x Output (one of bottom)", - "1x Energy Hatch (one of bottom)", - "1x Maintenance Hatch (one of bottom)", - "1x Muffler Hatch (top middle)", - "Heat Proof Machine Casings for the rest"}; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[58], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[58]}; - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "CokeOven.png"); - } - - @Override - public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes; - - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; - } - - @Override - public boolean checkRecipe(ItemStack aStack) { - ArrayList tInputList = getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { - for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { - tInputList.remove(j--); - } else { - tInputList.remove(i--); - break; - } - } - } - } - ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); - - ArrayList tFluidList = getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { - for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { - if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { - tFluidList.remove(j--); - } else { - tFluidList.remove(i--); - break; - } - } - } - } - FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); - if (tInputList.size() > 0) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - if ((tRecipe != null) && (this.mLevel >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); - } else { - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = tRecipe.mDuration; - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 2; - } - } - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; - this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; - updateSlots(); - return true; - } - } - return false; - } - /*public boolean checkRecipe(ItemStack aStack) { - ArrayList tInputList = getStoredInputs(); - if (!tInputList.isEmpty()) { - byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage())); - - int j = 0; - this.mOutputItems = new ItemStack[12 * this.mLevel]; - for (int i = 0; (i < 100) && (j < this.mOutputItems.length); i++) { - if (null != (this.mOutputItems[j] = GT_ModHandler.getSmeltingOutput((ItemStack) tInputList.get(i % tInputList.size()), true, null))) { - j++; - } - } - if (j > 0) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - - this.mEUt = (-4 * (1 << tTier - 1) * (1 << tTier - 1) * this.mLevel); - this.mMaxProgresstime = Math.max(1, 512 / (1 << tTier - 1)); - } - updateSlots(); - return true; - } - return false; - }*/ - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - int xr = aBaseMetaTileEntity.getXCoord(); - int yr = aBaseMetaTileEntity.getYCoord(); - int zr = aBaseMetaTileEntity.getZCoord(); - this.mLevel = 0; - if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { - return false; - } - addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 2, zDir), 1); - - byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir); - switch (tUsedMeta) { - case 2: - this.mLevel = 1; - break; - case 3: - this.mLevel = 2; - break; - default: - return false; - } - this.mOutputItems = new ItemStack[12 * this.mLevel]; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - if ((i != 0) || (j != 0)) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != tUsedMeta) { - return false; - } - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != 1) { - return false; - } - } - } - } - for (int i = -1; i < 2; i++) { - xr = aBaseMetaTileEntity.getXCoord(); - yr = aBaseMetaTileEntity.getYCoord(); - zr = aBaseMetaTileEntity.getZCoord(); - Utils.LOG_INFO("STEP 1 - x ["+xr+"] y ["+yr+"] z ["+zr+"]"); - for (int j = -1; j < 2; j++) { - xr = aBaseMetaTileEntity.getXCoord(); - yr = aBaseMetaTileEntity.getYCoord(); - zr = aBaseMetaTileEntity.getZCoord(); - Utils.LOG_INFO("STEP 2 - x ["+xr+"] y ["+yr+"] z ["+zr+"]"); - if ((xDir + i != 0) || (zDir + j != 0)) { - xr = aBaseMetaTileEntity.getXCoord(); - yr = aBaseMetaTileEntity.getYCoord(); - zr = aBaseMetaTileEntity.getZCoord(); - Utils.LOG_INFO("STEP 3 - x ["+xr+"] y ["+yr+"] z ["+zr+"]"); - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 1)) && (!addInputToMachineList(tTileEntity, 1)) && (!addOutputToMachineList(tTileEntity, 1)) && (!addEnergyInputToMachineList(tTileEntity, 1))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 1) { - return false; - } - } - } - } - } - return true; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override - public int getAmountOfOutputs() { - return 24; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } -} diff --git a/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialPlatePress.java b/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialPlatePress.java deleted file mode 100644 index 8ed5a90731..0000000000 --- a/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIndustrialPlatePress.java +++ /dev/null @@ -1,249 +0,0 @@ -package miscutil.gregtech.common.machines.multi; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_GUIContainer_MultiMachine; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Utility; - -import java.util.ArrayList; - -import miscutil.core.util.Utils; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -public class GregtechMetaTileEntityIndustrialPlatePress -extends GT_MetaTileEntity_MultiBlockBase { - public GregtechMetaTileEntityIndustrialPlatePress(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntityIndustrialPlatePress(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntityIndustrialPlatePress(this.mName); - } - - @Override - public String[] getDescription() { - return new String[]{"Controller Block for the Vacuum Freezer", "Size: 3x3x3 (Hollow)", "Controller (front centered)", "1x Input (anywhere)", "1x Output (anywhere)", "1x Energy Hatch (anywhere)", "1x Maintenance Hatch (anywhere)", "Frost Proof Casings for the rest (16 at least!)"}; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[17], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[17]}; - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "VacuumFreezer.png"); - } - - @Override - public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return GT_Recipe.GT_Recipe_Map.sBenderRecipes; - } - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; - } - - @Override - public boolean checkRecipe(ItemStack aStack) { - ArrayList tInputList = getStoredInputs(); - for (ItemStack tInput : tInputList) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sVacuumRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); - if (tRecipe != null) { - if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[]{tInput})) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - if (tRecipe.mEUt <= 16) { - this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); - } else { - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = tRecipe.mDuration; - while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 2; - } - } - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; - updateSlots(); - return true; - } - } - } - return false; - } - - /*public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { - return false; - } - int stepX = 0; - int stepY = 0; - int stepZ = 0; - - int tAmount = 0; - for (int i = -1; i < 2; i++) { - stepX=+i; - for (int j = -1; j < 2; j++) { - stepZ=+j; - for (int h = -1; h < 2; h++) { - stepY=+h; - Utils.LOG_INFO("X:"+stepX); - Utils.LOG_INFO("Y:"+stepY); - Utils.LOG_INFO("Z:"+stepZ); - Utils.LOG_INFO("Block Facing - X:"+xDir+" Z:"+zDir); - Utils.LOG_INFO("(h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))"); - Utils.LOG_INFO(" "+(h != 0)+" || "+(((xDir + i != 0)+" || "+(zDir + j != 0))+" && "+((i != 0)+" || "+(j != 0)))); - try { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - Utils.LOG_INFO("IPP - RESULT - ? - ["+tTileEntity.getXCoord()+"] y ["+tTileEntity.getYCoord()+"] z ["+tTileEntity.getZCoord()+"] || i ["+i+"] j ["+j+"] h ["+h+"]"); - } catch(Throwable t){Utils.LOG_INFO("Bad move"); - } - if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 17)) && (!addInputToMachineList(tTileEntity, 17)) && (!addOutputToMachineList(tTileEntity, 17)) && (!addEnergyInputToMachineList(tTileEntity, 17))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings2) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 1) { - return false; - } - tAmount++; - } - } - - } - } - } - return tAmount >= 16; - }*/ - - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { - return false; - } - int stepX = aBaseMetaTileEntity.getXCoord(); - int stepY = aBaseMetaTileEntity.getYCoord(); - int stepZ = aBaseMetaTileEntity.getZCoord(); - int temp = 0; - - Utils.LOG_INFO("Starting Block located @ "+"[X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); - - int tAmount = 0; - switch (xDir) { - case -1: - stepX++; - Utils.LOG_INFO("Modifying stepX + accomodate a "+xDir+" xDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); - break; - - case 1: - stepX--; - Utils.LOG_INFO("Modifying stepX - accomodate a "+xDir+" xDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); - break; - } - switch (zDir) { - case -1: - stepZ++; - Utils.LOG_INFO("Modifying stepZ + accomodate a "+zDir+" zDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); - break; - - case 1: - stepZ--; - Utils.LOG_INFO("Modifying stepZ - accomodate a "+zDir+" zDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); - break; - } - - for (int i = stepX-1; i <= stepX+1; i++){ - for (int j = stepZ-1; j <= stepZ+1; j++){ - for (int h = stepY-1; h <= stepY+1; h++){ - - - Utils.LOG_INFO("Block Facing - X:"+xDir+" Z:"+zDir); - Utils.LOG_INFO("(h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))"); - Utils.LOG_INFO(" "+(h != 0)+" || "+(((xDir + i != 0)+" || "+(zDir + j != 0))+" && "+((i != 0)+" || "+(j != 0)))); - - try { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - Utils.LOG_INFO("IPP - RESULT - ? - ["+tTileEntity.getXCoord()+"] y ["+tTileEntity.getYCoord()+"] z ["+tTileEntity.getZCoord()+"] || i ["+i+"] j ["+j+"] h ["+h+"]"); - } catch(Throwable t){Utils.LOG_INFO("Checking Non-Hatch/Bus Block/Casing"); - } - if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, 17)) && (!addInputToMachineList(tTileEntity, 17)) && (!addOutputToMachineList(tTileEntity, 17)) && (!addEnergyInputToMachineList(tTileEntity, 17))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings2) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 1) { - return false; - } - tAmount++; - } - } - } - } - } - - - return tAmount >= 16; - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override - public int getAmountOfOutputs() { - return 1; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } -} diff --git a/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIronBlastFurnace.java b/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIronBlastFurnace.java deleted file mode 100644 index e590ca25c7..0000000000 --- a/src/Java/miscutil/gregtech/common/machines/multi/GregtechMetaTileEntityIronBlastFurnace.java +++ /dev/null @@ -1,369 +0,0 @@ -package miscutil.gregtech.common.machines.multi; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import miscutil.core.block.ModBlocks; -import miscutil.gregtech.api.gui.CONTAINER_IronBlastFurnace; -import miscutil.gregtech.api.gui.GUI_IronBlastFurnace; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; - -public class GregtechMetaTileEntityIronBlastFurnace - extends MetaTileEntity { - private static final ITexture[] FACING_SIDE = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL)}; - private static final ITexture[] FACING_FRONT = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT)}; - private static final ITexture[] FACING_ACTIVE = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_ACTIVE)}; - public int mMaxProgresstime = 0; - public int mUpdate = 30; - public int mProgresstime = 0; - public boolean mMachine = false; - public ItemStack mOutputItem1; - public ItemStack mOutputItem2; - - public GregtechMetaTileEntityIronBlastFurnace(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional, 4); - } - - public GregtechMetaTileEntityIronBlastFurnace(String aName) { - super(aName, 4); - } - - @Override - public String[] getDescription() { - return new String[]{"Slowly, Skip the Bronze age, Get some Steel!", "Multiblock: 3x3x5 hollow with opening on top", "40 Iron Plated Bricks required"}; - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return aActive ? FACING_ACTIVE : FACING_FRONT; - } - return FACING_SIDE; - } - - @Override - public boolean isSteampowered() { - return false; - } - - @Override - public boolean isElectric() { - return false; - } - - @Override - public boolean isPneumatic() { - return false; - } - - @Override - public boolean isEnetInput() { - return false; - } - - @Override - public boolean isEnetOutput() { - return false; - } - - @Override - public boolean isInputFacing(byte aSide) { - return false; - } - - @Override - public boolean isOutputFacing(byte aSide) { - return false; - } - - @Override - public boolean isTeleporterCompatible() { - return false; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public int getProgresstime() { - return this.mProgresstime; - } - - @Override - public int maxProgresstime() { - return this.mMaxProgresstime; - } - - @Override - public int increaseProgress(int aProgress) { - this.mProgresstime += aProgress; - return this.mMaxProgresstime - this.mProgresstime; - } - - @Override - public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { - return (GregTech_API.getCoverBehavior(aCoverID.toStack()).isSimpleCover()) && (super.allowCoverOnSide(aSide, aCoverID)); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntityIronBlastFurnace(this.mName); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mProgresstime", this.mProgresstime); - aNBT.setInteger("mMaxProgresstime", this.mMaxProgresstime); - if (this.mOutputItem1 != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - this.mOutputItem1.writeToNBT(tNBT); - aNBT.setTag("mOutputItem1", tNBT); - } - if (this.mOutputItem2 != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - this.mOutputItem2.writeToNBT(tNBT); - aNBT.setTag("mOutputItem2", tNBT); - } - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - this.mUpdate = 30; - this.mProgresstime = aNBT.getInteger("mProgresstime"); - this.mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); - this.mOutputItem1 = GT_Utility.loadItem(aNBT, "mOutputItem1"); - this.mOutputItem2 = GT_Utility.loadItem(aNBT, "mOutputItem2"); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_IronBlastFurnace(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_IronBlastFurnace(aPlayerInventory, aBaseMetaTileEntity); - } - - private boolean checkMachine() { - int xDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ; - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 4; j++) { //This is height - for (int k = -1; k < 2; k++) { - if ((xDir + i != 0) || (j != 0) || (zDir + k != 0)) { - if ((i != 0) || (j == -1) || (k != 0)) { - if ((getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k) != ModBlocks.blockCasingsMisc) || (getBaseMetaTileEntity().getMetaIDOffset(xDir + i, j, zDir + k) != 10)) { - return false; - } - } else if ((!GT_Utility.arrayContains(getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k), new Object[]{Blocks.lava, Blocks.flowing_lava, null})) && (!getBaseMetaTileEntity().getAirOffset(xDir + i, j, zDir + k))) { - return false; - } - } - } - } - } - return true; - } - - @Override - public void onMachineBlockUpdate() { - this.mUpdate = 30; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if ((aBaseMetaTileEntity.isClientSide()) && - (aBaseMetaTileEntity.isActive())) { - aBaseMetaTileEntity.getWorld().spawnParticle("cloud", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + Math.random(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + Math.random(), 0.0D, 0.3D, 0.0D); - } - if (aBaseMetaTileEntity.isServerSide()) { - if (this.mUpdate-- == 0) { - this.mMachine = checkMachine(); - } - if (this.mMachine) { - if (this.mMaxProgresstime > 0) { - if (++this.mProgresstime >= this.mMaxProgresstime) { - addOutputProducts(); - this.mOutputItem1 = null; - this.mOutputItem2 = null; - this.mProgresstime = 0; - this.mMaxProgresstime = 0; - try { - // GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "steel"); - } catch (Exception e) { - } - } - } else if (aBaseMetaTileEntity.isAllowedToWork()) { - checkRecipe(); - } - } - aBaseMetaTileEntity.setActive((this.mMaxProgresstime > 0) && (this.mMachine)); - if (aBaseMetaTileEntity.isActive()) { - if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) { - aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.lava, 1, 2); - this.mUpdate = 1; - } - if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) { - aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.lava, 1, 2); - this.mUpdate = 1; - } - } else { - if (aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1)) == Blocks.lava) { - aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.air, 0, 2); - this.mUpdate = 1; - } - if (aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1)) == Blocks.lava) { - aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.air, 0, 2); - this.mUpdate = 1; - } - } - } - } - - private void addOutputProducts() { - if (this.mOutputItem1 != null) { - if (this.mInventory[2] == null) { - this.mInventory[2] = GT_Utility.copy(new Object[]{this.mOutputItem1}); - } else if (GT_Utility.areStacksEqual(this.mInventory[2], this.mOutputItem1)) { - this.mInventory[2].stackSize = Math.min(this.mOutputItem1.getMaxStackSize(), this.mOutputItem1.stackSize + this.mInventory[2].stackSize); - } - } - if (this.mOutputItem2 != null) { - if (this.mInventory[3] == null) { - this.mInventory[3] = GT_Utility.copy(new Object[]{this.mOutputItem2}); - } else if (GT_Utility.areStacksEqual(this.mInventory[3], this.mOutputItem2)) { - this.mInventory[3].stackSize = Math.min(this.mOutputItem2.getMaxStackSize(), this.mOutputItem2.stackSize + this.mInventory[3].stackSize); - } - } - } - - private boolean spaceForOutput(ItemStack aStack1, ItemStack aStack2) { - if (((this.mInventory[2] == null) || (aStack1 == null) || ((this.mInventory[2].stackSize + aStack1.stackSize <= this.mInventory[2].getMaxStackSize()) && (GT_Utility.areStacksEqual(this.mInventory[2], aStack1)))) && ( - (this.mInventory[3] == null) || (aStack2 == null) || ((this.mInventory[3].stackSize + aStack2.stackSize <= this.mInventory[3].getMaxStackSize()) && (GT_Utility.areStacksEqual(this.mInventory[3], aStack2))))) { - return true; - } - return false; - } - - private boolean checkRecipe() { - if (!this.mMachine) { - return false; - } - if ((this.mInventory[0] != null) && (this.mInventory[1] != null) && (this.mInventory[0].stackSize >= 1)) { - if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "dustIron")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "ingotIron"))) { - if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 4) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 4L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 4*3); - this.mMaxProgresstime = 36000; - return true; - } - if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 2) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 4L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 2*3); - this.mMaxProgresstime = 4800*5; - return true; - } - if ((this.mInventory[0].stackSize >= 9) && ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 4) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) { - getBaseMetaTileEntity().decrStackSize(0, 9); - getBaseMetaTileEntity().decrStackSize(1, 4*3); - this.mMaxProgresstime = 64800*5; - return true; - } - } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "dustSteel")) { - if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 2) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 2*3); - this.mMaxProgresstime = 3600*5; - return true; - } - if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 1) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 2L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 1*3); - this.mMaxProgresstime = 2400*5; - return true; - } - if ((this.mInventory[0].stackSize >= 9) && ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 2) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 2L)))) { - getBaseMetaTileEntity().decrStackSize(0, 9); - getBaseMetaTileEntity().decrStackSize(1, 2*3); - this.mMaxProgresstime = 32400*5; - return true; - } - } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "blockIron")) { - if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 36) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 64); - this.mMaxProgresstime = 64800*9; - return true; - } - if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 18) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Ash, 4L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 18*3); - this.mMaxProgresstime = 43200*5; - return true; - } - if (((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 4) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) { - getBaseMetaTileEntity().decrStackSize(0, 1); - getBaseMetaTileEntity().decrStackSize(1, 4*3); - this.mMaxProgresstime = 64800*5; - return true; - } - } - } - this.mOutputItem1 = null; - this.mOutputItem2 = null; - return false; - } - - @Override - public boolean isGivingInformation() { - return false; - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aIndex > 1; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - if (aIndex < 2) { - } - return !GT_Utility.areStacksEqual(aStack, this.mInventory[0]); - } - - @Override - public byte getTileEntityBaseType() { - return 0; - } -} diff --git a/src/Java/miscutil/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java b/src/Java/miscutil/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java new file mode 100644 index 0000000000..ecf292392a --- /dev/null +++ b/src/Java/miscutil/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java @@ -0,0 +1,119 @@ +package miscutil.gregtech.common.tileentities.generators; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.ConfigCategories; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Recipe; +import miscutil.gregtech.api.metatileentity.implementations.base.GregtechRocketFuelGeneratorBase; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.common.registry.GameRegistry; + +public class GregtechMetaTileEntityRocketFuelGenerator + extends GregtechRocketFuelGeneratorBase { + + public int mEfficiency; + + public GregtechMetaTileEntityRocketFuelGenerator(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, "Requires liquid Fuel", new ITexture[0]); + onConfigLoad(); + } + + public GregtechMetaTileEntityRocketFuelGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + onConfigLoad(); + } + + @Override + public boolean isOutputFacing(byte aSide) { + return aSide == getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityRocketFuelGenerator(this.mName, this.mTier, this.mDescription, this.mTextures); + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipes() { + return GT_Recipe.GT_Recipe_Map.sDieselFuels; + } + + @Override + public int getCapacity() { + return 32000; + } + + public void onConfigLoad() { + this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, (100 - this.mTier * 8)); + } + + @Override + public int getEfficiency() { + return this.mEfficiency; + } + + @Override + public int getFuelValue(ItemStack aStack) { + int rValue = Math.max(GT_ModHandler.getFuelCanValue(aStack) * 6 / 5, super.getFuelValue(aStack)); + if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { + rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); + } + return rValue; + } + + @Override + public ITexture[] getFront(byte aColor) { + return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_FRONT), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; + } + + @Override + public ITexture[] getBack(byte aColor) { + return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BACK)}; + } + + @Override + public ITexture[] getBottom(byte aColor) { + return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM)}; + } + + @Override + public ITexture[] getTop(byte aColor) { + return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP)}; + } + + @Override + public ITexture[] getSides(byte aColor) { + return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE)}; + } + + @Override + public ITexture[] getFrontActive(byte aColor) { + return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_FRONT_ACTIVE), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; + } + + @Override + public ITexture[] getBackActive(byte aColor) { + return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BACK_ACTIVE)}; + } + + @Override + public ITexture[] getBottomActive(byte aColor) { + return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM_ACTIVE)}; + } + + @Override + public ITexture[] getTopActive(byte aColor) { + return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE)}; + } + + @Override + public ITexture[] getSidesActive(byte aColor) { + return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE_ACTIVE)}; + } +} diff --git a/src/Java/miscutil/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialCentrifuge.java b/src/Java/miscutil/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialCentrifuge.java new file mode 100644 index 0000000000..904f8db77d --- /dev/null +++ b/src/Java/miscutil/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialCentrifuge.java @@ -0,0 +1,391 @@ +package miscutil.gregtech.common.tileentities.machines.multi; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import miscutil.core.block.ModBlocks; +import miscutil.core.util.Utils; +import miscutil.gregtech.api.gui.GUI_MultiMachine; +import miscutil.gregtech.api.objects.GregtechRenderedTexture; +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +import org.apache.commons.lang3.ArrayUtils; + +public class GregtechMetaTileEntityIndustrialCentrifuge +extends GT_MetaTileEntity_MultiBlockBase { + private static boolean controller; + + public GregtechMetaTileEntityIndustrialCentrifuge(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMetaTileEntityIndustrialCentrifuge(String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityIndustrialCentrifuge(this.mName); + } + + @Override + public String[] getDescription() { + return new String[]{ + "Controller Block for the Industrial Centrifuge", + "Size: 3x3x3 (Hollow)", + "Controller (Front Center)", + "1x Maintenance Hatch (Rear Center)", + "The rest can be placed anywhere except the Front", + "1x Input Hatch", + "1x Output Hatch", + "1x Input Bus", + "1x Output Bus", + "1x [EV] Energy Hatch (Can be higher Tier)", + "Needs a Turbine Item (inside controller GUI)", + "Centrifuge Casings for the rest (16 at least)",}; + } + + /*@Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{GregtechTextures.BlockIcons.GT_CASING_BLOCKS[0], new GT_RenderedTexture(aActive ? Textures.BlockIcons.LARGETURBINE_ACTIVE5 : Textures.BlockIcons.LARGETURBINE5)}; + } + return new ITexture[]{GregtechTextures.BlockIcons.GT_CASING_BLOCKS[0]}; + }*/ + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? new GregtechRenderedTexture(Textures.BlockIcons.LARGETURBINE_ACTIVE5) : new GregtechRenderedTexture(Textures.BlockIcons.LARGETURBINE5) : Textures.BlockIcons.CASING_BLOCKS[57]}; + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "CokeOven.png"); + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + ArrayList tInputList = getStoredInputs(); + GT_Recipe mLastRecipe; + + @Override + public boolean checkRecipe(ItemStack aStack) { + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + + GT_Recipe.GT_Recipe_Map map = getRecipeMap(); + for (int i = 0; i < tInputList.size() - 1; i++) { + for (int j = i + 1; j < tInputList.size(); j++) { + if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { + if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { + tInputList.remove(j--); + } else { + tInputList.remove(i--); + break; + } + } + } + } + ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + + ArrayList tFluidList = getStoredFluids(); + for (int i = 0; i < tFluidList.size() - 1; i++) { + for (int j = i + 1; j < tFluidList.size(); j++) { + if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { + if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { + tFluidList.remove(j--); + } else { + tFluidList.remove(i--); + break; + } + } + } + } + FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); + if (tInputList.size() > 0 || tFluids.length > 0) { + GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + if (tRecipe != null) { + if (tRecipe.mFluidInputs != null) { + + } + mLastRecipe = tRecipe; + this.mEUt = 0; + this.mOutputItems = null; + this.mOutputFluids = null; + int machines = Math.min(16, mInventory[1].stackSize); + int i = 0; + for (; i < machines; i++) { + if (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) { + if (i == 0) { + return false; + } + break; + } + } + this.mMaxProgresstime = tRecipe.mDuration; + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 4; + } + } + this.mEUt *= i; + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length]; + for (int h = 0; h < tRecipe.mOutputs.length; h++) { + tOut[h] = tRecipe.getOutput(h).copy(); + tOut[h].stackSize = 0; + } + FluidStack tFOut = null; + if (tRecipe.getFluidOutput(0) != null) tFOut = tRecipe.getFluidOutput(0).copy(); + for (int f = 0; f < tOut.length; f++) { + if (tRecipe.mOutputs[f] != null && tOut[f] != null) { + for (int g = 0; g < i; g++) { + if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) + tOut[f].stackSize += tRecipe.mOutputs[f].stackSize; + } + } + } + if (tFOut != null) { + int tSize = tFOut.amount; + tFOut.amount = tSize * i; + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + List overStacks = new ArrayList(); + for (int f = 0; f < tOut.length; f++) { + if (tOut[f].getMaxStackSize() < tOut[f].stackSize) { + while (tOut[f].getMaxStackSize() < tOut[f].stackSize) { + ItemStack tmp = tOut[f].copy(); + tmp.stackSize = tmp.getMaxStackSize(); + tOut[f].stackSize = tOut[f].stackSize - tOut[f].getMaxStackSize(); + overStacks.add(tmp); + } + } + } + if (overStacks.size() > 0) { + ItemStack[] tmp = new ItemStack[overStacks.size()]; + tmp = overStacks.toArray(tmp); + tOut = ArrayUtils.addAll(tOut, tmp); + } + List tSList = new ArrayList(); + for (ItemStack tS : tOut) { + if (tS.stackSize > 0) tSList.add(tS); + } + tOut = tSList.toArray(new ItemStack[tSList.size()]); + this.mOutputItems = tOut; + this.mOutputFluids = new FluidStack[]{tFOut}; + updateSlots(); + return true; + } + } + return false; + } + + @SuppressWarnings("static-method") + public Block getCasingBlock() { + return ModBlocks.blockCasingsMisc; + } + + @SuppressWarnings("static-method") + public byte getCasingMeta() { + return 0; + } + + @SuppressWarnings("static-method") + public byte getCasingTextureIndex() { + return 0; + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int yDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + //Utils.LOG_WARNING("X:"+xDir+" Y:"+yDir+" Z:"+zDir); + if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { + return false; + } + int tAmount = 0; + for (int i = -1; i < 2; i++) { //X-Dir + for (int j = -1; j < 2; j++) { //Z-Dir + for (int h = -1; h < 2; h++) { //Y-Dir + if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { + + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + //Utils.LOG_INFO("X:"+tTileEntity.getXCoord()+" Y:"+tTileEntity.getYCoord()+" Z:"+tTileEntity.getZCoord()); + if ((!addMaintenanceToMachineList(tTileEntity, 57)) && (!addInputToMachineList(tTileEntity, 57)) && (!addOutputToMachineList(tTileEntity, 57)) && (!addEnergyInputToMachineList(tTileEntity, 57))) { + + //Maintenance Hatch + if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) { + if (tTileEntity.getXCoord() == aBaseMetaTileEntity.getXCoord() && tTileEntity.getYCoord() == aBaseMetaTileEntity.getYCoord() && tTileEntity.getZCoord() == (aBaseMetaTileEntity.getZCoord()+2)) { + if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) { + Utils.LOG_INFO("MAINT HATCH IN CORRECT PLACE"); + this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntity.getMetaTileEntity()); + ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); + } else { + return false; + } + } + else { + Utils.LOG_INFO("MAINT HATCH IN WRONG PLACE"); + } + } + + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 0) { + return false; + } + tAmount++; + + } + } + } + } + } + return tAmount >= 16; + } + + @SuppressWarnings("static-method") + public boolean ignoreController(Block tTileEntity) { + if (!controller && tTileEntity == GregTech_API.sBlockMachines) { + return true; + } + return false; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public int getAmountOfOutputs() { + return 1; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + + private boolean checkStructure(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack){ + + Utils.LOG_INFO("structure checking"); + int x = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int y = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY; + int z = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + Utils.LOG_INFO("X:"+x+" Y:"+y+" Z:"+z); + + //North case + int hatchMaintainence[] = {x, y, z+2}; + int hatchInputBus[] = {x+1, y, z+1}; + int hatchOutputBus[] = {x-1, y, z+1}; + int hatchInput[] = {x+1, y+1, z+1}; + int hatchOutput[] = {x-1, y+1, z+1}; + int hatchEnergy[] = {x, y+1, z+2}; + + //South case + int hatchMaintainence0[] = {x, y, z-2}; + int hatchInputBus0[] = {x-1, y, z-1}; + int hatchOutputBus0[] = {x+1, y, z-1}; + int hatchInput0[] = {x-1, y+1, z-1}; + int hatchOutput0[] = {x+1, y+1, z-1}; + int hatchEnergy0[] = {x, y+1, z-2}; + + + //East case + int hatchMaintainence1[] = {x+2, y, z}; + int hatchInputBus1[] = {x+1, y, z+1}; + int hatchOutputBus1[] = {x+1, y, z-1}; + int hatchInput1[] = {x+1, y+1, z+1}; + int hatchOutput1[] = {x+1, y+1, z-1}; + int hatchEnergy1[] = {x+2, y+1, z}; + + //West case + int hatchMaintainence2[] = {x-2, y, z}; + int hatchInputBus2[] = {x-1, y, z-1}; + int hatchOutputBus2[] = {x-1, y, z+1}; + int hatchInput2[] = {x-1, y+1, z-1}; + int hatchOutput2[] = {x-1, y+1, z+1}; + int hatchEnergy2[] = {x-2, y+1, z}; + + + + /*//Maintenance Hatch + IGregTechTileEntity tTileEntityMaintenanceHatch = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2); + if ((tTileEntityMaintenanceHatch != null) && (tTileEntityMaintenanceHatch.getMetaTileEntity() != null)) { + if ((tTileEntityMaintenanceHatch.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) { + this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntityMaintenanceHatch.getMetaTileEntity()); + ((GT_MetaTileEntity_Hatch) tTileEntityMaintenanceHatch.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); + } else { + return false; + } + }*/ + + /*//Energy Hatch + IGregTechTileEntity tTileEntityEnergyHatch = getBaseMetaTileEntity().getIGregTechTileEntity(i, h+1, j+2); + if ((tTileEntityEnergyHatch != null) && (tTileEntityEnergyHatch.getMetaTileEntity() != null)) { + if ((tTileEntityEnergyHatch.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Energy)) { + this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntityEnergyHatch.getMetaTileEntity()); + ((GT_MetaTileEntity_Hatch) tTileEntityEnergyHatch.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); + } else { + return false; + } + }*/ + + + + + return false; + } +} \ No newline at end of file diff --git a/src/Java/miscutil/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialCokeOven.java b/src/Java/miscutil/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialCokeOven.java new file mode 100644 index 0000000000..756a8add4a --- /dev/null +++ b/src/Java/miscutil/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialCokeOven.java @@ -0,0 +1,268 @@ +package miscutil.gregtech.common.tileentities.machines.multi; + +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; + +import java.util.ArrayList; +import java.util.Arrays; + +import miscutil.core.block.ModBlocks; +import miscutil.core.util.Utils; +import miscutil.gregtech.api.gui.GUI_MultiMachine; +import miscutil.gregtech.api.util.GregtechRecipe; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +public class GregtechMetaTileEntityIndustrialCokeOven + extends GT_MetaTileEntity_MultiBlockBase { + private int mLevel = 0; + + public GregtechMetaTileEntityIndustrialCokeOven(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMetaTileEntityIndustrialCokeOven(String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityIndustrialCokeOven(this.mName); + } + + @Override + public String[] getDescription() { + return new String[]{"Smelts up to 6-18 Items at once", + "Controller Block for the Multi Smelter", + "Size: 3x3x3 (Hollow)", + "Controller (front middle at bottom)", + "8x Heating Coils (middle Layer, hollow)", + "1x Input (one of bottom)", + "1x Output (one of bottom)", + "1x Energy Hatch (one of bottom)", + "1x Maintenance Hatch (one of bottom)", + "1x Muffler Hatch (top middle)", + "Heat Proof Machine Casings for the rest"}; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[58], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[58]}; + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "CokeOven.png"); + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes; + + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + ArrayList tInputList = getStoredInputs(); + for (int i = 0; i < tInputList.size() - 1; i++) { + for (int j = i + 1; j < tInputList.size(); j++) { + if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { + if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { + tInputList.remove(j--); + } else { + tInputList.remove(i--); + break; + } + } + } + } + ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + + ArrayList tFluidList = getStoredFluids(); + for (int i = 0; i < tFluidList.size() - 1; i++) { + for (int j = i + 1; j < tFluidList.size(); j++) { + if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { + if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { + tFluidList.remove(j--); + } else { + tFluidList.remove(i--); + break; + } + } + } + } + FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); + if (tInputList.size() > 0) { + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + GT_Recipe tRecipe = GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + if ((tRecipe != null) && (this.mLevel >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; + this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; + updateSlots(); + return true; + } + } + return false; + } + /*public boolean checkRecipe(ItemStack aStack) { + ArrayList tInputList = getStoredInputs(); + if (!tInputList.isEmpty()) { + byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage())); + + int j = 0; + this.mOutputItems = new ItemStack[12 * this.mLevel]; + for (int i = 0; (i < 100) && (j < this.mOutputItems.length); i++) { + if (null != (this.mOutputItems[j] = GT_ModHandler.getSmeltingOutput((ItemStack) tInputList.get(i % tInputList.size()), true, null))) { + j++; + } + } + if (j > 0) { + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + this.mEUt = (-4 * (1 << tTier - 1) * (1 << tTier - 1) * this.mLevel); + this.mMaxProgresstime = Math.max(1, 512 / (1 << tTier - 1)); + } + updateSlots(); + return true; + } + return false; + }*/ + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + int xr = aBaseMetaTileEntity.getXCoord(); + int yr = aBaseMetaTileEntity.getYCoord(); + int zr = aBaseMetaTileEntity.getZCoord(); + this.mLevel = 0; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { + return false; + } + addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 2, zDir), 1); + + byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir); + switch (tUsedMeta) { + case 2: + this.mLevel = 1; + break; + case 3: + this.mLevel = 2; + break; + default: + return false; + } + this.mOutputItems = new ItemStack[12 * this.mLevel]; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + if ((i != 0) || (j != 0)) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != tUsedMeta) { + return false; + } + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != 1) { + return false; + } + } + } + } + for (int i = -1; i < 2; i++) { + xr = aBaseMetaTileEntity.getXCoord(); + yr = aBaseMetaTileEntity.getYCoord(); + zr = aBaseMetaTileEntity.getZCoord(); + Utils.LOG_INFO("STEP 1 - x ["+xr+"] y ["+yr+"] z ["+zr+"]"); + for (int j = -1; j < 2; j++) { + xr = aBaseMetaTileEntity.getXCoord(); + yr = aBaseMetaTileEntity.getYCoord(); + zr = aBaseMetaTileEntity.getZCoord(); + Utils.LOG_INFO("STEP 2 - x ["+xr+"] y ["+yr+"] z ["+zr+"]"); + if ((xDir + i != 0) || (zDir + j != 0)) { + xr = aBaseMetaTileEntity.getXCoord(); + yr = aBaseMetaTileEntity.getYCoord(); + zr = aBaseMetaTileEntity.getZCoord(); + Utils.LOG_INFO("STEP 3 - x ["+xr+"] y ["+yr+"] z ["+zr+"]"); + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j); + if ((!addMaintenanceToMachineList(tTileEntity, 1)) && (!addInputToMachineList(tTileEntity, 1)) && (!addOutputToMachineList(tTileEntity, 1)) && (!addEnergyInputToMachineList(tTileEntity, 1))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 1) { + return false; + } + } + } + } + } + return true; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public int getAmountOfOutputs() { + return 24; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } +} diff --git a/src/Java/miscutil/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialPlatePress.java b/src/Java/miscutil/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialPlatePress.java new file mode 100644 index 0000000000..e733c55c1c --- /dev/null +++ b/src/Java/miscutil/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialPlatePress.java @@ -0,0 +1,249 @@ +package miscutil.gregtech.common.tileentities.machines.multi; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Textures; +import gregtech.api.gui.GT_GUIContainer_MultiMachine; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; + +import java.util.ArrayList; + +import miscutil.core.util.Utils; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; + +public class GregtechMetaTileEntityIndustrialPlatePress +extends GT_MetaTileEntity_MultiBlockBase { + public GregtechMetaTileEntityIndustrialPlatePress(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMetaTileEntityIndustrialPlatePress(String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityIndustrialPlatePress(this.mName); + } + + @Override + public String[] getDescription() { + return new String[]{"Controller Block for the Vacuum Freezer", "Size: 3x3x3 (Hollow)", "Controller (front centered)", "1x Input (anywhere)", "1x Output (anywhere)", "1x Energy Hatch (anywhere)", "1x Maintenance Hatch (anywhere)", "Frost Proof Casings for the rest (16 at least!)"}; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[17], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[17]}; + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "VacuumFreezer.png"); + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return GT_Recipe.GT_Recipe_Map.sBenderRecipes; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + ArrayList tInputList = getStoredInputs(); + for (ItemStack tInput : tInputList) { + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sVacuumRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); + if (tRecipe != null) { + if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[]{tInput})) { + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = tRecipe.mDuration; + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; + updateSlots(); + return true; + } + } + } + return false; + } + + /*public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { + return false; + } + int stepX = 0; + int stepY = 0; + int stepZ = 0; + + int tAmount = 0; + for (int i = -1; i < 2; i++) { + stepX=+i; + for (int j = -1; j < 2; j++) { + stepZ=+j; + for (int h = -1; h < 2; h++) { + stepY=+h; + Utils.LOG_INFO("X:"+stepX); + Utils.LOG_INFO("Y:"+stepY); + Utils.LOG_INFO("Z:"+stepZ); + Utils.LOG_INFO("Block Facing - X:"+xDir+" Z:"+zDir); + Utils.LOG_INFO("(h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))"); + Utils.LOG_INFO(" "+(h != 0)+" || "+(((xDir + i != 0)+" || "+(zDir + j != 0))+" && "+((i != 0)+" || "+(j != 0)))); + try { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + Utils.LOG_INFO("IPP - RESULT - ? - ["+tTileEntity.getXCoord()+"] y ["+tTileEntity.getYCoord()+"] z ["+tTileEntity.getZCoord()+"] || i ["+i+"] j ["+j+"] h ["+h+"]"); + } catch(Throwable t){Utils.LOG_INFO("Bad move"); + } + if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + if ((!addMaintenanceToMachineList(tTileEntity, 17)) && (!addInputToMachineList(tTileEntity, 17)) && (!addOutputToMachineList(tTileEntity, 17)) && (!addEnergyInputToMachineList(tTileEntity, 17))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings2) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 1) { + return false; + } + tAmount++; + } + } + + } + } + } + return tAmount >= 16; + }*/ + + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { + return false; + } + int stepX = aBaseMetaTileEntity.getXCoord(); + int stepY = aBaseMetaTileEntity.getYCoord(); + int stepZ = aBaseMetaTileEntity.getZCoord(); + int temp = 0; + + Utils.LOG_INFO("Starting Block located @ "+"[X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); + + int tAmount = 0; + switch (xDir) { + case -1: + stepX++; + Utils.LOG_INFO("Modifying stepX + accomodate a "+xDir+" xDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); + break; + + case 1: + stepX--; + Utils.LOG_INFO("Modifying stepX - accomodate a "+xDir+" xDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); + break; + } + switch (zDir) { + case -1: + stepZ++; + Utils.LOG_INFO("Modifying stepZ + accomodate a "+zDir+" zDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); + break; + + case 1: + stepZ--; + Utils.LOG_INFO("Modifying stepZ - accomodate a "+zDir+" zDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]"); + break; + } + + for (int i = stepX-1; i <= stepX+1; i++){ + for (int j = stepZ-1; j <= stepZ+1; j++){ + for (int h = stepY-1; h <= stepY+1; h++){ + + + Utils.LOG_INFO("Block Facing - X:"+xDir+" Z:"+zDir); + Utils.LOG_INFO("(h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))"); + Utils.LOG_INFO(" "+(h != 0)+" || "+(((xDir + i != 0)+" || "+(zDir + j != 0))+" && "+((i != 0)+" || "+(j != 0)))); + + try { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + Utils.LOG_INFO("IPP - RESULT - ? - ["+tTileEntity.getXCoord()+"] y ["+tTileEntity.getYCoord()+"] z ["+tTileEntity.getZCoord()+"] || i ["+i+"] j ["+j+"] h ["+h+"]"); + } catch(Throwable t){Utils.LOG_INFO("Checking Non-Hatch/Bus Block/Casing"); + } + if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + if ((!addMaintenanceToMachineList(tTileEntity, 17)) && (!addInputToMachineList(tTileEntity, 17)) && (!addOutputToMachineList(tTileEntity, 17)) && (!addEnergyInputToMachineList(tTileEntity, 17))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings2) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 1) { + return false; + } + tAmount++; + } + } + } + } + } + + + return tAmount >= 16; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public int getAmountOfOutputs() { + return 1; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } +} diff --git a/src/Java/miscutil/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIronBlastFurnace.java b/src/Java/miscutil/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIronBlastFurnace.java new file mode 100644 index 0000000000..630d5054f9 --- /dev/null +++ b/src/Java/miscutil/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIronBlastFurnace.java @@ -0,0 +1,369 @@ +package miscutil.gregtech.common.tileentities.machines.multi; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.objects.GT_ItemStack; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import miscutil.core.block.ModBlocks; +import miscutil.gregtech.api.gui.CONTAINER_IronBlastFurnace; +import miscutil.gregtech.api.gui.GUI_IronBlastFurnace; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; + +public class GregtechMetaTileEntityIronBlastFurnace + extends MetaTileEntity { + private static final ITexture[] FACING_SIDE = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL)}; + private static final ITexture[] FACING_FRONT = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT)}; + private static final ITexture[] FACING_ACTIVE = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_ACTIVE)}; + public int mMaxProgresstime = 0; + public int mUpdate = 30; + public int mProgresstime = 0; + public boolean mMachine = false; + public ItemStack mOutputItem1; + public ItemStack mOutputItem2; + + public GregtechMetaTileEntityIronBlastFurnace(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional, 4); + } + + public GregtechMetaTileEntityIronBlastFurnace(String aName) { + super(aName, 4); + } + + @Override + public String[] getDescription() { + return new String[]{"Slowly, Skip the Bronze age, Get some Steel!", "Multiblock: 3x3x5 hollow with opening on top", "40 Iron Plated Bricks required"}; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return aActive ? FACING_ACTIVE : FACING_FRONT; + } + return FACING_SIDE; + } + + @Override + public boolean isSteampowered() { + return false; + } + + @Override + public boolean isElectric() { + return false; + } + + @Override + public boolean isPneumatic() { + return false; + } + + @Override + public boolean isEnetInput() { + return false; + } + + @Override + public boolean isEnetOutput() { + return false; + } + + @Override + public boolean isInputFacing(byte aSide) { + return false; + } + + @Override + public boolean isOutputFacing(byte aSide) { + return false; + } + + @Override + public boolean isTeleporterCompatible() { + return false; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + @Override + public int getProgresstime() { + return this.mProgresstime; + } + + @Override + public int maxProgresstime() { + return this.mMaxProgresstime; + } + + @Override + public int increaseProgress(int aProgress) { + this.mProgresstime += aProgress; + return this.mMaxProgresstime - this.mProgresstime; + } + + @Override + public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) { + return (GregTech_API.getCoverBehavior(aCoverID.toStack()).isSimpleCover()) && (super.allowCoverOnSide(aSide, aCoverID)); + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityIronBlastFurnace(this.mName); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setInteger("mProgresstime", this.mProgresstime); + aNBT.setInteger("mMaxProgresstime", this.mMaxProgresstime); + if (this.mOutputItem1 != null) { + NBTTagCompound tNBT = new NBTTagCompound(); + this.mOutputItem1.writeToNBT(tNBT); + aNBT.setTag("mOutputItem1", tNBT); + } + if (this.mOutputItem2 != null) { + NBTTagCompound tNBT = new NBTTagCompound(); + this.mOutputItem2.writeToNBT(tNBT); + aNBT.setTag("mOutputItem2", tNBT); + } + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + this.mUpdate = 30; + this.mProgresstime = aNBT.getInteger("mProgresstime"); + this.mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); + this.mOutputItem1 = GT_Utility.loadItem(aNBT, "mOutputItem1"); + this.mOutputItem2 = GT_Utility.loadItem(aNBT, "mOutputItem2"); + } + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new CONTAINER_IronBlastFurnace(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_IronBlastFurnace(aPlayerInventory, aBaseMetaTileEntity); + } + + private boolean checkMachine() { + int xDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 4; j++) { //This is height + for (int k = -1; k < 2; k++) { + if ((xDir + i != 0) || (j != 0) || (zDir + k != 0)) { + if ((i != 0) || (j == -1) || (k != 0)) { + if ((getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k) != ModBlocks.blockCasingsMisc) || (getBaseMetaTileEntity().getMetaIDOffset(xDir + i, j, zDir + k) != 10)) { + return false; + } + } else if ((!GT_Utility.arrayContains(getBaseMetaTileEntity().getBlockOffset(xDir + i, j, zDir + k), new Object[]{Blocks.lava, Blocks.flowing_lava, null})) && (!getBaseMetaTileEntity().getAirOffset(xDir + i, j, zDir + k))) { + return false; + } + } + } + } + } + return true; + } + + @Override + public void onMachineBlockUpdate() { + this.mUpdate = 30; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + if ((aBaseMetaTileEntity.isClientSide()) && + (aBaseMetaTileEntity.isActive())) { + aBaseMetaTileEntity.getWorld().spawnParticle("cloud", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + Math.random(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + Math.random(), 0.0D, 0.3D, 0.0D); + } + if (aBaseMetaTileEntity.isServerSide()) { + if (this.mUpdate-- == 0) { + this.mMachine = checkMachine(); + } + if (this.mMachine) { + if (this.mMaxProgresstime > 0) { + if (++this.mProgresstime >= this.mMaxProgresstime) { + addOutputProducts(); + this.mOutputItem1 = null; + this.mOutputItem2 = null; + this.mProgresstime = 0; + this.mMaxProgresstime = 0; + try { + // GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "steel"); + } catch (Exception e) { + } + } + } else if (aBaseMetaTileEntity.isAllowedToWork()) { + checkRecipe(); + } + } + aBaseMetaTileEntity.setActive((this.mMaxProgresstime > 0) && (this.mMachine)); + if (aBaseMetaTileEntity.isActive()) { + if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) { + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.lava, 1, 2); + this.mUpdate = 1; + } + if (aBaseMetaTileEntity.getAir(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1))) { + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.lava, 1, 2); + this.mUpdate = 1; + } + } else { + if (aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1)) == Blocks.lava) { + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.air, 0, 2); + this.mUpdate = 1; + } + if (aBaseMetaTileEntity.getBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1)) == Blocks.lava) { + aBaseMetaTileEntity.getWorld().setBlock(aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getYCoord() + 1, aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1), Blocks.air, 0, 2); + this.mUpdate = 1; + } + } + } + } + + private void addOutputProducts() { + if (this.mOutputItem1 != null) { + if (this.mInventory[2] == null) { + this.mInventory[2] = GT_Utility.copy(new Object[]{this.mOutputItem1}); + } else if (GT_Utility.areStacksEqual(this.mInventory[2], this.mOutputItem1)) { + this.mInventory[2].stackSize = Math.min(this.mOutputItem1.getMaxStackSize(), this.mOutputItem1.stackSize + this.mInventory[2].stackSize); + } + } + if (this.mOutputItem2 != null) { + if (this.mInventory[3] == null) { + this.mInventory[3] = GT_Utility.copy(new Object[]{this.mOutputItem2}); + } else if (GT_Utility.areStacksEqual(this.mInventory[3], this.mOutputItem2)) { + this.mInventory[3].stackSize = Math.min(this.mOutputItem2.getMaxStackSize(), this.mOutputItem2.stackSize + this.mInventory[3].stackSize); + } + } + } + + private boolean spaceForOutput(ItemStack aStack1, ItemStack aStack2) { + if (((this.mInventory[2] == null) || (aStack1 == null) || ((this.mInventory[2].stackSize + aStack1.stackSize <= this.mInventory[2].getMaxStackSize()) && (GT_Utility.areStacksEqual(this.mInventory[2], aStack1)))) && ( + (this.mInventory[3] == null) || (aStack2 == null) || ((this.mInventory[3].stackSize + aStack2.stackSize <= this.mInventory[3].getMaxStackSize()) && (GT_Utility.areStacksEqual(this.mInventory[3], aStack2))))) { + return true; + } + return false; + } + + private boolean checkRecipe() { + if (!this.mMachine) { + return false; + } + if ((this.mInventory[0] != null) && (this.mInventory[1] != null) && (this.mInventory[0].stackSize >= 1)) { + if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "dustIron")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "ingotIron"))) { + if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 4) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 4L)))) { + getBaseMetaTileEntity().decrStackSize(0, 1); + getBaseMetaTileEntity().decrStackSize(1, 4*3); + this.mMaxProgresstime = 36000; + return true; + } + if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 2) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 4L)))) { + getBaseMetaTileEntity().decrStackSize(0, 1); + getBaseMetaTileEntity().decrStackSize(1, 2*3); + this.mMaxProgresstime = 4800*5; + return true; + } + if ((this.mInventory[0].stackSize >= 9) && ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 4) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) { + getBaseMetaTileEntity().decrStackSize(0, 9); + getBaseMetaTileEntity().decrStackSize(1, 4*3); + this.mMaxProgresstime = 64800*5; + return true; + } + } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "dustSteel")) { + if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 2) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 2L)))) { + getBaseMetaTileEntity().decrStackSize(0, 1); + getBaseMetaTileEntity().decrStackSize(1, 2*3); + this.mMaxProgresstime = 3600*5; + return true; + } + if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 1) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 1L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Ash, 2L)))) { + getBaseMetaTileEntity().decrStackSize(0, 1); + getBaseMetaTileEntity().decrStackSize(1, 1*3); + this.mMaxProgresstime = 2400*5; + return true; + } + if ((this.mInventory[0].stackSize >= 9) && ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 2) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 2L)))) { + getBaseMetaTileEntity().decrStackSize(0, 9); + getBaseMetaTileEntity().decrStackSize(1, 2*3); + this.mMaxProgresstime = 32400*5; + return true; + } + } else if (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[0], "blockIron")) { + if ((this.mInventory[1].getItem() == Items.coal) && (this.mInventory[1].stackSize >= 36) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) { + getBaseMetaTileEntity().decrStackSize(0, 1); + getBaseMetaTileEntity().decrStackSize(1, 64); + this.mMaxProgresstime = 64800*9; + return true; + } + if ((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "fuelCoke")) && (this.mInventory[1].stackSize >= 18) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Ash, 4L)))) { + getBaseMetaTileEntity().decrStackSize(0, 1); + getBaseMetaTileEntity().decrStackSize(1, 18*3); + this.mMaxProgresstime = 43200*5; + return true; + } + if (((GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCoal")) || (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[1], "blockCharcoal"))) && (this.mInventory[1].stackSize >= 4) && (spaceForOutput(this.mOutputItem1 = GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Steel, 9L), this.mOutputItem2 = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.DarkAsh, 4L)))) { + getBaseMetaTileEntity().decrStackSize(0, 1); + getBaseMetaTileEntity().decrStackSize(1, 4*3); + this.mMaxProgresstime = 64800*5; + return true; + } + } + } + this.mOutputItem1 = null; + this.mOutputItem2 = null; + return false; + } + + @Override + public boolean isGivingInformation() { + return false; + } + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return aIndex > 1; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + if (aIndex < 2) { + } + return !GT_Utility.areStacksEqual(aStack, this.mInventory[0]); + } + + @Override + public byte getTileEntityBaseType() { + return 0; + } +} diff --git a/src/resources/assets/miscutils/lang/en_US.lang b/src/resources/assets/miscutils/lang/en_US.lang index a47a3658f9..3576a13c03 100644 --- a/src/resources/assets/miscutils/lang/en_US.lang +++ b/src/resources/assets/miscutils/lang/en_US.lang @@ -37,12 +37,19 @@ item.itemFuelRod_Empty.name=Empty Fuel Rod item.itemFuelRod_Thorium.name=Thorium Fuel Rod item.itemFuelRod_Uranium.name=Uranium Fuel Rod item.itemFuelRod_Plutonium.name=Plutonium Fuel Rod + + +item.itemBedLocator_Base.name=Bed Locator [NBT Test] +item.itemBaseItemWithCharge.name=Base Chargeable Item + item.miscutils_itemDebugShapeSpawner.name=[Debug] Shapes -tile.yourFluid.name=Jack Daniels +tile.fluidJackDaniels.name=Jack Daniels tile.blockGriefSaver.name=Anti-Griefer [WIP] tile.helium_collector.name=Helium Collector tile.blockNuclearFueledHeliumGenerator.name=Nuclear Fueled Helium Generator [NFHG] +tile.blockMachineCharger.name=Charging Machine +container.Charger=Charging Machine container.NHG=Nuclear Fueled Helium Generator container.helium_collector.name=Helium Collector tile.blockStaballoy.name=Block of Staballoy diff --git a/src/resources/assets/miscutils/textures/blocks/fluids/fluid.jackdaniels.png b/src/resources/assets/miscutils/textures/blocks/fluids/fluid.jackdaniels.png new file mode 100644 index 0000000000..ef8b07e15a Binary files /dev/null and b/src/resources/assets/miscutils/textures/blocks/fluids/fluid.jackdaniels.png differ diff --git a/src/resources/assets/miscutils/textures/blocks/fluids/fluid.jackdaniels.png.mcmeta b/src/resources/assets/miscutils/textures/blocks/fluids/fluid.jackdaniels.png.mcmeta new file mode 100644 index 0000000000..0df7234a79 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/fluids/fluid.jackdaniels.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation":{ + "frametime":2 + } +} \ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/gui/machine_Charger.png b/src/resources/assets/miscutils/textures/gui/machine_Charger.png new file mode 100644 index 0000000000..ec4b790ff6 Binary files /dev/null and b/src/resources/assets/miscutils/textures/gui/machine_Charger.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/0.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/0.png new file mode 100644 index 0000000000..4a7c1ce427 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/0.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/1.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/1.png new file mode 100644 index 0000000000..4a7c1ce427 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/1.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/10.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/10.png new file mode 100644 index 0000000000..bf81a1b4b2 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/10.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/11.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/11.png new file mode 100644 index 0000000000..bf81a1b4b2 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/11.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/12.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/12.png new file mode 100644 index 0000000000..051b45e6bc Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/12.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/13.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/13.png new file mode 100644 index 0000000000..051b45e6bc Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/13.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/14.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/14.png new file mode 100644 index 0000000000..051b45e6bc Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/14.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/15.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/15.png new file mode 100644 index 0000000000..051b45e6bc Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/15.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/16.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/16.png new file mode 100644 index 0000000000..5ddb32de79 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/16.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/17.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/17.png new file mode 100644 index 0000000000..5ddb32de79 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/17.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/18.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/18.png new file mode 100644 index 0000000000..5ddb32de79 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/18.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/19.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/19.png new file mode 100644 index 0000000000..5ddb32de79 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/19.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/2.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/2.png new file mode 100644 index 0000000000..4a7c1ce427 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/2.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/20.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/20.png new file mode 100644 index 0000000000..38f7ec8756 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/20.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/21.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/21.png new file mode 100644 index 0000000000..38f7ec8756 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/21.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/22.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/22.png new file mode 100644 index 0000000000..38f7ec8756 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/22.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/23.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/23.png new file mode 100644 index 0000000000..38f7ec8756 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/23.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/24.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/24.png new file mode 100644 index 0000000000..5e4886b0f8 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/24.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/25.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/25.png new file mode 100644 index 0000000000..5e4886b0f8 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/25.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/26.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/26.png new file mode 100644 index 0000000000..5e4886b0f8 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/26.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/27.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/27.png new file mode 100644 index 0000000000..5e4886b0f8 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/27.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/28.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/28.png new file mode 100644 index 0000000000..a1c2183ee8 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/28.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/29.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/29.png new file mode 100644 index 0000000000..a1c2183ee8 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/29.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/3.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/3.png new file mode 100644 index 0000000000..4a7c1ce427 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/3.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/30.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/30.png new file mode 100644 index 0000000000..a1c2183ee8 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/30.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/31.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/31.png new file mode 100644 index 0000000000..a1c2183ee8 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/31.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/4.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/4.png new file mode 100644 index 0000000000..1a3acd9e94 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/4.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/5.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/5.png new file mode 100644 index 0000000000..1a3acd9e94 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/5.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/6.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/6.png new file mode 100644 index 0000000000..1a3acd9e94 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/6.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/7.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/7.png new file mode 100644 index 0000000000..1a3acd9e94 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/7.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/704.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/704.png new file mode 100644 index 0000000000..2d15e32231 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/704.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/705.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/705.png new file mode 100644 index 0000000000..27fbb8036a Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/705.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/706.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/706.png new file mode 100644 index 0000000000..f4eeb6d874 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/706.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/8.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/8.png new file mode 100644 index 0000000000..bf81a1b4b2 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/8.png differ diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/9.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/9.png new file mode 100644 index 0000000000..bf81a1b4b2 Binary files /dev/null and b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/9.png differ -- cgit